diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md index 7f7fcb35f38c..34d5796cd120 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md @@ -1,5 +1,57 @@ # Release History +## 2.0.0-beta.3 (2025-02-28) +### Breaking Changes + +- Enum `Kind` has been removed +- Enum `MyWorkbookManagedIdentityType` has been removed +- Function `*ClientFactory.NewMyWorkbooksClient` has been removed +- Function `NewMyWorkbooksClient` has been removed +- Function `*MyWorkbooksClient.CreateOrUpdate` has been removed +- Function `*MyWorkbooksClient.Delete` has been removed +- Function `*MyWorkbooksClient.Get` has been removed +- Function `*MyWorkbooksClient.NewListByResourceGroupPager` has been removed +- Function `*MyWorkbooksClient.NewListBySubscriptionPager` has been removed +- Function `*MyWorkbooksClient.Update` has been removed +- Struct `ErrorDefinition` has been removed +- Struct `InnerErrorTrace` has been removed +- Struct `MyWorkbook` has been removed +- Struct `MyWorkbookError` has been removed +- Struct `MyWorkbookManagedIdentity` has been removed +- Struct `MyWorkbookProperties` has been removed +- Struct `MyWorkbookResource` has been removed +- Struct `MyWorkbookUserAssignedIdentities` has been removed +- Struct `MyWorkbooksListResult` has been removed +- Field `InnerError` of struct `WorkbookErrorDefinition` has been removed + +### Features Added + +- New value `WebTestKindStandard` added to enum type `WebTestKind` +- New function `*ClientFactory.NewDeletedWorkbooksClient() *DeletedWorkbooksClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `NewDeletedWorkbooksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeletedWorkbooksClient, error)` +- New function `*DeletedWorkbooksClient.NewListBySubscriptionPager(*DeletedWorkbooksClientListBySubscriptionOptions) *runtime.Pager[DeletedWorkbooksClientListBySubscriptionResponse]` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New struct `DeletedWorkbook` +- New struct `DeletedWorkbookError` +- New struct `DeletedWorkbookErrorDefinition` +- New struct `DeletedWorkbookInnerErrorTrace` +- New struct `DeletedWorkbookProperties` +- New struct `DeletedWorkbookResource` +- New struct `DeletedWorkbooksListResult` +- New struct `ErrorFieldContract` +- New struct `HeaderField` +- New struct `ResourceAutoGenerated` +- New struct `TrackedResourceAutoGenerated` +- New struct `WebTestPropertiesRequest` +- New struct `WebTestPropertiesValidationRules` +- New struct `WebTestPropertiesValidationRulesContentValidation` +- New field `Details` in struct `ErrorResponse` +- New field `Request`, `ValidationRules` in struct `WebTestProperties` +- New field `Innererror` in struct `WorkbookErrorDefinition` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/README.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/README.md index 3fa92987d97c..626e99039b76 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/README.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Application Insight module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go index 0ba295da4512..ff0f5057797a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go @@ -241,15 +241,15 @@ func (client *AnalyticsItemsClient) listCreateRequest(ctx context.Context, resou } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2015-05-01") + if options != nil && options.IncludeContent != nil { + reqQP.Set("includeContent", strconv.FormatBool(*options.IncludeContent)) + } if options != nil && options.Scope != nil { reqQP.Set("scope", string(*options.Scope)) } if options != nil && options.Type != nil { reqQP.Set("type", string(*options.Type)) } - if options != nil && options.IncludeContent != nil { - reqQP.Set("includeContent", strconv.FormatBool(*options.IncludeContent)) - } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go index bf67c3157498..74c2e391b7da 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemList.json func ExampleAnalyticsItemsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExampleAnalyticsItemsClient_List() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemGet.json func ExampleAnalyticsItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExampleAnalyticsItemsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemPut.json func ExampleAnalyticsItemsClient_Put() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -175,7 +175,7 @@ func ExampleAnalyticsItemsClient_Put() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemDelete.json func ExampleAnalyticsItemsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go index 244dec4c12f9..2951199ba3fa 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go @@ -291,8 +291,8 @@ func (client *AnnotationsClient) listCreateRequest(ctx context.Context, resource } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2015-05-01") - reqQP.Set("start", start) reqQP.Set("end", end) + reqQP.Set("start", start) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go index c07811d06582..317b3f532c7f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go @@ -17,10 +17,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsList.json func ExampleAnnotationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -47,7 +47,7 @@ func ExampleAnnotationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsCreate.json func ExampleAnnotationsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,7 +81,7 @@ func ExampleAnnotationsClient_Create() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsDelete.json func ExampleAnnotationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExampleAnnotationsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsGet.json func ExampleAnnotationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go index ff80fe32b077..72b01362f31d 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysList.json func ExampleAPIKeysClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExampleAPIKeysClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysCreate.json func ExampleAPIKeysClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,9 +101,9 @@ func ExampleAPIKeysClient_Create() { // 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.ComponentAPIKey = armapplicationinsights.ComponentAPIKey{ // Name: to.Ptr("test"), - // APIKey: to.Ptr("eip8wlzuzlf4wzczhnzao54zcswew25azs4kadhb"), + // APIKey: to.Ptr("0000000000000000000000000000000000000000"), // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:58:52 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/fe2e0138-47c1-46c5-8726-872f54c1ca08"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/00000000-0000-0000-0000-000000000000"), // LinkedReadProperties: []*string{ // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, @@ -112,7 +112,7 @@ func ExampleAPIKeysClient_Create() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysDelete.json func ExampleAPIKeysClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,7 +146,7 @@ func ExampleAPIKeysClient_Delete() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysGet.json func ExampleAPIKeysClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md index 6f7e968eac81..aa671127576f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 -tag: package-2020-02-02 +module-version: 2.0.0-beta.3 +tag: package-2024-08-01-only ``` \ No newline at end of file diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go index f425f5917251..4867dcee1fc4 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,108 +26,170 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewAPIKeysClient creates a new instance of APIKeysClient. func (c *ClientFactory) NewAPIKeysClient() *APIKeysClient { - subClient, _ := NewAPIKeysClient(c.subscriptionID, c.credential, c.options) - return subClient + return &APIKeysClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAnalyticsItemsClient creates a new instance of AnalyticsItemsClient. func (c *ClientFactory) NewAnalyticsItemsClient() *AnalyticsItemsClient { - subClient, _ := NewAnalyticsItemsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AnalyticsItemsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAnnotationsClient creates a new instance of AnnotationsClient. func (c *ClientFactory) NewAnnotationsClient() *AnnotationsClient { - subClient, _ := NewAnnotationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AnnotationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewComponentAvailableFeaturesClient creates a new instance of ComponentAvailableFeaturesClient. func (c *ClientFactory) NewComponentAvailableFeaturesClient() *ComponentAvailableFeaturesClient { - subClient, _ := NewComponentAvailableFeaturesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ComponentAvailableFeaturesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewComponentCurrentBillingFeaturesClient creates a new instance of ComponentCurrentBillingFeaturesClient. func (c *ClientFactory) NewComponentCurrentBillingFeaturesClient() *ComponentCurrentBillingFeaturesClient { - subClient, _ := NewComponentCurrentBillingFeaturesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ComponentCurrentBillingFeaturesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewComponentFeatureCapabilitiesClient creates a new instance of ComponentFeatureCapabilitiesClient. func (c *ClientFactory) NewComponentFeatureCapabilitiesClient() *ComponentFeatureCapabilitiesClient { - subClient, _ := NewComponentFeatureCapabilitiesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ComponentFeatureCapabilitiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewComponentLinkedStorageAccountsClient creates a new instance of ComponentLinkedStorageAccountsClient. +func (c *ClientFactory) NewComponentLinkedStorageAccountsClient() *ComponentLinkedStorageAccountsClient { + return &ComponentLinkedStorageAccountsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewComponentQuotaStatusClient creates a new instance of ComponentQuotaStatusClient. func (c *ClientFactory) NewComponentQuotaStatusClient() *ComponentQuotaStatusClient { - subClient, _ := NewComponentQuotaStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ComponentQuotaStatusClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewComponentsClient creates a new instance of ComponentsClient. func (c *ClientFactory) NewComponentsClient() *ComponentsClient { - subClient, _ := NewComponentsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ComponentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDeletedWorkbooksClient creates a new instance of DeletedWorkbooksClient. +func (c *ClientFactory) NewDeletedWorkbooksClient() *DeletedWorkbooksClient { + return &DeletedWorkbooksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewExportConfigurationsClient creates a new instance of ExportConfigurationsClient. func (c *ClientFactory) NewExportConfigurationsClient() *ExportConfigurationsClient { - subClient, _ := NewExportConfigurationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ExportConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewFavoritesClient creates a new instance of FavoritesClient. func (c *ClientFactory) NewFavoritesClient() *FavoritesClient { - subClient, _ := NewFavoritesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &FavoritesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewMyWorkbooksClient creates a new instance of MyWorkbooksClient. -func (c *ClientFactory) NewMyWorkbooksClient() *MyWorkbooksClient { - subClient, _ := NewMyWorkbooksClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewLiveTokenClient creates a new instance of LiveTokenClient. +func (c *ClientFactory) NewLiveTokenClient() *LiveTokenClient { + return &LiveTokenClient{ + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } } // NewProactiveDetectionConfigurationsClient creates a new instance of ProactiveDetectionConfigurationsClient. func (c *ClientFactory) NewProactiveDetectionConfigurationsClient() *ProactiveDetectionConfigurationsClient { - subClient, _ := NewProactiveDetectionConfigurationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ProactiveDetectionConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewWebTestLocationsClient creates a new instance of WebTestLocationsClient. func (c *ClientFactory) NewWebTestLocationsClient() *WebTestLocationsClient { - subClient, _ := NewWebTestLocationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &WebTestLocationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewWebTestsClient creates a new instance of WebTestsClient. func (c *ClientFactory) NewWebTestsClient() *WebTestsClient { - subClient, _ := NewWebTestsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &WebTestsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewWorkItemConfigurationsClient creates a new instance of WorkItemConfigurationsClient. func (c *ClientFactory) NewWorkItemConfigurationsClient() *WorkItemConfigurationsClient { - subClient, _ := NewWorkItemConfigurationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &WorkItemConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewWorkbookTemplatesClient creates a new instance of WorkbookTemplatesClient. +func (c *ClientFactory) NewWorkbookTemplatesClient() *WorkbookTemplatesClient { + return &WorkbookTemplatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewWorkbooksClient creates a new instance of WorkbooksClient. func (c *ClientFactory) NewWorkbooksClient() *WorkbooksClient { - subClient, _ := NewWorkbooksClient(c.subscriptionID, c.credential, c.options) - return subClient + return &WorkbooksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go index 0d2aec46f546..8dbea01db7bd 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AvailableBillingFeaturesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AvailableBillingFeaturesGet.json func ExampleComponentAvailableFeaturesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go index a98a751d8e33..b90ca22ff6bc 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesGet.json func ExampleComponentCurrentBillingFeaturesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,7 +50,7 @@ func ExampleComponentCurrentBillingFeaturesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesUpdate.json func ExampleComponentCurrentBillingFeaturesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go index 2bec2d8f6a94..80d2ed5e0208 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FeatureCapabilitiesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FeatureCapabilitiesGet.json func ExampleComponentFeatureCapabilitiesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go new file mode 100644 index 000000000000..eee525d7501c --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go @@ -0,0 +1,324 @@ +//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 armapplicationinsights + +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" +) + +// ComponentLinkedStorageAccountsClient contains the methods for the ComponentLinkedStorageAccounts group. +// Don't use this type directly, use NewComponentLinkedStorageAccountsClient() instead. +type ComponentLinkedStorageAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewComponentLinkedStorageAccountsClient creates a new instance of ComponentLinkedStorageAccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewComponentLinkedStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ComponentLinkedStorageAccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ComponentLinkedStorageAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateAndUpdate - Replace current linked storage account for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - linkedStorageAccountsProperties - Properties that need to be specified to update linked storage accounts for an Application +// Insights component. +// - options - ComponentLinkedStorageAccountsClientCreateAndUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.CreateAndUpdate +// method. +func (client *ComponentLinkedStorageAccountsClient) CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccounts, options *ComponentLinkedStorageAccountsClientCreateAndUpdateOptions) (ComponentLinkedStorageAccountsClientCreateAndUpdateResponse, error) { + var err error + const operationName = "ComponentLinkedStorageAccountsClient.CreateAndUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createAndUpdateCreateRequest(ctx, resourceGroupName, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + resp, err := client.createAndUpdateHandleResponse(httpResp) + return resp, err +} + +// createAndUpdateCreateRequest creates the CreateAndUpdate request. +func (client *ComponentLinkedStorageAccountsClient) createAndUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccounts, options *ComponentLinkedStorageAccountsClientCreateAndUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + 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", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, linkedStorageAccountsProperties); err != nil { + return nil, err + } + return req, nil +} + +// createAndUpdateHandleResponse handles the CreateAndUpdate response. +func (client *ComponentLinkedStorageAccountsClient) createAndUpdateHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientCreateAndUpdateResponse, error) { + result := ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete linked storage accounts for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - options - ComponentLinkedStorageAccountsClientDeleteOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Delete +// method. +func (client *ComponentLinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientDeleteOptions) (ComponentLinkedStorageAccountsClientDeleteResponse, error) { + var err error + const operationName = "ComponentLinkedStorageAccountsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + return ComponentLinkedStorageAccountsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ComponentLinkedStorageAccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + 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", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the current linked storage settings for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - options - ComponentLinkedStorageAccountsClientGetOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Get +// method. +func (client *ComponentLinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientGetOptions) (ComponentLinkedStorageAccountsClientGetResponse, error) { + var err error + const operationName = "ComponentLinkedStorageAccountsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ComponentLinkedStorageAccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + 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", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ComponentLinkedStorageAccountsClient) getHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientGetResponse, error) { + result := ComponentLinkedStorageAccountsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + return result, nil +} + +// Update - Update linked storage accounts for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - linkedStorageAccountsProperties - Properties that need to be specified to update a linked storage accounts for an Application +// Insights component. +// - options - ComponentLinkedStorageAccountsClientUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Update +// method. +func (client *ComponentLinkedStorageAccountsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch, options *ComponentLinkedStorageAccountsClientUpdateOptions) (ComponentLinkedStorageAccountsClientUpdateResponse, error) { + var err error + const operationName = "ComponentLinkedStorageAccountsClient.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, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ComponentLinkedStorageAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch, options *ComponentLinkedStorageAccountsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + 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", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, linkedStorageAccountsProperties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ComponentLinkedStorageAccountsClient) updateHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientUpdateResponse, error) { + result := ComponentLinkedStorageAccountsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client_example_test.go new file mode 100644 index 000000000000..1b482227c018 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client_example_test.go @@ -0,0 +1,128 @@ +//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 armapplicationinsights_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/applicationinsights/armapplicationinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsGet.json +func ExampleComponentLinkedStorageAccountsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewComponentLinkedStorageAccountsClient().Get(ctx, "someResourceGroupName", "myComponent", armapplicationinsights.StorageTypeServiceProfiler, 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.ComponentLinkedStorageAccounts = armapplicationinsights.ComponentLinkedStorageAccounts{ + // Name: to.Ptr("serviceprofile"), + // Type: to.Ptr("microsoft.insights/components/linkedStorageAccounts"), + // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/microsoft.insights/components/myComponent/linkedStorageAccounts/serviceprofiler"), + // Properties: &armapplicationinsights.LinkedStorageAccountsProperties{ + // LinkedStorageAccount: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/Microsoft.Storage/storageAccounts/storageaccountname"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsCreateAndUpdate.json +func ExampleComponentLinkedStorageAccountsClient_CreateAndUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewComponentLinkedStorageAccountsClient().CreateAndUpdate(ctx, "someResourceGroupName", "myComponent", armapplicationinsights.StorageTypeServiceProfiler, armapplicationinsights.ComponentLinkedStorageAccounts{ + Properties: &armapplicationinsights.LinkedStorageAccountsProperties{ + LinkedStorageAccount: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/Microsoft.Storage/storageAccounts/storageaccountname"), + }, + }, 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.ComponentLinkedStorageAccounts = armapplicationinsights.ComponentLinkedStorageAccounts{ + // Name: to.Ptr("serviceprofile"), + // Type: to.Ptr("microsoft.insights/components/linkedStorageAccounts"), + // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupNameproviders/microsoft.insights/components/myComponent/linkedStorageAccounts/serviceprofiler"), + // Properties: &armapplicationinsights.LinkedStorageAccountsProperties{ + // LinkedStorageAccount: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/Microsoft.Storage/storageAccounts/storageaccountname"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsUpdate.json +func ExampleComponentLinkedStorageAccountsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewComponentLinkedStorageAccountsClient().Update(ctx, "someResourceGroupName", "myComponent", armapplicationinsights.StorageTypeServiceProfiler, armapplicationinsights.ComponentLinkedStorageAccountsPatch{ + Properties: &armapplicationinsights.LinkedStorageAccountsProperties{ + LinkedStorageAccount: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/Microsoft.Storage/storageAccounts/storageaccountname"), + }, + }, 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.ComponentLinkedStorageAccounts = armapplicationinsights.ComponentLinkedStorageAccounts{ + // Name: to.Ptr("serviceprofile"), + // Type: to.Ptr("microsoft.insights/components/linkedStorageAccounts"), + // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/microsoft.insights/components/myComponent/linkedStorageAccounts/serviceprofiler"), + // Properties: &armapplicationinsights.LinkedStorageAccountsProperties{ + // LinkedStorageAccount: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/someResourceGroupName/providers/Microsoft.Storage/storageAccounts/storageaccountname"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsDelete.json +func ExampleComponentLinkedStorageAccountsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewComponentLinkedStorageAccountsClient().Delete(ctx, "someResourceGroupName", "myComponent", armapplicationinsights.StorageTypeServiceProfiler, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go index a017fb3ba42e..ca34316f2164 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/QuotaStatusGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/QuotaStatusGet.json func ExampleComponentQuotaStatusClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go index 8d9e48c83d7e..301c5cf5ec0a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go @@ -419,7 +419,11 @@ func (client *ComponentsClient) listByResourceGroupHandleResponse(resp *http.Res // In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution // of purge requests by sending a single command whose predicate includes all // user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior -// to using for a purge request to verify that the results are expected. +// to using for a purge request to verify that the results are expected. Note: +// this operation is intended for Classic resources, for workspace-based Application Insights resource please run purge operation +// (directly on the +// workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , scoped to specific resource +// id. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-02-02 diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go index f86ea3bfb2f8..ffd3000ef588 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsList.json func ExampleComponentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,7 +104,7 @@ func ExampleComponentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsListByResourceGroup.json func ExampleComponentsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -190,7 +190,7 @@ func ExampleComponentsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsDelete.json func ExampleComponentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -207,7 +207,7 @@ func ExampleComponentsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsGet.json func ExampleComponentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -256,7 +256,7 @@ func ExampleComponentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsCreate.json func ExampleComponentsClient_CreateOrUpdate_componentCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -314,7 +314,7 @@ func ExampleComponentsClient_CreateOrUpdate_componentCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdate.json func ExampleComponentsClient_CreateOrUpdate_componentUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -372,7 +372,7 @@ func ExampleComponentsClient_CreateOrUpdate_componentUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdateTagsOnly.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdateTagsOnly.json func ExampleComponentsClient_UpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -434,7 +434,7 @@ func ExampleComponentsClient_UpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurge.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurge.json func ExampleComponentsClient_Purge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -459,7 +459,7 @@ func ExampleComponentsClient_Purge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurgeStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurgeStatus.json func ExampleComponentsClient_GetPurgeStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go index 803132691d03..cf37c407051d 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go @@ -10,7 +10,7 @@ package armapplicationinsights const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.3" ) // ApplicationType - Type of application being monitored. @@ -48,6 +48,26 @@ func PossibleCategoryTypeValues() []CategoryType { } } +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + type FavoriteSourceType string const ( @@ -198,6 +218,26 @@ func PossibleItemTypeParameterValues() []ItemTypeParameter { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // PublicNetworkAccessType - The network access type for operating on the Application Insights Component. By default it is // Enabled type PublicNetworkAccessType string @@ -248,28 +288,26 @@ func PossibleRequestSourceValues() []RequestSource { } } -// SharedTypeKind - The kind of workbook. Choices are user and shared. -type SharedTypeKind string +type StorageType string const ( - SharedTypeKindShared SharedTypeKind = "shared" - SharedTypeKindUser SharedTypeKind = "user" + StorageTypeServiceProfiler StorageType = "ServiceProfiler" ) -// PossibleSharedTypeKindValues returns the possible values for the SharedTypeKind const type. -func PossibleSharedTypeKindValues() []SharedTypeKind { - return []SharedTypeKind{ - SharedTypeKindShared, - SharedTypeKindUser, +// PossibleStorageTypeValues returns the possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{ + StorageTypeServiceProfiler, } } -// WebTestKind - The kind of web test that this web test watches. Choices are ping and multistep. +// WebTestKind - The kind of WebTest that this web test watches. Choices are ping, multistep and standard. type WebTestKind string const ( WebTestKindMultistep WebTestKind = "multistep" WebTestKindPing WebTestKind = "ping" + WebTestKindStandard WebTestKind = "standard" ) // PossibleWebTestKindValues returns the possible values for the WebTestKind const type. @@ -277,5 +315,34 @@ func PossibleWebTestKindValues() []WebTestKind { return []WebTestKind{ WebTestKindMultistep, WebTestKindPing, + WebTestKindStandard, + } +} + +// WorkbookSharedTypeKind - The kind of workbook. Only valid value is shared. +type WorkbookSharedTypeKind string + +const ( + WorkbookSharedTypeKindShared WorkbookSharedTypeKind = "shared" +) + +// PossibleWorkbookSharedTypeKindValues returns the possible values for the WorkbookSharedTypeKind const type. +func PossibleWorkbookSharedTypeKindValues() []WorkbookSharedTypeKind { + return []WorkbookSharedTypeKind{ + WorkbookSharedTypeKindShared, + } +} + +// WorkbookUpdateSharedTypeKind - The kind of workbook. Only valid value is shared. +type WorkbookUpdateSharedTypeKind string + +const ( + WorkbookUpdateSharedTypeKindShared WorkbookUpdateSharedTypeKind = "shared" +) + +// PossibleWorkbookUpdateSharedTypeKindValues returns the possible values for the WorkbookUpdateSharedTypeKind const type. +func PossibleWorkbookUpdateSharedTypeKindValues() []WorkbookUpdateSharedTypeKind { + return []WorkbookUpdateSharedTypeKind{ + WorkbookUpdateSharedTypeKindShared, } } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client.go new file mode 100644 index 000000000000..282f9a87281a --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client.go @@ -0,0 +1,105 @@ +//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 armapplicationinsights + +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" +) + +// DeletedWorkbooksClient contains the methods for the DeletedWorkbooks group. +// Don't use this type directly, use NewDeletedWorkbooksClient() instead. +type DeletedWorkbooksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeletedWorkbooksClient creates a new instance of DeletedWorkbooksClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDeletedWorkbooksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedWorkbooksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeletedWorkbooksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListBySubscriptionPager - Get all recently deleted Workbooks in a specified subscription. +// +// Generated from API version 2024-02-01-preview +// - options - DeletedWorkbooksClientListBySubscriptionOptions contains the optional parameters for the DeletedWorkbooksClient.NewListBySubscriptionPager +// method. +func (client *DeletedWorkbooksClient) NewListBySubscriptionPager(options *DeletedWorkbooksClientListBySubscriptionOptions) *runtime.Pager[DeletedWorkbooksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[DeletedWorkbooksClientListBySubscriptionResponse]{ + More: func(page DeletedWorkbooksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeletedWorkbooksClientListBySubscriptionResponse) (DeletedWorkbooksClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedWorkbooksClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return DeletedWorkbooksClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DeletedWorkbooksClient) listBySubscriptionCreateRequest(ctx context.Context, options *DeletedWorkbooksClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/deletedWorkbooks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + if options != nil && options.Category != nil { + reqQP.Set("category", string(*options.Category)) + } + if options != nil && options.Tags != nil { + reqQP.Set("tags", strings.Join(options.Tags, ",")) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DeletedWorkbooksClient) listBySubscriptionHandleResponse(resp *http.Response) (DeletedWorkbooksClientListBySubscriptionResponse, error) { + result := DeletedWorkbooksClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedWorkbooksListResult); err != nil { + return DeletedWorkbooksClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client_example_test.go new file mode 100644 index 000000000000..4a8c182b1858 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/deletedworkbooks_client_example_test.go @@ -0,0 +1,88 @@ +//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 armapplicationinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2024-02-01-preview/examples/DeletedWorkbooksList.json +func ExampleDeletedWorkbooksClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewDeletedWorkbooksClient().NewListBySubscriptionPager(&armapplicationinsights.DeletedWorkbooksClientListBySubscriptionOptions{Category: nil, + Tags: []string{}, + }) + 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.DeletedWorkbooksListResult = armapplicationinsights.DeletedWorkbooksListResult{ + // Value: []*armapplicationinsights.DeletedWorkbook{ + // { + // Name: to.Ptr("55555555-6666-7777-8888-999999999999"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/55555555-6666-7777-8888-999999999999"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.DeletedWorkbookProperties{ + // Description: to.Ptr("Sample workbook1"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Workbook 1"), + // Revision: to.Ptr("12345678901234567890123456789010"), + // SourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp1"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-04T09:07:00.123Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }, + // { + // Name: to.Ptr("55555555-6666-7777-8888-999999999998"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/my-resource-group2/providers/Microsoft.Insights/workbooks/55555555-6666-7777-8888-999999999998"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.DeletedWorkbookProperties{ + // Description: to.Ptr("Sample workbook2"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Workbook 2"), + // Revision: to.Ptr("12345678901234567890123456789011"), + // SourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/my-resource-group2/providers/Microsoft.Web/sites/MyApp2"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T09:07:01.123Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go index 8149befa4866..cd316c56a13b 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsList.json func ExampleExportConfigurationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleExportConfigurationsClient_List() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsPost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsPost.json func ExampleExportConfigurationsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,7 +112,7 @@ func ExampleExportConfigurationsClient_Create() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationDelete.json func ExampleExportConfigurationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -153,7 +153,7 @@ func ExampleExportConfigurationsClient_Delete() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationGet.json func ExampleExportConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -194,7 +194,7 @@ func ExampleExportConfigurationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationUpdate.json func ExampleExportConfigurationsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/analyticsitems_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/analyticsitems_server.go index d2713b24f922..64db97a549d6 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/analyticsitems_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/analyticsitems_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/annotations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/annotations_server.go index 38034ec78e22..a3ef83f8d756 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/annotations_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/annotations_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/apikeys_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/apikeys_server.go index 254d8fec6fd8..d261165e234b 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/apikeys_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/apikeys_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentavailablefeatures_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentavailablefeatures_server.go index a81745f2ae8b..c18ea2212ad9 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentavailablefeatures_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentavailablefeatures_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentcurrentbillingfeatures_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentcurrentbillingfeatures_server.go index e604521df04e..63b49d41c45b 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentcurrentbillingfeatures_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentcurrentbillingfeatures_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentfeaturecapabilities_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentfeaturecapabilities_server.go index dad413841b78..f63f9e54b624 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentfeaturecapabilities_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentfeaturecapabilities_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentlinkedstorageaccounts_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentlinkedstorageaccounts_server.go new file mode 100644 index 000000000000..033731b40f71 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentlinkedstorageaccounts_server.go @@ -0,0 +1,265 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// ComponentLinkedStorageAccountsServer is a fake server for instances of the armapplicationinsights.ComponentLinkedStorageAccountsClient type. +type ComponentLinkedStorageAccountsServer struct { + // CreateAndUpdate is the fake for method ComponentLinkedStorageAccountsClient.CreateAndUpdate + // HTTP status codes to indicate success: http.StatusOK + CreateAndUpdate func(ctx context.Context, resourceGroupName string, resourceName string, storageType armapplicationinsights.StorageType, linkedStorageAccountsProperties armapplicationinsights.ComponentLinkedStorageAccounts, options *armapplicationinsights.ComponentLinkedStorageAccountsClientCreateAndUpdateOptions) (resp azfake.Responder[armapplicationinsights.ComponentLinkedStorageAccountsClientCreateAndUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ComponentLinkedStorageAccountsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, storageType armapplicationinsights.StorageType, options *armapplicationinsights.ComponentLinkedStorageAccountsClientDeleteOptions) (resp azfake.Responder[armapplicationinsights.ComponentLinkedStorageAccountsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ComponentLinkedStorageAccountsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, storageType armapplicationinsights.StorageType, options *armapplicationinsights.ComponentLinkedStorageAccountsClientGetOptions) (resp azfake.Responder[armapplicationinsights.ComponentLinkedStorageAccountsClientGetResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method ComponentLinkedStorageAccountsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, resourceName string, storageType armapplicationinsights.StorageType, linkedStorageAccountsProperties armapplicationinsights.ComponentLinkedStorageAccountsPatch, options *armapplicationinsights.ComponentLinkedStorageAccountsClientUpdateOptions) (resp azfake.Responder[armapplicationinsights.ComponentLinkedStorageAccountsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewComponentLinkedStorageAccountsServerTransport creates a new instance of ComponentLinkedStorageAccountsServerTransport with the provided implementation. +// The returned ComponentLinkedStorageAccountsServerTransport instance is connected to an instance of armapplicationinsights.ComponentLinkedStorageAccountsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewComponentLinkedStorageAccountsServerTransport(srv *ComponentLinkedStorageAccountsServer) *ComponentLinkedStorageAccountsServerTransport { + return &ComponentLinkedStorageAccountsServerTransport{srv: srv} +} + +// ComponentLinkedStorageAccountsServerTransport connects instances of armapplicationinsights.ComponentLinkedStorageAccountsClient to instances of ComponentLinkedStorageAccountsServer. +// Don't use this type directly, use NewComponentLinkedStorageAccountsServerTransport instead. +type ComponentLinkedStorageAccountsServerTransport struct { + srv *ComponentLinkedStorageAccountsServer +} + +// Do implements the policy.Transporter interface for ComponentLinkedStorageAccountsServerTransport. +func (c *ComponentLinkedStorageAccountsServerTransport) 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 "ComponentLinkedStorageAccountsClient.CreateAndUpdate": + resp, err = c.dispatchCreateAndUpdate(req) + case "ComponentLinkedStorageAccountsClient.Delete": + resp, err = c.dispatchDelete(req) + case "ComponentLinkedStorageAccountsClient.Get": + resp, err = c.dispatchGet(req) + case "ComponentLinkedStorageAccountsClient.Update": + resp, err = c.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ComponentLinkedStorageAccountsServerTransport) dispatchCreateAndUpdate(req *http.Request) (*http.Response, error) { + if c.srv.CreateAndUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateAndUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/components/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/linkedStorageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.ComponentLinkedStorageAccounts](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + storageTypeParam, err := parseWithCast(matches[regex.SubexpIndex("storageType")], func(v string) (armapplicationinsights.StorageType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armapplicationinsights.StorageType(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CreateAndUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, storageTypeParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ComponentLinkedStorageAccounts, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ComponentLinkedStorageAccountsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if c.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/components/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/linkedStorageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + storageTypeParam, err := parseWithCast(matches[regex.SubexpIndex("storageType")], func(v string) (armapplicationinsights.StorageType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armapplicationinsights.StorageType(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, resourceNameParam, storageTypeParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ComponentLinkedStorageAccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/components/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/linkedStorageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + storageTypeParam, err := parseWithCast(matches[regex.SubexpIndex("storageType")], func(v string) (armapplicationinsights.StorageType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armapplicationinsights.StorageType(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, storageTypeParam, 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).ComponentLinkedStorageAccounts, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ComponentLinkedStorageAccountsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.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\.insights/components/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/linkedStorageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.ComponentLinkedStorageAccountsPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + storageTypeParam, err := parseWithCast(matches[regex.SubexpIndex("storageType")], func(v string) (armapplicationinsights.StorageType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armapplicationinsights.StorageType(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, storageTypeParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ComponentLinkedStorageAccounts, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentquotastatus_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentquotastatus_server.go index 462e79a68e8e..a4cc607b143d 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentquotastatus_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/componentquotastatus_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/components_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/components_server.go index b9b7d57ea0e7..538ea888510e 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/components_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/components_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/deletedworkbooks_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/deletedworkbooks_server.go new file mode 100644 index 000000000000..099969cc5902 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/deletedworkbooks_server.go @@ -0,0 +1,122 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// DeletedWorkbooksServer is a fake server for instances of the armapplicationinsights.DeletedWorkbooksClient type. +type DeletedWorkbooksServer struct { + // NewListBySubscriptionPager is the fake for method DeletedWorkbooksClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armapplicationinsights.DeletedWorkbooksClientListBySubscriptionOptions) (resp azfake.PagerResponder[armapplicationinsights.DeletedWorkbooksClientListBySubscriptionResponse]) +} + +// NewDeletedWorkbooksServerTransport creates a new instance of DeletedWorkbooksServerTransport with the provided implementation. +// The returned DeletedWorkbooksServerTransport instance is connected to an instance of armapplicationinsights.DeletedWorkbooksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeletedWorkbooksServerTransport(srv *DeletedWorkbooksServer) *DeletedWorkbooksServerTransport { + return &DeletedWorkbooksServerTransport{ + srv: srv, + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armapplicationinsights.DeletedWorkbooksClientListBySubscriptionResponse]](), + } +} + +// DeletedWorkbooksServerTransport connects instances of armapplicationinsights.DeletedWorkbooksClient to instances of DeletedWorkbooksServer. +// Don't use this type directly, use NewDeletedWorkbooksServerTransport instead. +type DeletedWorkbooksServerTransport struct { + srv *DeletedWorkbooksServer + newListBySubscriptionPager *tracker[azfake.PagerResponder[armapplicationinsights.DeletedWorkbooksClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for DeletedWorkbooksServerTransport. +func (d *DeletedWorkbooksServerTransport) 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 "DeletedWorkbooksClient.NewListBySubscriptionPager": + resp, err = d.dispatchNewListBySubscriptionPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DeletedWorkbooksServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/deletedWorkbooks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + categoryUnescaped, err := url.QueryUnescape(qp.Get("category")) + if err != nil { + return nil, err + } + categoryParam := getOptional(armapplicationinsights.CategoryType(categoryUnescaped)) + tagsUnescaped, err := url.QueryUnescape(qp.Get("tags")) + if err != nil { + return nil, err + } + tagsParam := splitHelper(tagsUnescaped, ",") + var options *armapplicationinsights.DeletedWorkbooksClientListBySubscriptionOptions + if categoryParam != nil || len(tagsParam) > 0 { + options = &armapplicationinsights.DeletedWorkbooksClientListBySubscriptionOptions{ + Category: categoryParam, + Tags: tagsParam, + } + } + resp := d.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armapplicationinsights.DeletedWorkbooksClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + d.newListBySubscriptionPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/exportconfigurations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/exportconfigurations_server.go index 7350c193de1d..72acf93fc48a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/exportconfigurations_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/exportconfigurations_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/favorites_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/favorites_server.go index 1868d6f578aa..203c20fe27ea 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/favorites_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/favorites_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/livetoken_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/livetoken_server.go new file mode 100644 index 000000000000..3b8205ae5a4f --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/livetoken_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// LiveTokenServer is a fake server for instances of the armapplicationinsights.LiveTokenClient type. +type LiveTokenServer struct { + // Get is the fake for method LiveTokenClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, options *armapplicationinsights.LiveTokenClientGetOptions) (resp azfake.Responder[armapplicationinsights.LiveTokenClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewLiveTokenServerTransport creates a new instance of LiveTokenServerTransport with the provided implementation. +// The returned LiveTokenServerTransport instance is connected to an instance of armapplicationinsights.LiveTokenClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLiveTokenServerTransport(srv *LiveTokenServer) *LiveTokenServerTransport { + return &LiveTokenServerTransport{srv: srv} +} + +// LiveTokenServerTransport connects instances of armapplicationinsights.LiveTokenClient to instances of LiveTokenServer. +// Don't use this type directly, use NewLiveTokenServerTransport instead. +type LiveTokenServerTransport struct { + srv *LiveTokenServer +} + +// Do implements the policy.Transporter interface for LiveTokenServerTransport. +func (l *LiveTokenServerTransport) 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 "LiveTokenClient.Get": + resp, err = l.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (l *LiveTokenServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/generatelivetoken` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceURIParam, 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).LiveTokenResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/myworkbooks_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/myworkbooks_server.go deleted file mode 100644 index 5ad3a447375f..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/myworkbooks_server.go +++ /dev/null @@ -1,370 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" - "net/http" - "net/url" - "regexp" - "strconv" -) - -// MyWorkbooksServer is a fake server for instances of the armapplicationinsights.MyWorkbooksClient type. -type MyWorkbooksServer struct { - // CreateOrUpdate is the fake for method MyWorkbooksClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties armapplicationinsights.MyWorkbook, options *armapplicationinsights.MyWorkbooksClientCreateOrUpdateOptions) (resp azfake.Responder[armapplicationinsights.MyWorkbooksClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method MyWorkbooksClient.Delete - // HTTP status codes to indicate success: http.StatusCreated, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.MyWorkbooksClientDeleteOptions) (resp azfake.Responder[armapplicationinsights.MyWorkbooksClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method MyWorkbooksClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.MyWorkbooksClientGetOptions) (resp azfake.Responder[armapplicationinsights.MyWorkbooksClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method MyWorkbooksClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, category armapplicationinsights.CategoryType, options *armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions) (resp azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method MyWorkbooksClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(category armapplicationinsights.CategoryType, options *armapplicationinsights.MyWorkbooksClientListBySubscriptionOptions) (resp azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListBySubscriptionResponse]) - - // Update is the fake for method MyWorkbooksClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties armapplicationinsights.MyWorkbook, options *armapplicationinsights.MyWorkbooksClientUpdateOptions) (resp azfake.Responder[armapplicationinsights.MyWorkbooksClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewMyWorkbooksServerTransport creates a new instance of MyWorkbooksServerTransport with the provided implementation. -// The returned MyWorkbooksServerTransport instance is connected to an instance of armapplicationinsights.MyWorkbooksClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMyWorkbooksServerTransport(srv *MyWorkbooksServer) *MyWorkbooksServerTransport { - return &MyWorkbooksServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListBySubscriptionResponse]](), - } -} - -// MyWorkbooksServerTransport connects instances of armapplicationinsights.MyWorkbooksClient to instances of MyWorkbooksServer. -// Don't use this type directly, use NewMyWorkbooksServerTransport instead. -type MyWorkbooksServerTransport struct { - srv *MyWorkbooksServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armapplicationinsights.MyWorkbooksClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for MyWorkbooksServerTransport. -func (m *MyWorkbooksServerTransport) 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 "MyWorkbooksClient.CreateOrUpdate": - resp, err = m.dispatchCreateOrUpdate(req) - case "MyWorkbooksClient.Delete": - resp, err = m.dispatchDelete(req) - case "MyWorkbooksClient.Get": - resp, err = m.dispatchGet(req) - case "MyWorkbooksClient.NewListByResourceGroupPager": - resp, err = m.dispatchNewListByResourceGroupPager(req) - case "MyWorkbooksClient.NewListBySubscriptionPager": - resp, err = m.dispatchNewListBySubscriptionPager(req) - case "MyWorkbooksClient.Update": - resp, err = m.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MyWorkbooksServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if m.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/myWorkbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.MyWorkbook](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MyWorkbook, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MyWorkbooksServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if m.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/myWorkbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, resourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusCreated, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MyWorkbooksServerTransport) 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\.Insights/myWorkbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, 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).MyWorkbook, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MyWorkbooksServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/myWorkbooks` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - categoryParam, err := parseWithCast(qp.Get("category"), func(v string) (armapplicationinsights.CategoryType, error) { - p, unescapeErr := url.QueryUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armapplicationinsights.CategoryType(p), nil - }) - if err != nil { - return nil, err - } - tagsUnescaped, err := url.QueryUnescape(qp.Get("tags")) - if err != nil { - return nil, err - } - tagsParam := splitHelper(tagsUnescaped, ",") - canFetchContentUnescaped, err := url.QueryUnescape(qp.Get("canFetchContent")) - if err != nil { - return nil, err - } - canFetchContentParam, err := parseOptional(canFetchContentUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions - if len(tagsParam) > 0 || canFetchContentParam != nil { - options = &armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions{ - Tags: tagsParam, - CanFetchContent: canFetchContentParam, - } - } - resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, categoryParam, options) - newListByResourceGroupPager = &resp - m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - m.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (m *MyWorkbooksServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := m.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/myWorkbooks` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - categoryParam, err := parseWithCast(qp.Get("category"), func(v string) (armapplicationinsights.CategoryType, error) { - p, unescapeErr := url.QueryUnescape(v) - if unescapeErr != nil { - return "", unescapeErr - } - return armapplicationinsights.CategoryType(p), nil - }) - if err != nil { - return nil, err - } - tagsUnescaped, err := url.QueryUnescape(qp.Get("tags")) - if err != nil { - return nil, err - } - tagsParam := splitHelper(tagsUnescaped, ",") - canFetchContentUnescaped, err := url.QueryUnescape(qp.Get("canFetchContent")) - if err != nil { - return nil, err - } - canFetchContentParam, err := parseOptional(canFetchContentUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armapplicationinsights.MyWorkbooksClientListBySubscriptionOptions - if len(tagsParam) > 0 || canFetchContentParam != nil { - options = &armapplicationinsights.MyWorkbooksClientListBySubscriptionOptions{ - Tags: tagsParam, - CanFetchContent: canFetchContentParam, - } - } - resp := m.srv.NewListBySubscriptionPager(categoryParam, options) - newListBySubscriptionPager = &resp - m.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - m.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (m *MyWorkbooksServerTransport) 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\.Insights/myWorkbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.MyWorkbook](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MyWorkbook, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/operations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/operations_server.go new file mode 100644 index 000000000000..c53b435c9fa8 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/operations_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" + "net/http" +) + +// OperationsServer is a fake server for instances of the armapplicationinsights.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armapplicationinsights.OperationsClientListOptions) (resp azfake.PagerResponder[armapplicationinsights.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armapplicationinsights.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armapplicationinsights.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armapplicationinsights.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armapplicationinsights.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armapplicationinsights.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/proactivedetectionconfigurations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/proactivedetectionconfigurations_server.go index db8da76a60cd..1a1f0f082e63 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/proactivedetectionconfigurations_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/proactivedetectionconfigurations_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/server_factory.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/server_factory.go index b7f3093de9fb..9a6b9659fb72 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/server_factory.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/server_factory.go @@ -25,15 +25,19 @@ type ServerFactory struct { ComponentAvailableFeaturesServer ComponentAvailableFeaturesServer ComponentCurrentBillingFeaturesServer ComponentCurrentBillingFeaturesServer ComponentFeatureCapabilitiesServer ComponentFeatureCapabilitiesServer + ComponentLinkedStorageAccountsServer ComponentLinkedStorageAccountsServer ComponentQuotaStatusServer ComponentQuotaStatusServer ComponentsServer ComponentsServer + DeletedWorkbooksServer DeletedWorkbooksServer ExportConfigurationsServer ExportConfigurationsServer FavoritesServer FavoritesServer - MyWorkbooksServer MyWorkbooksServer + LiveTokenServer LiveTokenServer + OperationsServer OperationsServer ProactiveDetectionConfigurationsServer ProactiveDetectionConfigurationsServer WebTestLocationsServer WebTestLocationsServer WebTestsServer WebTestsServer WorkItemConfigurationsServer WorkItemConfigurationsServer + WorkbookTemplatesServer WorkbookTemplatesServer WorkbooksServer WorkbooksServer } @@ -57,15 +61,19 @@ type ServerFactoryTransport struct { trComponentAvailableFeaturesServer *ComponentAvailableFeaturesServerTransport trComponentCurrentBillingFeaturesServer *ComponentCurrentBillingFeaturesServerTransport trComponentFeatureCapabilitiesServer *ComponentFeatureCapabilitiesServerTransport + trComponentLinkedStorageAccountsServer *ComponentLinkedStorageAccountsServerTransport trComponentQuotaStatusServer *ComponentQuotaStatusServerTransport trComponentsServer *ComponentsServerTransport + trDeletedWorkbooksServer *DeletedWorkbooksServerTransport trExportConfigurationsServer *ExportConfigurationsServerTransport trFavoritesServer *FavoritesServerTransport - trMyWorkbooksServer *MyWorkbooksServerTransport + trLiveTokenServer *LiveTokenServerTransport + trOperationsServer *OperationsServerTransport trProactiveDetectionConfigurationsServer *ProactiveDetectionConfigurationsServerTransport trWebTestLocationsServer *WebTestLocationsServerTransport trWebTestsServer *WebTestsServerTransport trWorkItemConfigurationsServer *WorkItemConfigurationsServerTransport + trWorkbookTemplatesServer *WorkbookTemplatesServerTransport trWorkbooksServer *WorkbooksServerTransport } @@ -108,6 +116,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewComponentFeatureCapabilitiesServerTransport(&s.srv.ComponentFeatureCapabilitiesServer) }) resp, err = s.trComponentFeatureCapabilitiesServer.Do(req) + case "ComponentLinkedStorageAccountsClient": + initServer(s, &s.trComponentLinkedStorageAccountsServer, func() *ComponentLinkedStorageAccountsServerTransport { + return NewComponentLinkedStorageAccountsServerTransport(&s.srv.ComponentLinkedStorageAccountsServer) + }) + resp, err = s.trComponentLinkedStorageAccountsServer.Do(req) case "ComponentQuotaStatusClient": initServer(s, &s.trComponentQuotaStatusServer, func() *ComponentQuotaStatusServerTransport { return NewComponentQuotaStatusServerTransport(&s.srv.ComponentQuotaStatusServer) @@ -116,6 +129,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ComponentsClient": initServer(s, &s.trComponentsServer, func() *ComponentsServerTransport { return NewComponentsServerTransport(&s.srv.ComponentsServer) }) resp, err = s.trComponentsServer.Do(req) + case "DeletedWorkbooksClient": + initServer(s, &s.trDeletedWorkbooksServer, func() *DeletedWorkbooksServerTransport { + return NewDeletedWorkbooksServerTransport(&s.srv.DeletedWorkbooksServer) + }) + resp, err = s.trDeletedWorkbooksServer.Do(req) case "ExportConfigurationsClient": initServer(s, &s.trExportConfigurationsServer, func() *ExportConfigurationsServerTransport { return NewExportConfigurationsServerTransport(&s.srv.ExportConfigurationsServer) @@ -124,9 +142,12 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "FavoritesClient": initServer(s, &s.trFavoritesServer, func() *FavoritesServerTransport { return NewFavoritesServerTransport(&s.srv.FavoritesServer) }) resp, err = s.trFavoritesServer.Do(req) - case "MyWorkbooksClient": - initServer(s, &s.trMyWorkbooksServer, func() *MyWorkbooksServerTransport { return NewMyWorkbooksServerTransport(&s.srv.MyWorkbooksServer) }) - resp, err = s.trMyWorkbooksServer.Do(req) + case "LiveTokenClient": + initServer(s, &s.trLiveTokenServer, func() *LiveTokenServerTransport { return NewLiveTokenServerTransport(&s.srv.LiveTokenServer) }) + resp, err = s.trLiveTokenServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) case "ProactiveDetectionConfigurationsClient": initServer(s, &s.trProactiveDetectionConfigurationsServer, func() *ProactiveDetectionConfigurationsServerTransport { return NewProactiveDetectionConfigurationsServerTransport(&s.srv.ProactiveDetectionConfigurationsServer) @@ -145,6 +166,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewWorkItemConfigurationsServerTransport(&s.srv.WorkItemConfigurationsServer) }) resp, err = s.trWorkItemConfigurationsServer.Do(req) + case "WorkbookTemplatesClient": + initServer(s, &s.trWorkbookTemplatesServer, func() *WorkbookTemplatesServerTransport { + return NewWorkbookTemplatesServerTransport(&s.srv.WorkbookTemplatesServer) + }) + resp, err = s.trWorkbookTemplatesServer.Do(req) case "WorkbooksClient": initServer(s, &s.trWorkbooksServer, func() *WorkbooksServerTransport { return NewWorkbooksServerTransport(&s.srv.WorkbooksServer) }) resp, err = s.trWorkbooksServer.Do(req) diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/time_rfc3339.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/time_rfc3339.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtestlocations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtestlocations_server.go index 6d07755f7807..b639f1f558a9 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtestlocations_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtestlocations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtests_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtests_server.go index 91575d480885..ec8f44520547 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtests_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/webtests_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooks_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooks_server.go index 26b3e9b3037a..01335afa7a27 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooks_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooks_server.go @@ -15,9 +15,11 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" + "reflect" "regexp" "strconv" ) @@ -29,7 +31,7 @@ type WorkbooksServer struct { CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties armapplicationinsights.Workbook, options *armapplicationinsights.WorkbooksClientCreateOrUpdateOptions) (resp azfake.Responder[armapplicationinsights.WorkbooksClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method WorkbooksClient.Delete - // HTTP status codes to indicate success: http.StatusCreated, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent Delete func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbooksClientDeleteOptions) (resp azfake.Responder[armapplicationinsights.WorkbooksClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method WorkbooksClient.Get @@ -40,9 +42,21 @@ type WorkbooksServer struct { // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, category armapplicationinsights.CategoryType, options *armapplicationinsights.WorkbooksClientListByResourceGroupOptions) (resp azfake.PagerResponder[armapplicationinsights.WorkbooksClientListByResourceGroupResponse]) - // Update is the fake for method WorkbooksClient.Update + // NewListBySubscriptionPager is the fake for method WorkbooksClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(category armapplicationinsights.CategoryType, options *armapplicationinsights.WorkbooksClientListBySubscriptionOptions) (resp azfake.PagerResponder[armapplicationinsights.WorkbooksClientListBySubscriptionResponse]) + + // RevisionGet is the fake for method WorkbooksClient.RevisionGet + // HTTP status codes to indicate success: http.StatusOK + RevisionGet func(ctx context.Context, resourceGroupName string, resourceName string, revisionID string, options *armapplicationinsights.WorkbooksClientRevisionGetOptions) (resp azfake.Responder[armapplicationinsights.WorkbooksClientRevisionGetResponse], errResp azfake.ErrorResponder) + + // NewRevisionsListPager is the fake for method WorkbooksClient.NewRevisionsListPager // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties armapplicationinsights.Workbook, options *armapplicationinsights.WorkbooksClientUpdateOptions) (resp azfake.Responder[armapplicationinsights.WorkbooksClientUpdateResponse], errResp azfake.ErrorResponder) + NewRevisionsListPager func(resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbooksClientRevisionsListOptions) (resp azfake.PagerResponder[armapplicationinsights.WorkbooksClientRevisionsListResponse]) + + // Update is the fake for method WorkbooksClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbooksClientUpdateOptions) (resp azfake.Responder[armapplicationinsights.WorkbooksClientUpdateResponse], errResp azfake.ErrorResponder) } // NewWorkbooksServerTransport creates a new instance of WorkbooksServerTransport with the provided implementation. @@ -52,6 +66,8 @@ func NewWorkbooksServerTransport(srv *WorkbooksServer) *WorkbooksServerTransport return &WorkbooksServerTransport{ srv: srv, newListByResourceGroupPager: newTracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientListBySubscriptionResponse]](), + newRevisionsListPager: newTracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientRevisionsListResponse]](), } } @@ -60,6 +76,8 @@ func NewWorkbooksServerTransport(srv *WorkbooksServer) *WorkbooksServerTransport type WorkbooksServerTransport struct { srv *WorkbooksServer newListByResourceGroupPager *tracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientListBySubscriptionResponse]] + newRevisionsListPager *tracker[azfake.PagerResponder[armapplicationinsights.WorkbooksClientRevisionsListResponse]] } // Do implements the policy.Transporter interface for WorkbooksServerTransport. @@ -82,6 +100,12 @@ func (w *WorkbooksServerTransport) Do(req *http.Request) (*http.Response, error) resp, err = w.dispatchGet(req) case "WorkbooksClient.NewListByResourceGroupPager": resp, err = w.dispatchNewListByResourceGroupPager(req) + case "WorkbooksClient.NewListBySubscriptionPager": + resp, err = w.dispatchNewListBySubscriptionPager(req) + case "WorkbooksClient.RevisionGet": + resp, err = w.dispatchRevisionGet(req) + case "WorkbooksClient.NewRevisionsListPager": + resp, err = w.dispatchNewRevisionsListPager(req) case "WorkbooksClient.Update": resp, err = w.dispatchUpdate(req) default: @@ -99,12 +123,13 @@ func (w *WorkbooksServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h if w.srv.CreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.Workbook](req) if err != nil { return nil, err @@ -117,7 +142,18 @@ func (w *WorkbooksServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h if err != nil { return nil, err } - respr, errRespr := w.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, body, nil) + sourceIDUnescaped, err := url.QueryUnescape(qp.Get("sourceId")) + if err != nil { + return nil, err + } + sourceIDParam := getOptional(sourceIDUnescaped) + var options *armapplicationinsights.WorkbooksClientCreateOrUpdateOptions + if sourceIDParam != nil { + options = &armapplicationinsights.WorkbooksClientCreateOrUpdateOptions{ + SourceID: sourceIDParam, + } + } + respr, errRespr := w.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -136,7 +172,7 @@ func (w *WorkbooksServerTransport) dispatchDelete(req *http.Request) (*http.Resp if w.srv.Delete == nil { return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -155,8 +191,8 @@ func (w *WorkbooksServerTransport) dispatchDelete(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusCreated, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated, http.StatusNoContent", respContent.HTTPStatus)} + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) if err != nil { @@ -169,12 +205,13 @@ func (w *WorkbooksServerTransport) dispatchGet(req *http.Request) (*http.Respons if w.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\.insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err @@ -183,7 +220,21 @@ func (w *WorkbooksServerTransport) dispatchGet(req *http.Request) (*http.Respons if err != nil { return nil, err } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, nil) + canFetchContentUnescaped, err := url.QueryUnescape(qp.Get("canFetchContent")) + if err != nil { + return nil, err + } + canFetchContentParam, err := parseOptional(canFetchContentUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armapplicationinsights.WorkbooksClientGetOptions + if canFetchContentParam != nil { + options = &armapplicationinsights.WorkbooksClientGetOptions{ + CanFetchContent: canFetchContentParam, + } + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -204,7 +255,7 @@ func (w *WorkbooksServerTransport) dispatchNewListByResourceGroupPager(req *http } newListByResourceGroupPager := w.newListByResourceGroupPager.get(req) if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/workbooks` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 2 { @@ -230,6 +281,11 @@ func (w *WorkbooksServerTransport) dispatchNewListByResourceGroupPager(req *http return nil, err } tagsParam := splitHelper(tagsUnescaped, ",") + sourceIDUnescaped, err := url.QueryUnescape(qp.Get("sourceId")) + if err != nil { + return nil, err + } + sourceIDParam := getOptional(sourceIDUnescaped) canFetchContentUnescaped, err := url.QueryUnescape(qp.Get("canFetchContent")) if err != nil { return nil, err @@ -239,15 +295,19 @@ func (w *WorkbooksServerTransport) dispatchNewListByResourceGroupPager(req *http return nil, err } var options *armapplicationinsights.WorkbooksClientListByResourceGroupOptions - if len(tagsParam) > 0 || canFetchContentParam != nil { + if len(tagsParam) > 0 || sourceIDParam != nil || canFetchContentParam != nil { options = &armapplicationinsights.WorkbooksClientListByResourceGroupOptions{ Tags: tagsParam, + SourceID: sourceIDParam, CanFetchContent: canFetchContentParam, } } resp := w.srv.NewListByResourceGroupPager(resourceGroupNameParam, categoryParam, options) newListByResourceGroupPager = &resp w.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armapplicationinsights.WorkbooksClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) if err != nil { @@ -263,17 +323,160 @@ func (w *WorkbooksServerTransport) dispatchNewListByResourceGroupPager(req *http return resp, nil } +func (w *WorkbooksServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if w.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := w.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + categoryParam, err := parseWithCast(qp.Get("category"), func(v string) (armapplicationinsights.CategoryType, error) { + p, unescapeErr := url.QueryUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armapplicationinsights.CategoryType(p), nil + }) + if err != nil { + return nil, err + } + tagsUnescaped, err := url.QueryUnescape(qp.Get("tags")) + if err != nil { + return nil, err + } + tagsParam := splitHelper(tagsUnescaped, ",") + canFetchContentUnescaped, err := url.QueryUnescape(qp.Get("canFetchContent")) + if err != nil { + return nil, err + } + canFetchContentParam, err := parseOptional(canFetchContentUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armapplicationinsights.WorkbooksClientListBySubscriptionOptions + if len(tagsParam) > 0 || canFetchContentParam != nil { + options = &armapplicationinsights.WorkbooksClientListBySubscriptionOptions{ + Tags: tagsParam, + CanFetchContent: canFetchContentParam, + } + } + resp := w.srv.NewListBySubscriptionPager(categoryParam, options) + newListBySubscriptionPager = &resp + w.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armapplicationinsights.WorkbooksClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + w.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (w *WorkbooksServerTransport) dispatchRevisionGet(req *http.Request) (*http.Response, error) { + if w.srv.RevisionGet == nil { + return nil, &nonRetriableError{errors.New("fake for method RevisionGet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revisions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + revisionIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("revisionId")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.RevisionGet(req.Context(), resourceGroupNameParam, resourceNameParam, revisionIDParam, 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).Workbook, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WorkbooksServerTransport) dispatchNewRevisionsListPager(req *http.Request) (*http.Response, error) { + if w.srv.NewRevisionsListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewRevisionsListPager not implemented")} + } + newRevisionsListPager := w.newRevisionsListPager.get(req) + if newRevisionsListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revisions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := w.srv.NewRevisionsListPager(resourceGroupNameParam, resourceNameParam, nil) + newRevisionsListPager = &resp + w.newRevisionsListPager.add(req, newRevisionsListPager) + server.PagerResponderInjectNextLinks(newRevisionsListPager, req, func(page *armapplicationinsights.WorkbooksClientRevisionsListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newRevisionsListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newRevisionsListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newRevisionsListPager) { + w.newRevisionsListPager.remove(req) + } + return resp, nil +} + func (w *WorkbooksServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if w.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\.insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.Workbook](req) + qp := req.URL.Query() + body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.WorkbookUpdateParameters](req) if err != nil { return nil, err } @@ -285,13 +488,25 @@ func (w *WorkbooksServerTransport) dispatchUpdate(req *http.Request) (*http.Resp if err != nil { return nil, err } - respr, errRespr := w.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, body, nil) + sourceIDUnescaped, err := url.QueryUnescape(qp.Get("sourceId")) + if err != nil { + return nil, err + } + sourceIDParam := getOptional(sourceIDUnescaped) + var options *armapplicationinsights.WorkbooksClientUpdateOptions + if sourceIDParam != nil || !reflect.ValueOf(body).IsZero() { + options = &armapplicationinsights.WorkbooksClientUpdateOptions{ + SourceID: sourceIDParam, + WorkbookUpdateParameters: &body, + } + } + respr, errRespr := w.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Workbook, req) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooktemplates_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooktemplates_server.go new file mode 100644 index 000000000000..89e2309e5231 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workbooktemplates_server.go @@ -0,0 +1,276 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// WorkbookTemplatesServer is a fake server for instances of the armapplicationinsights.WorkbookTemplatesClient type. +type WorkbookTemplatesServer struct { + // CreateOrUpdate is the fake for method WorkbookTemplatesClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties armapplicationinsights.WorkbookTemplate, options *armapplicationinsights.WorkbookTemplatesClientCreateOrUpdateOptions) (resp azfake.Responder[armapplicationinsights.WorkbookTemplatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method WorkbookTemplatesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbookTemplatesClientDeleteOptions) (resp azfake.Responder[armapplicationinsights.WorkbookTemplatesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method WorkbookTemplatesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbookTemplatesClientGetOptions) (resp azfake.Responder[armapplicationinsights.WorkbookTemplatesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method WorkbookTemplatesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armapplicationinsights.WorkbookTemplatesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armapplicationinsights.WorkbookTemplatesClientListByResourceGroupResponse]) + + // Update is the fake for method WorkbookTemplatesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, resourceName string, options *armapplicationinsights.WorkbookTemplatesClientUpdateOptions) (resp azfake.Responder[armapplicationinsights.WorkbookTemplatesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewWorkbookTemplatesServerTransport creates a new instance of WorkbookTemplatesServerTransport with the provided implementation. +// The returned WorkbookTemplatesServerTransport instance is connected to an instance of armapplicationinsights.WorkbookTemplatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWorkbookTemplatesServerTransport(srv *WorkbookTemplatesServer) *WorkbookTemplatesServerTransport { + return &WorkbookTemplatesServerTransport{ + srv: srv, + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armapplicationinsights.WorkbookTemplatesClientListByResourceGroupResponse]](), + } +} + +// WorkbookTemplatesServerTransport connects instances of armapplicationinsights.WorkbookTemplatesClient to instances of WorkbookTemplatesServer. +// Don't use this type directly, use NewWorkbookTemplatesServerTransport instead. +type WorkbookTemplatesServerTransport struct { + srv *WorkbookTemplatesServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armapplicationinsights.WorkbookTemplatesClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for WorkbookTemplatesServerTransport. +func (w *WorkbookTemplatesServerTransport) 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 "WorkbookTemplatesClient.CreateOrUpdate": + resp, err = w.dispatchCreateOrUpdate(req) + case "WorkbookTemplatesClient.Delete": + resp, err = w.dispatchDelete(req) + case "WorkbookTemplatesClient.Get": + resp, err = w.dispatchGet(req) + case "WorkbookTemplatesClient.NewListByResourceGroupPager": + resp, err = w.dispatchNewListByResourceGroupPager(req) + case "WorkbookTemplatesClient.Update": + resp, err = w.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (w *WorkbookTemplatesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if w.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooktemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.WorkbookTemplate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkbookTemplate, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WorkbookTemplatesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if w.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooktemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Delete(req.Context(), resourceGroupNameParam, resourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WorkbookTemplatesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.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\.Insights/workbooktemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, 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).WorkbookTemplate, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WorkbookTemplatesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := w.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/workbooktemplates` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := w.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + w.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + w.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (w *WorkbookTemplatesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if w.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\.Insights/workbooktemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armapplicationinsights.WorkbookTemplateUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + var options *armapplicationinsights.WorkbookTemplatesClientUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armapplicationinsights.WorkbookTemplatesClientUpdateOptions{ + WorkbookTemplateUpdateParameters: &body, + } + } + respr, errRespr := w.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkbookTemplate, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workitemconfigurations_server.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workitemconfigurations_server.go index b22c5068913a..955a0f2b39c0 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workitemconfigurations_server.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/fake/workitemconfigurations_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go index ae7ce20c914e..de24274f3544 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go @@ -295,15 +295,15 @@ func (client *FavoritesClient) listCreateRequest(ctx context.Context, resourceGr } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2015-05-01") + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } if options != nil && options.FavoriteType != nil { reqQP.Set("favoriteType", string(*options.FavoriteType)) } if options != nil && options.SourceType != nil { reqQP.Set("sourceType", string(*options.SourceType)) } - if options != nil && options.CanFetchContent != nil { - reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) - } if options != nil && options.Tags != nil { reqQP.Set("tags", strings.Join(options.Tags, ",")) } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go index 868b06414a08..ce42b3ee9a25 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoritesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoritesList.json func ExampleFavoritesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -66,7 +66,7 @@ func ExampleFavoritesClient_List() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteGet.json func ExampleFavoritesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExampleFavoritesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteAdd.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteAdd.json func ExampleFavoritesClient_Add() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExampleFavoritesClient_Add() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteUpdate.json func ExampleFavoritesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -187,7 +187,7 @@ func ExampleFavoritesClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteDelete.json func ExampleFavoritesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod index 1d26e9e5bcc1..6ea5001cd198 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2 go 1.18 diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go new file mode 100644 index 000000000000..7a09b60f598f --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go @@ -0,0 +1,91 @@ +//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 armapplicationinsights + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// LiveTokenClient contains the methods for the LiveToken group. +// Don't use this type directly, use NewLiveTokenClient() instead. +type LiveTokenClient struct { + internal *arm.Client +} + +// NewLiveTokenClient creates a new instance of LiveTokenClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLiveTokenClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LiveTokenClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LiveTokenClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets an access token for live metrics stream data. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-14 +// - resourceURI - The identifier of the resource. +// - options - LiveTokenClientGetOptions contains the optional parameters for the LiveTokenClient.Get method. +func (client *LiveTokenClient) Get(ctx context.Context, resourceURI string, options *LiveTokenClientGetOptions) (LiveTokenClientGetResponse, error) { + var err error + const operationName = "LiveTokenClient.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, resourceURI, options) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LiveTokenClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LiveTokenClient) getCreateRequest(ctx context.Context, resourceURI string, options *LiveTokenClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.Insights/generatelivetoken" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-14") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LiveTokenClient) getHandleResponse(resp *http.Response) (LiveTokenClientGetResponse, error) { + result := LiveTokenClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveTokenResponse); err != nil { + return LiveTokenClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client_example_test.go new file mode 100644 index 000000000000..537a1ecac10e --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client_example_test.go @@ -0,0 +1,41 @@ +//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 armapplicationinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-10-14/examples/LiveTokenGet.json +func ExampleLiveTokenClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLiveTokenClient().Get(ctx, "subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/FabrikamFiberApp/providers/microsoft.insights/components/CustomAvailabilityTest/providers/microsoft.insights/generatelivetoken", 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.LiveTokenResponse = armapplicationinsights.LiveTokenResponse{ + // LiveToken: to.Ptr("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"), + // } +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go index a4d647907e95..8ffd2cf0d837 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go @@ -431,6 +431,27 @@ type ComponentFeatureCapability struct { Value *string } +// ComponentLinkedStorageAccounts - An Application Insights component linked storage accounts +type ComponentLinkedStorageAccounts struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ComponentLinkedStorageAccountsPatch - An Application Insights component linked storage accounts patch +type ComponentLinkedStorageAccountsPatch struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties +} + // ComponentListResult - Describes the list of Application Insights Resources. type ComponentListResult struct { // REQUIRED; List of Application Insights component definitions. @@ -653,6 +674,131 @@ type ComponentsResource struct { Type *string } +// DeletedWorkbook - A workbook definition. +type DeletedWorkbook struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource etag + Etag *string + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Metadata describing a workbook for an Azure resource. + Properties *DeletedWorkbookProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DeletedWorkbookError - Error response. +type DeletedWorkbookError struct { + // The error details. + Error *DeletedWorkbookErrorDefinition +} + +// DeletedWorkbookErrorDefinition - Error definition. +type DeletedWorkbookErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string + + // READ-ONLY; Internal error details. + Innererror *DeletedWorkbookInnerErrorTrace + + // READ-ONLY; Description of the error. + Message *string +} + +// DeletedWorkbookInnerErrorTrace - Error details +type DeletedWorkbookInnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string +} + +// DeletedWorkbookProperties - Properties that contain a workbook. +type DeletedWorkbookProperties struct { + // REQUIRED; Workbook category, as defined by the user at creation time. + Category *string + + // REQUIRED; The user-defined name (display name) of the workbook. + DisplayName *string + + // REQUIRED; Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string + + // The description of the workbook. + Description *string + + // ResourceId for a source resource. + SourceID *string + + // The resourceId to the storage account when bring your own storage is used + StorageURI *string + + // Being deprecated, please use the other tags field + Tags []*string + + // Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData + Version *string + + // READ-ONLY; The unique revision id for this workbook definition + Revision *string + + // READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. + TimeModified *time.Time + + // READ-ONLY; Unique user id of the specific user that owns this workbook. + UserID *string +} + +// DeletedWorkbookResource - An azure resource object +type DeletedWorkbookResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource etag + Etag *string + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DeletedWorkbooksListResult - Workbook list result. +type DeletedWorkbooksListResult struct { + NextLink *string + + // READ-ONLY; An array of workbooks. + Value []*DeletedWorkbook +} + // ErrorFieldContract - Error Field contract. type ErrorFieldContract struct { // Property level error code. @@ -671,6 +817,9 @@ type ErrorResponse struct { // Error code. Code *string + // The list of invalid fields send in request, in case of validation error. + Details []*ErrorFieldContract + // Error message indicating why the operation failed. Message *string } @@ -691,115 +840,73 @@ type ErrorResponseComponentsError struct { Message *string } -// InnerError - Inner error -type InnerError struct { - // Provides correlation for request - Diagnosticcontext *string - - // Request time - Time *time.Time -} - -// LinkProperties - Contains a sourceId and workbook resource id to link two resources. -type LinkProperties struct { - // The category of workbook - Category *string - - // The source Azure resource id - SourceID *string - - // The workbook Azure resource id - TargetID *string -} - -// MyWorkbook - An Application Insights private workbook definition. -type MyWorkbook struct { - // Azure resource Id - ID *string - - // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind - - // Resource location - Location *string - - // Azure resource name - Name *string - - // Metadata describing a workbook for an Azure resource. - Properties *MyWorkbookProperties - - // Resource tags - Tags map[string]*string - - // Azure resource type - Type *string +type ErrorResponseLinkedStorage struct { + // Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error + // message. + Error *ErrorResponseLinkedStorageError } -// MyWorkbookError - Error message body that will indicate why the operation failed. -type MyWorkbookError struct { - // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. +// ErrorResponseLinkedStorageError - Error response indicates Insights service is not able to process the incoming request. +// The reason is provided in the error message. +type ErrorResponseLinkedStorageError struct { + // READ-ONLY; Error code. Code *string - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract - - // Human-readable representation of the error. + // READ-ONLY; Error message indicating why the operation failed. Message *string } -// MyWorkbookProperties - Properties that contain a private workbook. -type MyWorkbookProperties struct { - // REQUIRED; Workbook category, as defined by the user at creation time. - Category *string - - // REQUIRED; The user-defined name of the private workbook. - DisplayName *string - - // REQUIRED; Configuration of this particular private workbook. Configuration data is a string containing valid JSON - SerializedData *string +// HeaderField - A header to add to the WebTest. +type HeaderField struct { + // The name of the header. + HeaderFieldName *string - // Optional resourceId for a source resource. - SourceID *string + // The value of the header. + HeaderFieldValue *string +} - // A list of 0 or more tags that are associated with this private workbook definition - Tags []*string +// InnerError - Inner error +type InnerError struct { + // Provides correlation for request + Diagnosticcontext *string - // This instance's version of the data model. This can change as new features are added that can be marked private workbook. - Version *string + // Request time + Time *time.Time +} - // READ-ONLY; Date and time in UTC of the last modification that was made to this private workbook definition. - TimeModified *string +// LinkedStorageAccountsProperties - An Application Insights component linked storage account +type LinkedStorageAccountsProperties struct { + // Linked storage account resource ID + LinkedStorageAccount *string +} - // READ-ONLY; Unique user id of the specific user that owns this private workbook. - UserID *string +// LiveTokenResponse - The response to a live token query. +type LiveTokenResponse struct { + // READ-ONLY; JWT token for accessing live metrics stream data. + LiveToken *string } -// MyWorkbookResource - An azure resource object -type MyWorkbookResource struct { - // Azure resource Id - ID *string +// 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). + Type *ManagedServiceIdentityType - // Resource location - Location *string + // 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. + UserAssignedIdentities map[string]*UserAssignedIdentity - // Azure resource name - Name *string + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string - // Resource tags - Tags map[string]*string - - // Azure resource type - Type *string -} - -// MyWorkbooksListResult - Workbook list result. -type MyWorkbooksListResult struct { - // READ-ONLY; An array of private workbooks. - Value []*MyWorkbook + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string } -// Operation - CDN REST API operation +// Operation - Azure Workbooks REST API operation type Operation struct { // The object that represents the operation. Display *OperationDisplay @@ -813,23 +920,65 @@ type OperationDisplay struct { // Operation type: Read, write, delete, etc. Operation *string - // Service provider: Microsoft.Cdn + // Service provider: Microsoft.Insights Provider *string // Resource on which the operation is performed: Profile, endpoint, etc. Resource *string } -// OperationListResult - Result of the request to list CDN operations. It contains a list of operations and a URL link to -// get the next set of results. +// OperationInfo - Information about an operation +type OperationInfo struct { + // Description of the operation + Description *string + + // Name of the operation + Operation *string + + // Name of the provider + Provider *string + + // Name of the resource type + Resource *string +} + +// OperationListResult - Result of the request to list Azure Workbooks operations. It contains a list of operations and a +// URL link to get the next set of results. type OperationListResult struct { // URL to get the next set of operation list results if there are any. NextLink *string - // List of CDN operations supported by the CDN resource provider. + // List of Workbook operations supported by the Microsoft.Insights resource provider. Value []*Operation } +// OperationLive - Represents an operation returned by the GetOperations request +type OperationLive struct { + // Display name of the operation + Display *OperationInfo + + // Indicates whether the operation is a data action + IsDataAction *bool + + // Name of the operation + Name *string + + // Origin of the operation + Origin *string + + // Properties of the operation + Properties any +} + +// OperationsListResult - Result of the List Operations operation +type OperationsListResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string + + // A collection of operations + Value []*OperationLive +} + // PrivateLinkScopedResource - The private link scope resource reference. type PrivateLinkScopedResource struct { // The full resource Id of the private link scope resource. @@ -839,18 +988,129 @@ type PrivateLinkScopedResource struct { ScopeID *string } +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ResourceAutoGenerated - Common fields that are returned in the response for all Azure Resource Manager resources +type ResourceAutoGenerated struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + // TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags on a WebTest instance. type TagsResource struct { // Resource tags Tags map[string]*string } -// WebTest - An Application Insights web test definition. +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TrackedResourceAutoGenerated - The resource model definition for an Azure Resource Manager tracked top level resource which +// has 'tags' and a 'location' +type TrackedResourceAutoGenerated struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// WebTest - An Application Insights WebTest definition. type WebTest struct { // REQUIRED; Resource location Location *string - // The kind of web test that this web test watches. Choices are ping and multistep. + // The kind of WebTest that this web test watches. Choices are ping, multistep and standard. Kind *WebTestKind // Metadata describing a web test for an Azure resource. @@ -869,19 +1129,19 @@ type WebTest struct { Type *string } -// WebTestGeolocation - Geo-physical location to run a web test from. You must specify one or more locations for the test -// to run from. +// WebTestGeolocation - Geo-physical location to run a WebTest from. You must specify one or more locations for the test to +// run from. type WebTestGeolocation struct { - // Location ID for the webtest to run from. + // Location ID for the WebTest to run from. Location *string } -// WebTestListResult - A list of 0 or more Application Insights web test definitions. +// WebTestListResult - A list of 0 or more Application Insights WebTest definitions. type WebTestListResult struct { - // REQUIRED; Set of Application Insights web test definitions. + // REQUIRED; Set of Application Insights WebTest definitions. Value []*WebTest - // The link to get the next part of the returned list of web tests, should the return set be too large for a single request. + // The link to get the next part of the returned list of WebTest, should the return set be too large for a single request. // May be null. NextLink *string } @@ -900,7 +1160,7 @@ type WebTestProperties struct { // REQUIRED; Unique ID of this WebTest. This is typically the same value as the Name field. SyntheticMonitorID *string - // REQUIRED; The kind of web test this is, valid choices are ping and multistep. + // REQUIRED; The kind of web test this is, valid choices are ping, multistep and standard. WebTestKind *WebTestKind // REQUIRED; User defined name if this WebTest. @@ -909,7 +1169,7 @@ type WebTestProperties struct { // An XML configuration specification for a WebTest. Configuration *WebTestPropertiesConfiguration - // Purpose/user defined descriptive test for this WebTest. + // User defined description for this WebTest. Description *string // Is the test actively being monitored. @@ -918,12 +1178,18 @@ type WebTestProperties struct { // Interval in seconds between test runs for this WebTest. Default value is 300. Frequency *int32 + // The collection of request properties + Request *WebTestPropertiesRequest + // Allow for retries should this WebTest fail. RetryEnabled *bool // Seconds until this WebTest will timeout and fail. Default value is 30. Timeout *int32 + // The collection of validation rule properties + ValidationRules *WebTestPropertiesValidationRules + // READ-ONLY; Current state of this component, whether or not is has been provisioned within the resource group it is defined. // Users cannot change this value but are able to read from it. Values will include // Succeeded, Deploying, Canceled, and Failed. @@ -936,6 +1202,59 @@ type WebTestPropertiesConfiguration struct { WebTest *string } +// WebTestPropertiesRequest - The collection of request properties +type WebTestPropertiesRequest struct { + // Follow redirects for this web test. + FollowRedirects *bool + + // Http verb to use for this web test. + HTTPVerb *string + + // List of headers and their values to add to the WebTest call. + Headers []*HeaderField + + // Parse Dependent request for this WebTest. + ParseDependentRequests *bool + + // Base64 encoded string body to send with this web test. + RequestBody *string + + // Url location to test. + RequestURL *string +} + +// WebTestPropertiesValidationRules - The collection of validation rule properties +type WebTestPropertiesValidationRules struct { + // The collection of content validation properties + ContentValidation *WebTestPropertiesValidationRulesContentValidation + + // Validate that the WebTest returns the http status code provided. + ExpectedHTTPStatusCode *int32 + + // When set, validation will ignore the status code. + IgnoreHTTPStatusCode *bool + + // A number of days to check still remain before the the existing SSL cert expires. Value must be positive and the SSLCheck + // must be set to true. + SSLCertRemainingLifetimeCheck *int32 + + // Checks to see if the SSL cert is still valid. + SSLCheck *bool +} + +// WebTestPropertiesValidationRulesContentValidation - The collection of content validation properties +type WebTestPropertiesValidationRulesContentValidation struct { + // Content to look for in the return of the WebTest. Must not be null or empty. + ContentMatch *string + + // When set, this value makes the ContentMatch validation case insensitive. + IgnoreCase *bool + + // When true, validation will pass if there is a match for the ContentMatch string. If false, validation will fail if there + // is a match + PassIfTextFound *bool +} + // WebtestsResource - An azure resource object type WebtestsResource struct { // REQUIRED; Resource location @@ -1005,96 +1324,312 @@ type WorkItemCreateConfiguration struct { WorkItemProperties map[string]*string } -// Workbook - An Application Insights workbook definition. +// Workbook - A workbook definition. type Workbook struct { - // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind - - // Resource location + // REQUIRED; The geo-location where the resource lives Location *string - // Metadata describing a web test for an Azure resource. + // Resource etag + Etag *string + + // Identity used for BYOS + Identity *WorkbookResourceIdentity + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Metadata describing a workbook for an Azure resource. Properties *WorkbookProperties - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure resource type + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// WorkbookError - Error message body that will indicate why the operation failed. +// WorkbookError - Error response. type WorkbookError struct { - // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + // The error details. + Error *WorkbookErrorDefinition +} + +// WorkbookErrorDefinition - Error definition. +type WorkbookErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. Code *string - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract + // READ-ONLY; Internal error details. + Innererror *WorkbookInnerErrorTrace - // Human-readable representation of the error. + // READ-ONLY; Description of the error. Message *string } +// WorkbookInnerErrorTrace - Error details +type WorkbookInnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string +} + // WorkbookProperties - Properties that contain a workbook. type WorkbookProperties struct { // REQUIRED; Workbook category, as defined by the user at creation time. Category *string - // REQUIRED; The user-defined name of the workbook. - Name *string + // REQUIRED; The user-defined name (display name) of the workbook. + DisplayName *string // REQUIRED; Configuration of this particular workbook. Configuration data is a string containing valid JSON SerializedData *string - // REQUIRED; Enum indicating if this workbook definition is owned by a specific user or is shared between all users with access - // to the Application Insights component. - SharedTypeKind *SharedTypeKind - - // REQUIRED; Unique user id of the specific user that owns this workbook. - UserID *string + // The description of the workbook. + Description *string - // REQUIRED; Internally assigned unique id of the workbook definition. - WorkbookID *string + // ResourceId for a source resource. + SourceID *string - // Optional resourceId for a source resource. - SourceResourceID *string + // The resourceId to the storage account when bring your own storage is used + StorageURI *string - // A list of 0 or more tags that are associated with this workbook definition + // Being deprecated, please use the other tags field Tags []*string - // This instance's version of the data model. This can change as new features are added that can be marked workbook. + // Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData Version *string + // READ-ONLY; The unique revision id for this workbook definition + Revision *string + // READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. - TimeModified *string + TimeModified *time.Time + + // READ-ONLY; Unique user id of the specific user that owns this workbook. + UserID *string +} + +// WorkbookPropertiesUpdateParameters - Properties that contain a workbook for PATCH operation. +type WorkbookPropertiesUpdateParameters struct { + // Workbook category, as defined by the user at creation time. + Category *string + + // The description of the workbook. + Description *string + + // The user-defined name (display name) of the workbook. + DisplayName *string + + // The unique revision id for this workbook definition + Revision *string + + // Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string + + // A list of 0 or more tags that are associated with this workbook definition + Tags []*string } // WorkbookResource - An azure resource object type WorkbookResource struct { - // Resource location + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource etag + Etag *string + + // Identity used for BYOS + Identity *WorkbookResourceIdentity + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WorkbookResourceIdentity - Identity used for BYOS +type WorkbookResourceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + 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. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// WorkbookTemplate - An Application Insights workbook template definition. +type WorkbookTemplate struct { + // REQUIRED; Resource location Location *string + // Metadata describing a workbook template for an Azure resource. + Properties *WorkbookTemplateProperties + // Resource tags Tags map[string]*string // READ-ONLY; Azure resource Id ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; Azure resource name. + Name *string + + // READ-ONLY; Azure resource type + Type *string +} + +// WorkbookTemplateError - Error message that will indicate why the operation failed. +type WorkbookTemplateError struct { + // Error message object that will indicate why the operation failed. + Error *WorkbookTemplateErrorBody +} + +// WorkbookTemplateErrorBody - Error message body that will indicate why the operation failed. +type WorkbookTemplateErrorBody struct { + // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string + + // The list of invalid fields send in request, in case of validation error. + Details []*WorkbookTemplateErrorFieldContract + + // Human-readable representation of the error. + Message *string +} + +// WorkbookTemplateErrorFieldContract - Error Field contract. +type WorkbookTemplateErrorFieldContract struct { + // Property level error code. + Code *string + + // Human-readable representation of property-level error. + Message *string + + // Property name. + Target *string +} + +// WorkbookTemplateGallery - Gallery information for a workbook template. +type WorkbookTemplateGallery struct { + // Category for the gallery. + Category *string + + // Name of the workbook template in the gallery. + Name *string + + // Order of the template within the gallery. + Order *int32 + + // Azure resource type supported by the gallery. + ResourceType *string + + // Type of workbook supported by the workbook template. + Type *string +} + +// WorkbookTemplateLocalizedGallery - Localized template data and gallery information. +type WorkbookTemplateLocalizedGallery struct { + // Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery + + // Valid JSON object containing workbook template payload. + TemplateData any +} + +// WorkbookTemplateProperties - Properties that contain a workbook template. +type WorkbookTemplateProperties struct { + // REQUIRED; Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery + + // REQUIRED; Valid JSON object containing workbook template payload. + TemplateData any + + // Information about the author of the workbook template. + Author *string + + // Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. + Localized map[string][]*WorkbookTemplateLocalizedGallery + + // Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. + Priority *int32 +} + +// WorkbookTemplateResource - An azure resource object +type WorkbookTemplateResource struct { + // REQUIRED; Resource location + Location *string + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Azure resource Id + ID *string + + // READ-ONLY; Azure resource name. Name *string // READ-ONLY; Azure resource type Type *string } +// WorkbookTemplateUpdateParameters - The parameters that can be provided when updating workbook template. +type WorkbookTemplateUpdateParameters struct { + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookTemplateProperties + + // Resource tags + Tags map[string]*string +} + +// WorkbookTemplatesListResult - WorkbookTemplate list result. +type WorkbookTemplatesListResult struct { + // An array of workbook templates. + Value []*WorkbookTemplate +} + +// WorkbookUpdateParameters - The parameters that can be provided when updating workbook properties properties. +type WorkbookUpdateParameters struct { + // The kind of workbook. Only valid value is shared. + Kind *WorkbookUpdateSharedTypeKind + + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookPropertiesUpdateParameters + + // Resource tags. + Tags map[string]*string +} + // WorkbooksListResult - Workbook list result. type WorkbooksListResult struct { + NextLink *string + // READ-ONLY; An array of workbooks. Value []*Workbook } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go index 0eabca168c4a..48e23154e792 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go @@ -897,6 +897,72 @@ func (c *ComponentFeatureCapability) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ComponentLinkedStorageAccounts. +func (c ComponentLinkedStorageAccounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentLinkedStorageAccounts. +func (c *ComponentLinkedStorageAccounts) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentLinkedStorageAccountsPatch. +func (c ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentLinkedStorageAccountsPatch. +func (c *ComponentLinkedStorageAccountsPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ComponentListResult. func (c ComponentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -931,12 +997,12 @@ func (c *ComponentListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ComponentProactiveDetectionConfiguration. func (c ComponentProactiveDetectionConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "CustomEmails", c.CustomEmails) - populate(objectMap, "Enabled", c.Enabled) - populate(objectMap, "LastUpdatedTime", c.LastUpdatedTime) - populate(objectMap, "Name", c.Name) - populate(objectMap, "RuleDefinitions", c.RuleDefinitions) - populate(objectMap, "SendEmailsToSubscriptionOwners", c.SendEmailsToSubscriptionOwners) + populate(objectMap, "customEmails", c.CustomEmails) + populate(objectMap, "enabled", c.Enabled) + populate(objectMap, "lastUpdatedTime", c.LastUpdatedTime) + populate(objectMap, "name", c.Name) + populate(objectMap, "ruleDefinitions", c.RuleDefinitions) + populate(objectMap, "sendEmailsToSubscriptionOwners", c.SendEmailsToSubscriptionOwners) return json.Marshal(objectMap) } @@ -949,22 +1015,22 @@ func (c *ComponentProactiveDetectionConfiguration) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "CustomEmails": + case "customEmails": err = unpopulate(val, "CustomEmails", &c.CustomEmails) delete(rawMsg, key) - case "Enabled": + case "enabled": err = unpopulate(val, "Enabled", &c.Enabled) delete(rawMsg, key) - case "LastUpdatedTime": + case "lastUpdatedTime": err = unpopulate(val, "LastUpdatedTime", &c.LastUpdatedTime) delete(rawMsg, key) - case "Name": + case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "RuleDefinitions": + case "ruleDefinitions": err = unpopulate(val, "RuleDefinitions", &c.RuleDefinitions) delete(rawMsg, key) - case "SendEmailsToSubscriptionOwners": + case "sendEmailsToSubscriptionOwners": err = unpopulate(val, "SendEmailsToSubscriptionOwners", &c.SendEmailsToSubscriptionOwners) delete(rawMsg, key) } @@ -1386,413 +1452,654 @@ func (c *ComponentsResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorFieldContract. -func (e ErrorFieldContract) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbook. +func (d DeletedWorkbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorFieldContract. -func (e *ErrorFieldContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbook. +func (d *DeletedWorkbook) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "etag": + err = unpopulate(val, "Etag", &d.Etag) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseComponents. -func (e ErrorResponseComponents) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbookError. +func (d DeletedWorkbookError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "error", d.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseComponents. -func (e *ErrorResponseComponents) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbookError. +func (d *DeletedWorkbookError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "error": - err = unpopulate(val, "Error", &e.Error) + err = unpopulate(val, "Error", &d.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseComponentsError. -func (e ErrorResponseComponentsError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbookErrorDefinition. +func (d DeletedWorkbookErrorDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populate(objectMap, "code", d.Code) + populate(objectMap, "innererror", d.Innererror) + populate(objectMap, "message", d.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseComponentsError. -func (e *ErrorResponseComponentsError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbookErrorDefinition. +func (d *DeletedWorkbookErrorDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "code": - err = unpopulate(val, "Code", &e.Code) + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &d.Innererror) delete(rawMsg, key) case "message": - err = unpopulate(val, "Message", &e.Message) + err = unpopulate(val, "Message", &d.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type InnerError. -func (i InnerError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbookInnerErrorTrace. +func (d DeletedWorkbookInnerErrorTrace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "diagnosticcontext", i.Diagnosticcontext) - populateDateTimeRFC3339(objectMap, "time", i.Time) + populate(objectMap, "trace", d.Trace) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. -func (i *InnerError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbookInnerErrorTrace. +func (d *DeletedWorkbookInnerErrorTrace) 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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "diagnosticcontext": - err = unpopulate(val, "Diagnosticcontext", &i.Diagnosticcontext) - delete(rawMsg, key) - case "time": - err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + case "trace": + err = unpopulate(val, "Trace", &d.Trace) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LinkProperties. -func (l LinkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbookProperties. +func (d DeletedWorkbookProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", l.Category) - populate(objectMap, "sourceId", l.SourceID) - populate(objectMap, "targetId", l.TargetID) + populate(objectMap, "category", d.Category) + populate(objectMap, "description", d.Description) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "revision", d.Revision) + populate(objectMap, "serializedData", d.SerializedData) + populate(objectMap, "sourceId", d.SourceID) + populate(objectMap, "storageUri", d.StorageURI) + populate(objectMap, "tags", d.Tags) + populateDateTimeRFC3339(objectMap, "timeModified", d.TimeModified) + populate(objectMap, "userId", d.UserID) + populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LinkProperties. -func (l *LinkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbookProperties. +func (d *DeletedWorkbookProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "category": - err = unpopulate(val, "Category", &l.Category) + err = unpopulate(val, "Category", &d.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &d.Revision) + delete(rawMsg, key) + case "serializedData": + err = unpopulate(val, "SerializedData", &d.SerializedData) delete(rawMsg, key) case "sourceId": - err = unpopulate(val, "SourceID", &l.SourceID) + err = unpopulate(val, "SourceID", &d.SourceID) + delete(rawMsg, key) + case "storageUri": + err = unpopulate(val, "StorageURI", &d.StorageURI) delete(rawMsg, key) - case "targetId": - err = unpopulate(val, "TargetID", &l.TargetID) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "timeModified": + err = unpopulateDateTimeRFC3339(val, "TimeModified", &d.TimeModified) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &d.UserID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbook. -func (m MyWorkbook) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbookResource. +func (d DeletedWorkbookResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "kind", m.Kind) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbook. -func (m *MyWorkbook) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbookResource. +func (d *DeletedWorkbookResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &m.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "kind": - err = unpopulate(val, "Kind", &m.Kind) + err = unpopulate(val, "Kind", &d.Kind) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &m.Location) + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &m.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &m.Tags) + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &m.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbookError. -func (m MyWorkbookError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedWorkbooksListResult. +func (d DeletedWorkbooksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", m.Code) - populate(objectMap, "details", m.Details) - populate(objectMap, "message", m.Message) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookError. -func (m *MyWorkbookError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedWorkbooksListResult. +func (d *DeletedWorkbooksListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &m.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &m.Details) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &m.Message) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbookProperties. -func (m MyWorkbookProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorFieldContract. +func (e ErrorFieldContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "serializedData", m.SerializedData) - populate(objectMap, "sourceId", m.SourceID) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "timeModified", m.TimeModified) - populate(objectMap, "userId", m.UserID) - populate(objectMap, "version", m.Version) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookProperties. -func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorFieldContract. +func (e *ErrorFieldContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "serializedData": - err = unpopulate(val, "SerializedData", &m.SerializedData) - delete(rawMsg, key) - case "sourceId": - err = unpopulate(val, "SourceID", &m.SourceID) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - case "timeModified": - err = unpopulate(val, "TimeModified", &m.TimeModified) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &m.UserID) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &m.Version) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbookResource. -func (m MyWorkbookResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookResource. -func (m *MyWorkbookResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbooksListResult. -func (m MyWorkbooksListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseComponents. +func (e ErrorResponseComponents) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbooksListResult. -func (m *MyWorkbooksListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseComponents. +func (e *ErrorResponseComponents) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseComponentsError. +func (e ErrorResponseComponentsError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseComponentsError. +func (e *ErrorResponseComponentsError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseLinkedStorage. +func (e ErrorResponseLinkedStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseLinkedStorage. +func (e *ErrorResponseLinkedStorage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseLinkedStorageError. +func (e ErrorResponseLinkedStorageError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseLinkedStorageError. +func (e *ErrorResponseLinkedStorageError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HeaderField. +func (h HeaderField) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", h.HeaderFieldName) + populate(objectMap, "value", h.HeaderFieldValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderField. +func (h *HeaderField) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "HeaderFieldName", &h.HeaderFieldName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "HeaderFieldValue", &h.HeaderFieldValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diagnosticcontext", i.Diagnosticcontext) + populateDateTimeRFC3339(objectMap, "time", i.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. +func (i *InnerError) 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 "diagnosticcontext": + err = unpopulate(val, "Diagnosticcontext", &i.Diagnosticcontext) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + 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 LinkedStorageAccountsProperties. +func (l LinkedStorageAccountsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "linkedStorageAccount", l.LinkedStorageAccount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkedStorageAccountsProperties. +func (l *LinkedStorageAccountsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkedStorageAccount": + err = unpopulate(val, "LinkedStorageAccount", &l.LinkedStorageAccount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LiveTokenResponse. +func (l LiveTokenResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "liveToken", l.LiveToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveTokenResponse. +func (l *LiveTokenResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "liveToken": + err = unpopulate(val, "LiveToken", &l.LiveToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Operation. @@ -1847,116 +2154,1059 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationInfo. +func (o OperationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInfo. +func (o *OperationInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationLive. +func (o OperationLive) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populateAny(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLive. +func (o *OperationLive) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. +func (o OperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResult. +func (o *OperationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. +func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ResourceId", p.ResourceID) + populate(objectMap, "ScopeId", p.ScopeID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopedResource. +func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ResourceId": + err = unpopulate(val, "ResourceID", &p.ResourceID) + delete(rawMsg, key) + case "ScopeId": + err = unpopulate(val, "ScopeID", &p.ScopeID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. +func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. +func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResourceAutoGenerated. +func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceAutoGenerated. +func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTest. +func (w WebTest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTest. +func (w *WebTest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestGeolocation. +func (w WebTestGeolocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "Id", w.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestGeolocation. +func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "Id": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestListResult. +func (w WebTestListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestListResult. +func (w *WebTestListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestLocationsListResult. +func (w WebTestLocationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestLocationsListResult. +func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestProperties. +func (w WebTestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "Configuration", w.Configuration) + populate(objectMap, "Description", w.Description) + populate(objectMap, "Enabled", w.Enabled) + populate(objectMap, "Frequency", w.Frequency) + populate(objectMap, "Locations", w.Locations) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "Request", w.Request) + populate(objectMap, "RetryEnabled", w.RetryEnabled) + populate(objectMap, "SyntheticMonitorId", w.SyntheticMonitorID) + populate(objectMap, "Timeout", w.Timeout) + populate(objectMap, "ValidationRules", w.ValidationRules) + populate(objectMap, "Kind", w.WebTestKind) + populate(objectMap, "Name", w.WebTestName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestProperties. +func (w *WebTestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "Configuration": + err = unpopulate(val, "Configuration", &w.Configuration) + delete(rawMsg, key) + case "Description": + err = unpopulate(val, "Description", &w.Description) + delete(rawMsg, key) + case "Enabled": + err = unpopulate(val, "Enabled", &w.Enabled) + delete(rawMsg, key) + case "Frequency": + err = unpopulate(val, "Frequency", &w.Frequency) + delete(rawMsg, key) + case "Locations": + err = unpopulate(val, "Locations", &w.Locations) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "Request": + err = unpopulate(val, "Request", &w.Request) + delete(rawMsg, key) + case "RetryEnabled": + err = unpopulate(val, "RetryEnabled", &w.RetryEnabled) + delete(rawMsg, key) + case "SyntheticMonitorId": + err = unpopulate(val, "SyntheticMonitorID", &w.SyntheticMonitorID) + delete(rawMsg, key) + case "Timeout": + err = unpopulate(val, "Timeout", &w.Timeout) + delete(rawMsg, key) + case "ValidationRules": + err = unpopulate(val, "ValidationRules", &w.ValidationRules) + delete(rawMsg, key) + case "Kind": + err = unpopulate(val, "WebTestKind", &w.WebTestKind) + delete(rawMsg, key) + case "Name": + err = unpopulate(val, "WebTestName", &w.WebTestName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesConfiguration. +func (w WebTestPropertiesConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "WebTest", w.WebTest) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesConfiguration. +func (w *WebTestPropertiesConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "WebTest": + err = unpopulate(val, "WebTest", &w.WebTest) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesRequest. +func (w WebTestPropertiesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "FollowRedirects", w.FollowRedirects) + populate(objectMap, "HttpVerb", w.HTTPVerb) + populate(objectMap, "Headers", w.Headers) + populate(objectMap, "ParseDependentRequests", w.ParseDependentRequests) + populate(objectMap, "RequestBody", w.RequestBody) + populate(objectMap, "RequestUrl", w.RequestURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesRequest. +func (w *WebTestPropertiesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "FollowRedirects": + err = unpopulate(val, "FollowRedirects", &w.FollowRedirects) + delete(rawMsg, key) + case "HttpVerb": + err = unpopulate(val, "HTTPVerb", &w.HTTPVerb) + delete(rawMsg, key) + case "Headers": + err = unpopulate(val, "Headers", &w.Headers) + delete(rawMsg, key) + case "ParseDependentRequests": + err = unpopulate(val, "ParseDependentRequests", &w.ParseDependentRequests) + delete(rawMsg, key) + case "RequestBody": + err = unpopulate(val, "RequestBody", &w.RequestBody) + delete(rawMsg, key) + case "RequestUrl": + err = unpopulate(val, "RequestURL", &w.RequestURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesValidationRules. +func (w WebTestPropertiesValidationRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ContentValidation", w.ContentValidation) + populate(objectMap, "ExpectedHttpStatusCode", w.ExpectedHTTPStatusCode) + populate(objectMap, "IgnoreHttpStatusCode", w.IgnoreHTTPStatusCode) + populate(objectMap, "SSLCertRemainingLifetimeCheck", w.SSLCertRemainingLifetimeCheck) + populate(objectMap, "SSLCheck", w.SSLCheck) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesValidationRules. +func (w *WebTestPropertiesValidationRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ContentValidation": + err = unpopulate(val, "ContentValidation", &w.ContentValidation) + delete(rawMsg, key) + case "ExpectedHttpStatusCode": + err = unpopulate(val, "ExpectedHTTPStatusCode", &w.ExpectedHTTPStatusCode) + delete(rawMsg, key) + case "IgnoreHttpStatusCode": + err = unpopulate(val, "IgnoreHTTPStatusCode", &w.IgnoreHTTPStatusCode) + delete(rawMsg, key) + case "SSLCertRemainingLifetimeCheck": + err = unpopulate(val, "SSLCertRemainingLifetimeCheck", &w.SSLCertRemainingLifetimeCheck) + delete(rawMsg, key) + case "SSLCheck": + err = unpopulate(val, "SSLCheck", &w.SSLCheck) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesValidationRulesContentValidation. +func (w WebTestPropertiesValidationRulesContentValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ContentMatch", w.ContentMatch) + populate(objectMap, "IgnoreCase", w.IgnoreCase) + populate(objectMap, "PassIfTextFound", w.PassIfTextFound) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesValidationRulesContentValidation. +func (w *WebTestPropertiesValidationRulesContentValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ContentMatch": + err = unpopulate(val, "ContentMatch", &w.ContentMatch) + delete(rawMsg, key) + case "IgnoreCase": + err = unpopulate(val, "IgnoreCase", &w.IgnoreCase) + delete(rawMsg, key) + case "PassIfTextFound": + err = unpopulate(val, "PassIfTextFound", &w.PassIfTextFound) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebtestsResource. +func (w WebtestsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestsResource. +func (w *WebtestsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkItemConfiguration. +func (w WorkItemConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ConfigDisplayName", w.ConfigDisplayName) + populate(objectMap, "ConfigProperties", w.ConfigProperties) + populate(objectMap, "ConnectorId", w.ConnectorID) + populate(objectMap, "Id", w.ID) + populate(objectMap, "IsDefault", w.IsDefault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfiguration. +func (w *WorkItemConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ConfigDisplayName": + err = unpopulate(val, "ConfigDisplayName", &w.ConfigDisplayName) + delete(rawMsg, key) + case "ConfigProperties": + err = unpopulate(val, "ConfigProperties", &w.ConfigProperties) + delete(rawMsg, key) + case "ConnectorId": + err = unpopulate(val, "ConnectorID", &w.ConnectorID) + delete(rawMsg, key) + case "Id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "IsDefault": + err = unpopulate(val, "IsDefault", &w.IsDefault) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkItemConfigurationError. +func (w WorkItemConfigurationError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "code", w.Code) + populate(objectMap, "innererror", w.Innererror) + populate(objectMap, "message", w.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfigurationError. +func (w *WorkItemConfigurationError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "code": + err = unpopulate(val, "Code", &w.Code) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "innererror": + err = unpopulate(val, "Innererror", &w.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. -func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkItemConfigurationsListResult. +func (w WorkItemConfigurationsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ResourceId", p.ResourceID) - populate(objectMap, "ScopeId", p.ScopeID) + populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopedResource. -func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfigurationsListResult. +func (w *WorkItemConfigurationsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "ResourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) - delete(rawMsg, key) - case "ScopeId": - err = unpopulate(val, "ScopeID", &p.ScopeID) + case "value": + err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkItemCreateConfiguration. +func (w WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", t.Tags) + populate(objectMap, "ConnectorDataConfiguration", w.ConnectorDataConfiguration) + populate(objectMap, "ConnectorId", w.ConnectorID) + populate(objectMap, "ValidateOnly", w.ValidateOnly) + populate(objectMap, "WorkItemProperties", w.WorkItemProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. -func (t *TagsResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemCreateConfiguration. +func (w *WorkItemCreateConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "ConnectorDataConfiguration": + err = unpopulate(val, "ConnectorDataConfiguration", &w.ConnectorDataConfiguration) + delete(rawMsg, key) + case "ConnectorId": + err = unpopulate(val, "ConnectorID", &w.ConnectorID) + delete(rawMsg, key) + case "ValidateOnly": + err = unpopulate(val, "ValidateOnly", &w.ValidateOnly) + delete(rawMsg, key) + case "WorkItemProperties": + err = unpopulate(val, "WorkItemProperties", &w.WorkItemProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTest. -func (w WebTest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Workbook. +func (w Workbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "etag", w.Etag) populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) populate(objectMap, "kind", w.Kind) populate(objectMap, "location", w.Location) populate(objectMap, "name", w.Name) populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) populate(objectMap, "tags", w.Tags) populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTest. -func (w *WebTest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Workbook. +func (w *Workbook) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -1964,9 +3214,15 @@ func (w *WebTest) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &w.Kind) delete(rawMsg, key) @@ -1979,6 +3235,9 @@ func (w *WebTest) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) @@ -1993,15 +3252,15 @@ func (w *WebTest) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestGeolocation. -func (w WebTestGeolocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookError. +func (w WorkbookError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "Id", w.Location) + populate(objectMap, "error", w.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestGeolocation. -func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookError. +func (w *WorkbookError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2009,8 +3268,8 @@ func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "Id": - err = unpopulate(val, "Location", &w.Location) + case "error": + err = unpopulate(val, "Error", &w.Error) delete(rawMsg, key) } if err != nil { @@ -2020,16 +3279,17 @@ func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestListResult. -func (w WebTestListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookErrorDefinition. +func (w WorkbookErrorDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) + populate(objectMap, "code", w.Code) + populate(objectMap, "innererror", w.Innererror) + populate(objectMap, "message", w.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestListResult. -func (w *WebTestListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookErrorDefinition. +func (w *WorkbookErrorDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2037,11 +3297,14 @@ func (w *WebTestListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) + case "code": + err = unpopulate(val, "Code", &w.Code) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) + case "innererror": + err = unpopulate(val, "Innererror", &w.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) delete(rawMsg, key) } if err != nil { @@ -2051,15 +3314,15 @@ func (w *WebTestListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestLocationsListResult. -func (w WebTestLocationsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookInnerErrorTrace. +func (w WorkbookInnerErrorTrace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", w.Value) + populate(objectMap, "trace", w.Trace) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestLocationsListResult. -func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookInnerErrorTrace. +func (w *WorkbookInnerErrorTrace) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2067,8 +3330,8 @@ func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &w.Value) + case "trace": + err = unpopulate(val, "Trace", &w.Trace) delete(rawMsg, key) } if err != nil { @@ -2078,25 +3341,25 @@ func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestProperties. -func (w WebTestProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookProperties. +func (w WorkbookProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "Configuration", w.Configuration) - populate(objectMap, "Description", w.Description) - populate(objectMap, "Enabled", w.Enabled) - populate(objectMap, "Frequency", w.Frequency) - populate(objectMap, "Locations", w.Locations) - populate(objectMap, "provisioningState", w.ProvisioningState) - populate(objectMap, "RetryEnabled", w.RetryEnabled) - populate(objectMap, "SyntheticMonitorId", w.SyntheticMonitorID) - populate(objectMap, "Timeout", w.Timeout) - populate(objectMap, "Kind", w.WebTestKind) - populate(objectMap, "Name", w.WebTestName) + populate(objectMap, "category", w.Category) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "serializedData", w.SerializedData) + populate(objectMap, "sourceId", w.SourceID) + populate(objectMap, "storageUri", w.StorageURI) + populate(objectMap, "tags", w.Tags) + populateDateTimeRFC3339(objectMap, "timeModified", w.TimeModified) + populate(objectMap, "userId", w.UserID) + populate(objectMap, "version", w.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestProperties. -func (w *WebTestProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookProperties. +func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2104,38 +3367,140 @@ func (w *WebTestProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "Configuration": - err = unpopulate(val, "Configuration", &w.Configuration) + case "category": + err = unpopulate(val, "Category", &w.Category) delete(rawMsg, key) - case "Description": + case "description": err = unpopulate(val, "Description", &w.Description) delete(rawMsg, key) - case "Enabled": - err = unpopulate(val, "Enabled", &w.Enabled) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) delete(rawMsg, key) - case "Frequency": - err = unpopulate(val, "Frequency", &w.Frequency) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) delete(rawMsg, key) - case "Locations": - err = unpopulate(val, "Locations", &w.Locations) + case "serializedData": + err = unpopulate(val, "SerializedData", &w.SerializedData) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &w.SourceID) + delete(rawMsg, key) + case "storageUri": + err = unpopulate(val, "StorageURI", &w.StorageURI) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "timeModified": + err = unpopulateDateTimeRFC3339(val, "TimeModified", &w.TimeModified) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &w.UserID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &w.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookPropertiesUpdateParameters. +func (w WorkbookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", w.Category) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "serializedData", w.SerializedData) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookPropertiesUpdateParameters. +func (w *WorkbookPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &w.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &w.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "serializedData": + err = unpopulate(val, "SerializedData", &w.SerializedData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookResource. +func (w WorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookResource. +func (w *WorkbookResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) delete(rawMsg, key) - case "RetryEnabled": - err = unpopulate(val, "RetryEnabled", &w.RetryEnabled) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) delete(rawMsg, key) - case "SyntheticMonitorId": - err = unpopulate(val, "SyntheticMonitorID", &w.SyntheticMonitorID) + case "location": + err = unpopulate(val, "Location", &w.Location) delete(rawMsg, key) - case "Timeout": - err = unpopulate(val, "Timeout", &w.Timeout) + case "name": + err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) - case "Kind": - err = unpopulate(val, "WebTestKind", &w.WebTestKind) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) - case "Name": - err = unpopulate(val, "WebTestName", &w.WebTestName) + case "type": + err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) } if err != nil { @@ -2145,15 +3510,18 @@ func (w *WebTestProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesConfiguration. -func (w WebTestPropertiesConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookResourceIdentity. +func (w WorkbookResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "WebTest", w.WebTest) + populate(objectMap, "principalId", w.PrincipalID) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "type", w.Type) + populate(objectMap, "userAssignedIdentities", w.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesConfiguration. -func (w *WebTestPropertiesConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookResourceIdentity. +func (w *WorkbookResourceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2161,8 +3529,17 @@ func (w *WebTestPropertiesConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "WebTest": - err = unpopulate(val, "WebTest", &w.WebTest) + case "principalId": + err = unpopulate(val, "PrincipalID", &w.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &w.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { @@ -2172,19 +3549,20 @@ func (w *WebTestPropertiesConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WebtestsResource. -func (w WebtestsResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplate. +func (w WorkbookTemplate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", w.ID) populate(objectMap, "location", w.Location) populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) populate(objectMap, "tags", w.Tags) populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestsResource. -func (w *WebtestsResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplate. +func (w *WorkbookTemplate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2201,6 +3579,9 @@ func (w *WebtestsResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) @@ -2215,19 +3596,15 @@ func (w *WebtestsResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkItemConfiguration. -func (w WorkItemConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateError. +func (w WorkbookTemplateError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ConfigDisplayName", w.ConfigDisplayName) - populate(objectMap, "ConfigProperties", w.ConfigProperties) - populate(objectMap, "ConnectorId", w.ConnectorID) - populate(objectMap, "Id", w.ID) - populate(objectMap, "IsDefault", w.IsDefault) + populate(objectMap, "error", w.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfiguration. -func (w *WorkItemConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateError. +func (w *WorkbookTemplateError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2235,20 +3612,43 @@ func (w *WorkItemConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ConfigDisplayName": - err = unpopulate(val, "ConfigDisplayName", &w.ConfigDisplayName) - delete(rawMsg, key) - case "ConfigProperties": - err = unpopulate(val, "ConfigProperties", &w.ConfigProperties) + case "error": + err = unpopulate(val, "Error", &w.Error) delete(rawMsg, key) - case "ConnectorId": - err = unpopulate(val, "ConnectorID", &w.ConnectorID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateErrorBody. +func (w WorkbookTemplateErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", w.Code) + populate(objectMap, "details", w.Details) + populate(objectMap, "message", w.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateErrorBody. +func (w *WorkbookTemplateErrorBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &w.Code) delete(rawMsg, key) - case "Id": - err = unpopulate(val, "ID", &w.ID) + case "details": + err = unpopulate(val, "Details", &w.Details) delete(rawMsg, key) - case "IsDefault": - err = unpopulate(val, "IsDefault", &w.IsDefault) + case "message": + err = unpopulate(val, "Message", &w.Message) delete(rawMsg, key) } if err != nil { @@ -2258,17 +3658,17 @@ func (w *WorkItemConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkItemConfigurationError. -func (w WorkItemConfigurationError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateErrorFieldContract. +func (w WorkbookTemplateErrorFieldContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", w.Code) - populate(objectMap, "innererror", w.Innererror) populate(objectMap, "message", w.Message) + populate(objectMap, "target", w.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfigurationError. -func (w *WorkItemConfigurationError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateErrorFieldContract. +func (w *WorkbookTemplateErrorFieldContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2279,12 +3679,12 @@ func (w *WorkItemConfigurationError) UnmarshalJSON(data []byte) error { case "code": err = unpopulate(val, "Code", &w.Code) delete(rawMsg, key) - case "innererror": - err = unpopulate(val, "Innererror", &w.Innererror) - delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &w.Message) delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &w.Target) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2293,15 +3693,19 @@ func (w *WorkItemConfigurationError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkItemConfigurationsListResult. -func (w WorkItemConfigurationsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateGallery. +func (w WorkbookTemplateGallery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", w.Value) + populate(objectMap, "category", w.Category) + populate(objectMap, "name", w.Name) + populate(objectMap, "order", w.Order) + populate(objectMap, "resourceType", w.ResourceType) + populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemConfigurationsListResult. -func (w *WorkItemConfigurationsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateGallery. +func (w *WorkbookTemplateGallery) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2309,8 +3713,20 @@ func (w *WorkItemConfigurationsListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &w.Value) + case "category": + err = unpopulate(val, "Category", &w.Category) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &w.Order) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &w.ResourceType) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) } if err != nil { @@ -2320,18 +3736,16 @@ func (w *WorkItemConfigurationsListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkItemCreateConfiguration. -func (w WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateLocalizedGallery. +func (w WorkbookTemplateLocalizedGallery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ConnectorDataConfiguration", w.ConnectorDataConfiguration) - populate(objectMap, "ConnectorId", w.ConnectorID) - populate(objectMap, "ValidateOnly", w.ValidateOnly) - populate(objectMap, "WorkItemProperties", w.WorkItemProperties) + populate(objectMap, "galleries", w.Galleries) + populateAny(objectMap, "templateData", w.TemplateData) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkItemCreateConfiguration. -func (w *WorkItemCreateConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateLocalizedGallery. +func (w *WorkbookTemplateLocalizedGallery) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2339,17 +3753,54 @@ func (w *WorkItemCreateConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ConnectorDataConfiguration": - err = unpopulate(val, "ConnectorDataConfiguration", &w.ConnectorDataConfiguration) + case "galleries": + err = unpopulate(val, "Galleries", &w.Galleries) delete(rawMsg, key) - case "ConnectorId": - err = unpopulate(val, "ConnectorID", &w.ConnectorID) + case "templateData": + err = unpopulate(val, "TemplateData", &w.TemplateData) delete(rawMsg, key) - case "ValidateOnly": - err = unpopulate(val, "ValidateOnly", &w.ValidateOnly) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateProperties. +func (w WorkbookTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "author", w.Author) + populate(objectMap, "galleries", w.Galleries) + populate(objectMap, "localized", w.Localized) + populate(objectMap, "priority", w.Priority) + populateAny(objectMap, "templateData", w.TemplateData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateProperties. +func (w *WorkbookTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &w.Author) delete(rawMsg, key) - case "WorkItemProperties": - err = unpopulate(val, "WorkItemProperties", &w.WorkItemProperties) + case "galleries": + err = unpopulate(val, "Galleries", &w.Galleries) + delete(rawMsg, key) + case "localized": + err = unpopulate(val, "Localized", &w.Localized) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &w.Priority) + delete(rawMsg, key) + case "templateData": + err = unpopulate(val, "TemplateData", &w.TemplateData) delete(rawMsg, key) } if err != nil { @@ -2359,21 +3810,19 @@ func (w *WorkItemCreateConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Workbook. -func (w Workbook) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateResource. +func (w WorkbookTemplateResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", w.ID) - populate(objectMap, "kind", w.Kind) populate(objectMap, "location", w.Location) populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) populate(objectMap, "tags", w.Tags) populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Workbook. -func (w *Workbook) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateResource. +func (w *WorkbookTemplateResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2384,18 +3833,12 @@ func (w *Workbook) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &w.Kind) - delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &w.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &w.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) @@ -2410,17 +3853,16 @@ func (w *Workbook) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkbookError. -func (w WorkbookError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateUpdateParameters. +func (w WorkbookTemplateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", w.Code) - populate(objectMap, "details", w.Details) - populate(objectMap, "message", w.Message) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookError. -func (w *WorkbookError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateUpdateParameters. +func (w *WorkbookTemplateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2428,14 +3870,11 @@ func (w *WorkbookError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &w.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &w.Details) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &w.Message) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) } if err != nil { @@ -2445,24 +3884,15 @@ func (w *WorkbookError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkbookProperties. -func (w WorkbookProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplatesListResult. +func (w WorkbookTemplatesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", w.Category) - populate(objectMap, "name", w.Name) - populate(objectMap, "serializedData", w.SerializedData) - populate(objectMap, "kind", w.SharedTypeKind) - populate(objectMap, "sourceResourceId", w.SourceResourceID) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "timeModified", w.TimeModified) - populate(objectMap, "userId", w.UserID) - populate(objectMap, "version", w.Version) - populate(objectMap, "workbookId", w.WorkbookID) + populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookProperties. -func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplatesListResult. +func (w *WorkbookTemplatesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2470,35 +3900,8 @@ func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &w.Category) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "serializedData": - err = unpopulate(val, "SerializedData", &w.SerializedData) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "SharedTypeKind", &w.SharedTypeKind) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &w.SourceResourceID) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &w.Tags) - delete(rawMsg, key) - case "timeModified": - err = unpopulate(val, "TimeModified", &w.TimeModified) - delete(rawMsg, key) - case "userId": - err = unpopulate(val, "UserID", &w.UserID) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &w.Version) - delete(rawMsg, key) - case "workbookId": - err = unpopulate(val, "WorkbookID", &w.WorkbookID) + case "value": + err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) } if err != nil { @@ -2508,19 +3911,17 @@ func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkbookResource. -func (w WorkbookResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookUpdateParameters. +func (w WorkbookUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "properties", w.Properties) populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookResource. -func (w *WorkbookResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookUpdateParameters. +func (w *WorkbookUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2528,21 +3929,15 @@ func (w *WorkbookResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) @@ -2554,6 +3949,7 @@ func (w *WorkbookResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkbooksListResult. func (w WorkbooksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } @@ -2567,6 +3963,9 @@ func (w *WorkbooksListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) @@ -2599,7 +3998,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go deleted file mode 100644 index 73087e7488eb..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go +++ /dev/null @@ -1,433 +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 armapplicationinsights - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// MyWorkbooksClient contains the methods for the MyWorkbooks group. -// Don't use this type directly, use NewMyWorkbooksClient() instead. -type MyWorkbooksClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMyWorkbooksClient creates a new instance of MyWorkbooksClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMyWorkbooksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MyWorkbooksClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MyWorkbooksClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a new private workbook. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - workbookProperties - Properties that need to be specified to create a new private workbook. -// - options - MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate -// method. -func (client *MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientCreateOrUpdateOptions) (MyWorkbooksClientCreateOrUpdateResponse, error) { - var err error - const operationName = "MyWorkbooksClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) - if err != nil { - return MyWorkbooksClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return MyWorkbooksClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *MyWorkbooksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *MyWorkbooksClient) createOrUpdateHandleResponse(resp *http.Response) (MyWorkbooksClientCreateOrUpdateResponse, error) { - result := MyWorkbooksClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MyWorkbook); err != nil { - return MyWorkbooksClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a private workbook. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - options - MyWorkbooksClientDeleteOptions contains the optional parameters for the MyWorkbooksClient.Delete method. -func (client *MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientDeleteOptions) (MyWorkbooksClientDeleteResponse, error) { - var err error - const operationName = "MyWorkbooksClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return MyWorkbooksClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusCreated, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return MyWorkbooksClientDeleteResponse{}, err - } - return MyWorkbooksClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *MyWorkbooksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a single private workbook by its resourceName. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - options - MyWorkbooksClientGetOptions contains the optional parameters for the MyWorkbooksClient.Get method. -func (client *MyWorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientGetOptions) (MyWorkbooksClientGetResponse, error) { - var err error - const operationName = "MyWorkbooksClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return MyWorkbooksClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MyWorkbooksClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MyWorkbooksClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MyWorkbooksClient) getHandleResponse(resp *http.Response) (MyWorkbooksClientGetResponse, error) { - result := MyWorkbooksClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MyWorkbook); err != nil { - return MyWorkbooksClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Get all private workbooks defined within a specified resource group and category. -// -// Generated from API version 2015-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - category - Category of workbook to return. -// - options - MyWorkbooksClientListByResourceGroupOptions contains the optional parameters for the MyWorkbooksClient.NewListByResourceGroupPager -// method. -func (client *MyWorkbooksClient) NewListByResourceGroupPager(resourceGroupName string, category CategoryType, options *MyWorkbooksClientListByResourceGroupOptions) *runtime.Pager[MyWorkbooksClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[MyWorkbooksClientListByResourceGroupResponse]{ - More: func(page MyWorkbooksClientListByResourceGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MyWorkbooksClientListByResourceGroupResponse) (MyWorkbooksClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MyWorkbooksClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) - if err != nil { - return MyWorkbooksClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MyWorkbooksClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *MyWorkbooksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, category CategoryType, options *MyWorkbooksClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("category", string(category)) - if options != nil && options.Tags != nil { - reqQP.Set("tags", strings.Join(options.Tags, ",")) - } - if options != nil && options.CanFetchContent != nil { - reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) - } - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *MyWorkbooksClient) listByResourceGroupHandleResponse(resp *http.Response) (MyWorkbooksClientListByResourceGroupResponse, error) { - result := MyWorkbooksClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MyWorkbooksListResult); err != nil { - return MyWorkbooksClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Get all private workbooks defined within a specified subscription and category. -// -// Generated from API version 2015-05-01 -// - category - Category of workbook to return. -// - options - MyWorkbooksClientListBySubscriptionOptions contains the optional parameters for the MyWorkbooksClient.NewListBySubscriptionPager -// method. -func (client *MyWorkbooksClient) NewListBySubscriptionPager(category CategoryType, options *MyWorkbooksClientListBySubscriptionOptions) *runtime.Pager[MyWorkbooksClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[MyWorkbooksClientListBySubscriptionResponse]{ - More: func(page MyWorkbooksClientListBySubscriptionResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MyWorkbooksClientListBySubscriptionResponse) (MyWorkbooksClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MyWorkbooksClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, category, options) - if err != nil { - return MyWorkbooksClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MyWorkbooksClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *MyWorkbooksClient) listBySubscriptionCreateRequest(ctx context.Context, category CategoryType, options *MyWorkbooksClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("category", string(category)) - if options != nil && options.Tags != nil { - reqQP.Set("tags", strings.Join(options.Tags, ",")) - } - if options != nil && options.CanFetchContent != nil { - reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) - } - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *MyWorkbooksClient) listBySubscriptionHandleResponse(resp *http.Response) (MyWorkbooksClientListBySubscriptionResponse, error) { - result := MyWorkbooksClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MyWorkbooksListResult); err != nil { - return MyWorkbooksClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates a private workbook that has already been added. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-05-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - workbookProperties - Properties that need to be specified to create a new private workbook. -// - options - MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. -func (client *MyWorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientUpdateOptions) (MyWorkbooksClientUpdateResponse, error) { - var err error - const operationName = "MyWorkbooksClient.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, resourceName, workbookProperties, options) - if err != nil { - return MyWorkbooksClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MyWorkbooksClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MyWorkbooksClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *MyWorkbooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *MyWorkbooksClient) updateHandleResponse(resp *http.Response) (MyWorkbooksClientUpdateResponse, error) { - result := MyWorkbooksClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MyWorkbook); err != nil { - return MyWorkbooksClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go deleted file mode 100644 index 4b73073e4eb5..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go +++ /dev/null @@ -1,210 +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 armapplicationinsights_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/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json -func ExampleMyWorkbooksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMyWorkbooksClient().NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions{Tags: []string{}, - CanFetchContent: 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.MyWorkbooksListResult = armapplicationinsights.MyWorkbooksListResult{ - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookGet.json -func ExampleMyWorkbooksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", 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.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/microsoft.insights/myworkbooks/deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("My New Workbook"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookDelete.json -func ExampleMyWorkbooksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMyWorkbooksClient().Delete(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookAdd.json -func ExampleMyWorkbooksClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-8bee-4d3b-a059-9be8dac93960", armapplicationinsights.MyWorkbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - Location: to.Ptr("west us"), - Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), - }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - Properties: &armapplicationinsights.MyWorkbookProperties{ - Category: to.Ptr("workbook"), - DisplayName: to.Ptr("Blah Blah Blah"), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - }, - }, 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.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group/providers/microsoft.insights/myworkbooks/deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("Blah Blah Blah"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // Version: to.Ptr("ME"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookUpdate.json -func ExampleMyWorkbooksClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.MyWorkbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - Location: to.Ptr("west us"), - Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), - }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - Properties: &armapplicationinsights.MyWorkbookProperties{ - Category: to.Ptr("workbook"), - DisplayName: to.Ptr("Blah Blah Blah"), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - Version: to.Ptr("ME"), - }, - }, 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.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("Blah Blah Blah"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // Version: to.Ptr("ME"), - // }, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go new file mode 100644 index 000000000000..dfd9451f8330 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go @@ -0,0 +1,88 @@ +//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 armapplicationinsights + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available insights REST API operations. +// +// Generated from API version 2021-03-08 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Insights/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-03-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go index 15e3827ec7a0..97dc31bd9e9c 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go @@ -109,6 +109,30 @@ type ComponentFeatureCapabilitiesClientGetOptions struct { // placeholder for future optional parameters } +// ComponentLinkedStorageAccountsClientCreateAndUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.CreateAndUpdate +// method. +type ComponentLinkedStorageAccountsClientCreateAndUpdateOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientDeleteOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Delete +// method. +type ComponentLinkedStorageAccountsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientGetOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Get +// method. +type ComponentLinkedStorageAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Update +// method. +type ComponentLinkedStorageAccountsClientUpdateOptions struct { + // placeholder for future optional parameters +} + // ComponentQuotaStatusClientGetOptions contains the optional parameters for the ComponentQuotaStatusClient.Get method. type ComponentQuotaStatusClientGetOptions struct { // placeholder for future optional parameters @@ -155,6 +179,16 @@ type ComponentsClientUpdateTagsOptions struct { // placeholder for future optional parameters } +// DeletedWorkbooksClientListBySubscriptionOptions contains the optional parameters for the DeletedWorkbooksClient.NewListBySubscriptionPager +// method. +type DeletedWorkbooksClientListBySubscriptionOptions struct { + // Category of workbook to return. + Category *CategoryType + + // Tags presents on each workbook returned. + Tags []string +} + // ExportConfigurationsClientCreateOptions contains the optional parameters for the ExportConfigurationsClient.Create method. type ExportConfigurationsClientCreateOptions struct { // placeholder for future optional parameters @@ -216,45 +250,13 @@ type FavoritesClientUpdateOptions struct { // placeholder for future optional parameters } -// MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate method. -type MyWorkbooksClientCreateOrUpdateOptions struct { +// LiveTokenClientGetOptions contains the optional parameters for the LiveTokenClient.Get method. +type LiveTokenClientGetOptions struct { // placeholder for future optional parameters } -// MyWorkbooksClientDeleteOptions contains the optional parameters for the MyWorkbooksClient.Delete method. -type MyWorkbooksClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MyWorkbooksClientGetOptions contains the optional parameters for the MyWorkbooksClient.Get method. -type MyWorkbooksClientGetOptions struct { - // placeholder for future optional parameters -} - -// MyWorkbooksClientListByResourceGroupOptions contains the optional parameters for the MyWorkbooksClient.NewListByResourceGroupPager -// method. -type MyWorkbooksClientListByResourceGroupOptions struct { - // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content - // for workbooks. - CanFetchContent *bool - - // Tags presents on each workbook returned. - Tags []string -} - -// MyWorkbooksClientListBySubscriptionOptions contains the optional parameters for the MyWorkbooksClient.NewListBySubscriptionPager -// method. -type MyWorkbooksClientListBySubscriptionOptions struct { - // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content - // for workbooks. - CanFetchContent *bool - - // Tags presents on each workbook returned. - Tags []string -} - -// MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. -type MyWorkbooksClientUpdateOptions struct { +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -353,9 +355,38 @@ type WorkItemConfigurationsClientUpdateItemOptions struct { // placeholder for future optional parameters } +// WorkbookTemplatesClientCreateOrUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.CreateOrUpdate +// method. +type WorkbookTemplatesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientDeleteOptions contains the optional parameters for the WorkbookTemplatesClient.Delete method. +type WorkbookTemplatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientGetOptions contains the optional parameters for the WorkbookTemplatesClient.Get method. +type WorkbookTemplatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientListByResourceGroupOptions contains the optional parameters for the WorkbookTemplatesClient.NewListByResourceGroupPager +// method. +type WorkbookTemplatesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.Update method. +type WorkbookTemplatesClientUpdateOptions struct { + // Properties that need to be specified to patch a workbook template. + WorkbookTemplateUpdateParameters *WorkbookTemplateUpdateParameters +} + // WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate method. type WorkbooksClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string } // WorkbooksClientDeleteOptions contains the optional parameters for the WorkbooksClient.Delete method. @@ -365,7 +396,9 @@ type WorkbooksClientDeleteOptions struct { // WorkbooksClientGetOptions contains the optional parameters for the WorkbooksClient.Get method. type WorkbooksClientGetOptions struct { - // placeholder for future optional parameters + // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content + // for workbooks. + CanFetchContent *bool } // WorkbooksClientListByResourceGroupOptions contains the optional parameters for the WorkbooksClient.NewListByResourceGroupPager @@ -375,11 +408,39 @@ type WorkbooksClientListByResourceGroupOptions struct { // for workbooks. CanFetchContent *bool + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string + // Tags presents on each workbook returned. Tags []string } +// WorkbooksClientListBySubscriptionOptions contains the optional parameters for the WorkbooksClient.NewListBySubscriptionPager +// method. +type WorkbooksClientListBySubscriptionOptions struct { + // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content + // for workbooks. + CanFetchContent *bool + + // Tags presents on each workbook returned. + Tags []string +} + +// WorkbooksClientRevisionGetOptions contains the optional parameters for the WorkbooksClient.RevisionGet method. +type WorkbooksClientRevisionGetOptions struct { + // placeholder for future optional parameters +} + +// WorkbooksClientRevisionsListOptions contains the optional parameters for the WorkbooksClient.NewRevisionsListPager method. +type WorkbooksClientRevisionsListOptions struct { + // placeholder for future optional parameters +} + // WorkbooksClientUpdateOptions contains the optional parameters for the WorkbooksClient.Update method. type WorkbooksClientUpdateOptions struct { - // placeholder for future optional parameters + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string + + // Properties that need to be specified to create a new workbook. + WorkbookUpdateParameters *WorkbookUpdateParameters } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go index 1d7943ba5211..c755ccf3fa66 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationsList.json func ExampleProactiveDetectionConfigurationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,11 +38,11 @@ func ExampleProactiveDetectionConfigurationsClient_List() { // 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.ComponentProactiveDetectionConfigurationArray = []*armapplicationinsights.ComponentProactiveDetectionConfiguration{ // { + // Name: to.Ptr("slowpageloadtime"), // CustomEmails: []*string{ // to.Ptr("foo@microsoft.com"), // to.Ptr("foo2@microsoft.com")}, // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), // DisplayName: to.Ptr("Slow page load time"), @@ -56,10 +56,10 @@ func ExampleProactiveDetectionConfigurationsClient_List() { // SendEmailsToSubscriptionOwners: to.Ptr(true), // }, // { + // Name: to.Ptr("slowpageloadtime"), // CustomEmails: []*string{ // }, // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), // DisplayName: to.Ptr("Slow server response time"), @@ -74,7 +74,7 @@ func ExampleProactiveDetectionConfigurationsClient_List() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationGet.json func ExampleProactiveDetectionConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,11 +93,11 @@ func ExampleProactiveDetectionConfigurationsClient_Get() { _ = 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.ComponentProactiveDetectionConfiguration = armapplicationinsights.ComponentProactiveDetectionConfiguration{ + // Name: to.Ptr("slowpageloadtime"), // CustomEmails: []*string{ // to.Ptr("foo@microsoft.com"), // to.Ptr("foo2@microsoft.com")}, // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), // DisplayName: to.Ptr("Slow page load time"), @@ -112,7 +112,7 @@ func ExampleProactiveDetectionConfigurationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationUpdate.json func ExampleProactiveDetectionConfigurationsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -124,11 +124,11 @@ func ExampleProactiveDetectionConfigurationsClient_Update() { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewProactiveDetectionConfigurationsClient().Update(ctx, "my-resource-group", "my-component", "slowpageloadtime", armapplicationinsights.ComponentProactiveDetectionConfiguration{ + Name: to.Ptr("slowpageloadtime"), CustomEmails: []*string{ to.Ptr("foo@microsoft.com"), to.Ptr("foo2@microsoft.com")}, Enabled: to.Ptr(true), - Name: to.Ptr("slowpageloadtime"), RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), DisplayName: to.Ptr("Slow page load time"), @@ -148,11 +148,11 @@ func ExampleProactiveDetectionConfigurationsClient_Update() { _ = 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.ComponentProactiveDetectionConfiguration = armapplicationinsights.ComponentProactiveDetectionConfiguration{ + // Name: to.Ptr("slowpageloadtime"), // CustomEmails: []*string{ // to.Ptr("foo@microsoft.com"), // to.Ptr("foo2@microsoft.com")}, // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), // DisplayName: to.Ptr("Slow page load time"), diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/responses.go similarity index 77% rename from sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go rename to sdk/resourcemanager/applicationinsights/armapplicationinsights/responses.go index 96c609682823..74334596b4eb 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/responses.go @@ -102,6 +102,29 @@ type ComponentFeatureCapabilitiesClientGetResponse struct { ComponentFeatureCapabilities } +// ComponentLinkedStorageAccountsClientCreateAndUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.CreateAndUpdate. +type ComponentLinkedStorageAccountsClientCreateAndUpdateResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + +// ComponentLinkedStorageAccountsClientDeleteResponse contains the response from method ComponentLinkedStorageAccountsClient.Delete. +type ComponentLinkedStorageAccountsClientDeleteResponse struct { + // placeholder for future response values +} + +// ComponentLinkedStorageAccountsClientGetResponse contains the response from method ComponentLinkedStorageAccountsClient.Get. +type ComponentLinkedStorageAccountsClientGetResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + +// ComponentLinkedStorageAccountsClientUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.Update. +type ComponentLinkedStorageAccountsClientUpdateResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + // ComponentQuotaStatusClientGetResponse contains the response from method ComponentQuotaStatusClient.Get. type ComponentQuotaStatusClientGetResponse struct { // An Application Insights component daily data volume cap status @@ -155,6 +178,12 @@ type ComponentsClientUpdateTagsResponse struct { Component } +// DeletedWorkbooksClientListBySubscriptionResponse contains the response from method DeletedWorkbooksClient.NewListBySubscriptionPager. +type DeletedWorkbooksClientListBySubscriptionResponse struct { + // Workbook list result. + DeletedWorkbooksListResult +} + // ExportConfigurationsClientCreateResponse contains the response from method ExportConfigurationsClient.Create. type ExportConfigurationsClientCreateResponse struct { // A list of Continuous Export configurations. @@ -214,39 +243,17 @@ type FavoritesClientUpdateResponse struct { ComponentFavorite } -// MyWorkbooksClientCreateOrUpdateResponse contains the response from method MyWorkbooksClient.CreateOrUpdate. -type MyWorkbooksClientCreateOrUpdateResponse struct { - // An Application Insights private workbook definition. - MyWorkbook -} - -// MyWorkbooksClientDeleteResponse contains the response from method MyWorkbooksClient.Delete. -type MyWorkbooksClientDeleteResponse struct { - // placeholder for future response values -} - -// MyWorkbooksClientGetResponse contains the response from method MyWorkbooksClient.Get. -type MyWorkbooksClientGetResponse struct { - // An Application Insights private workbook definition. - MyWorkbook -} - -// MyWorkbooksClientListByResourceGroupResponse contains the response from method MyWorkbooksClient.NewListByResourceGroupPager. -type MyWorkbooksClientListByResourceGroupResponse struct { - // Workbook list result. - MyWorkbooksListResult -} - -// MyWorkbooksClientListBySubscriptionResponse contains the response from method MyWorkbooksClient.NewListBySubscriptionPager. -type MyWorkbooksClientListBySubscriptionResponse struct { - // Workbook list result. - MyWorkbooksListResult +// LiveTokenClientGetResponse contains the response from method LiveTokenClient.Get. +type LiveTokenClientGetResponse struct { + // The response to a live token query. + LiveTokenResponse } -// MyWorkbooksClientUpdateResponse contains the response from method MyWorkbooksClient.Update. -type MyWorkbooksClientUpdateResponse struct { - // An Application Insights private workbook definition. - MyWorkbook +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // Result of the request to list Azure Workbooks operations. It contains a list of operations and a URL link to get the next + // set of results. + OperationListResult } // ProactiveDetectionConfigurationsClientGetResponse contains the response from method ProactiveDetectionConfigurationsClient.Get. @@ -275,7 +282,7 @@ type WebTestLocationsClientListResponse struct { // WebTestsClientCreateOrUpdateResponse contains the response from method WebTestsClient.CreateOrUpdate. type WebTestsClientCreateOrUpdateResponse struct { - // An Application Insights web test definition. + // An Application Insights WebTest definition. WebTest } @@ -286,31 +293,31 @@ type WebTestsClientDeleteResponse struct { // WebTestsClientGetResponse contains the response from method WebTestsClient.Get. type WebTestsClientGetResponse struct { - // An Application Insights web test definition. + // An Application Insights WebTest definition. WebTest } // WebTestsClientListByComponentResponse contains the response from method WebTestsClient.NewListByComponentPager. type WebTestsClientListByComponentResponse struct { - // A list of 0 or more Application Insights web test definitions. + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientListByResourceGroupResponse contains the response from method WebTestsClient.NewListByResourceGroupPager. type WebTestsClientListByResourceGroupResponse struct { - // A list of 0 or more Application Insights web test definitions. + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientListResponse contains the response from method WebTestsClient.NewListPager. type WebTestsClientListResponse struct { - // A list of 0 or more Application Insights web test definitions. + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientUpdateTagsResponse contains the response from method WebTestsClient.UpdateTags. type WebTestsClientUpdateTagsResponse struct { - // An Application Insights web test definition. + // An Application Insights WebTest definition. WebTest } @@ -349,9 +356,38 @@ type WorkItemConfigurationsClientUpdateItemResponse struct { WorkItemConfiguration } +// WorkbookTemplatesClientCreateOrUpdateResponse contains the response from method WorkbookTemplatesClient.CreateOrUpdate. +type WorkbookTemplatesClientCreateOrUpdateResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + +// WorkbookTemplatesClientDeleteResponse contains the response from method WorkbookTemplatesClient.Delete. +type WorkbookTemplatesClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkbookTemplatesClientGetResponse contains the response from method WorkbookTemplatesClient.Get. +type WorkbookTemplatesClientGetResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + +// WorkbookTemplatesClientListByResourceGroupResponse contains the response from method WorkbookTemplatesClient.NewListByResourceGroupPager. +type WorkbookTemplatesClientListByResourceGroupResponse struct { + // WorkbookTemplate list result. + WorkbookTemplatesListResult +} + +// WorkbookTemplatesClientUpdateResponse contains the response from method WorkbookTemplatesClient.Update. +type WorkbookTemplatesClientUpdateResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + // WorkbooksClientCreateOrUpdateResponse contains the response from method WorkbooksClient.CreateOrUpdate. type WorkbooksClientCreateOrUpdateResponse struct { - // An Application Insights workbook definition. + // A workbook definition. Workbook } @@ -362,7 +398,7 @@ type WorkbooksClientDeleteResponse struct { // WorkbooksClientGetResponse contains the response from method WorkbooksClient.Get. type WorkbooksClientGetResponse struct { - // An Application Insights workbook definition. + // A workbook definition. Workbook } @@ -372,8 +408,26 @@ type WorkbooksClientListByResourceGroupResponse struct { WorkbooksListResult } +// WorkbooksClientListBySubscriptionResponse contains the response from method WorkbooksClient.NewListBySubscriptionPager. +type WorkbooksClientListBySubscriptionResponse struct { + // Workbook list result. + WorkbooksListResult +} + +// WorkbooksClientRevisionGetResponse contains the response from method WorkbooksClient.RevisionGet. +type WorkbooksClientRevisionGetResponse struct { + // A workbook definition. + Workbook +} + +// WorkbooksClientRevisionsListResponse contains the response from method WorkbooksClient.NewRevisionsListPager. +type WorkbooksClientRevisionsListResponse struct { + // Workbook list result. + WorkbooksListResult +} + // WorkbooksClientUpdateResponse contains the response from method WorkbooksClient.Update. type WorkbooksClientUpdateResponse struct { - // An Application Insights workbook definition. + // A workbook definition. Workbook } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go index a346a2411a85..72eedcd2428f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go index 2c684fda1fe1..59328c5b7904 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestLocationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestLocationsList.json func ExampleWebTestLocationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go index 5c0275e37fa8..d2be373abbae 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go @@ -46,9 +46,9 @@ func NewWebTestsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates an Application Insights web test definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - webTestDefinition - Properties that need to be specified to create or update an Application Insights web test definition. // - options - WebTestsClientCreateOrUpdateOptions contains the optional parameters for the WebTestsClient.CreateOrUpdate method. func (client *WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest, options *WebTestsClientCreateOrUpdateOptions) (WebTestsClientCreateOrUpdateResponse, error) { @@ -93,7 +93,7 @@ func (client *WebTestsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webTestDefinition); err != nil { @@ -114,9 +114,9 @@ func (client *WebTestsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes an Application Insights web test. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - options - WebTestsClientDeleteOptions contains the optional parameters for the WebTestsClient.Delete method. func (client *WebTestsClient) Delete(ctx context.Context, resourceGroupName string, webTestName string, options *WebTestsClientDeleteOptions) (WebTestsClientDeleteResponse, error) { var err error @@ -159,7 +159,7 @@ func (client *WebTestsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -167,9 +167,9 @@ func (client *WebTestsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a specific Application Insights web test definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - options - WebTestsClientGetOptions contains the optional parameters for the WebTestsClient.Get method. func (client *WebTestsClient) Get(ctx context.Context, resourceGroupName string, webTestName string, options *WebTestsClientGetOptions) (WebTestsClientGetResponse, error) { var err error @@ -213,7 +213,7 @@ func (client *WebTestsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,9 +228,9 @@ func (client *WebTestsClient) getHandleResponse(resp *http.Response) (WebTestsCl return result, nil } -// NewListPager - Get all Application Insights web test alerts definitions within a subscription. +// NewListPager - Get all Application Insights web test definitions for the specified subscription. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - options - WebTestsClientListOptions contains the optional parameters for the WebTestsClient.NewListPager method. func (client *WebTestsClient) NewListPager(options *WebTestsClientListOptions) *runtime.Pager[WebTestsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[WebTestsClientListResponse]{ @@ -267,7 +267,7 @@ func (client *WebTestsClient) listCreateRequest(ctx context.Context, options *We return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +284,7 @@ func (client *WebTestsClient) listHandleResponse(resp *http.Response) (WebTestsC // NewListByComponentPager - Get all Application Insights web tests defined for the specified component. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - componentName - The name of the Application Insights component resource. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - WebTestsClientListByComponentOptions contains the optional parameters for the WebTestsClient.NewListByComponentPager @@ -332,7 +332,7 @@ func (client *WebTestsClient) listByComponentCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,9 +347,9 @@ func (client *WebTestsClient) listByComponentHandleResponse(resp *http.Response) return result, nil } -// NewListByResourceGroupPager - Get all Application Insights web tests defined within a specified resource group. +// NewListByResourceGroupPager - Get all Application Insights web tests defined for the specified resource group. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - WebTestsClientListByResourceGroupOptions contains the optional parameters for the WebTestsClient.NewListByResourceGroupPager // method. @@ -392,7 +392,7 @@ func (client *WebTestsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -407,13 +407,13 @@ func (client *WebTestsClient) listByResourceGroupHandleResponse(resp *http.Respo return result, nil } -// UpdateTags - Creates or updates an Application Insights web test definition. +// UpdateTags - Updates the tags associated with an Application Insights web test. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. -// - webTestTags - Updated tag information to set into the web test instance. +// - webTestName - The name of the Application Insights WebTest resource. +// - webTestTags - Updated tag information to associate with the web test resource. // - options - WebTestsClientUpdateTagsOptions contains the optional parameters for the WebTestsClient.UpdateTags method. func (client *WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource, options *WebTestsClientUpdateTagsOptions) (WebTestsClientUpdateTagsResponse, error) { var err error @@ -457,7 +457,7 @@ func (client *WebTestsClient) updateTagsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webTestTags); err != nil { diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go index f1cb6c714595..18d3a77f4517 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestListByResourceGroup.json func ExampleWebTestsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -49,7 +49,6 @@ func ExampleWebTestsClient_NewListByResourceGroupPager() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -104,7 +103,7 @@ func ExampleWebTestsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestGet.json func ExampleWebTestsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,7 +128,6 @@ func ExampleWebTestsClient_Get() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-test-resources/providers/Microsoft.Insights/components/mytester": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-test-resources/providers/Microsoft.Web/sites/mytester": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -156,7 +154,7 @@ func ExampleWebTestsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreate.json func ExampleWebTestsClient_CreateOrUpdate_webTestCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -201,7 +199,6 @@ func ExampleWebTestsClient_CreateOrUpdate_webTestCreate() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -225,7 +222,103 @@ func ExampleWebTestsClient_CreateOrUpdate_webTestCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreateStandard.json +func ExampleWebTestsClient_CreateOrUpdate_webTestCreateStandard() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWebTestsClient().CreateOrUpdate(ctx, "my-resource-group", "my-webtest-my-component", armapplicationinsights.WebTest{ + Location: to.Ptr("South Central US"), + Properties: &armapplicationinsights.WebTestProperties{ + Description: to.Ptr("Ping web test alert for mytestwebapp"), + Enabled: to.Ptr(true), + Frequency: to.Ptr[int32](900), + WebTestKind: to.Ptr(armapplicationinsights.WebTestKindStandard), + Locations: []*armapplicationinsights.WebTestGeolocation{ + { + Location: to.Ptr("us-fl-mia-edge"), + }}, + WebTestName: to.Ptr("my-webtest-my-component"), + Request: &armapplicationinsights.WebTestPropertiesRequest{ + Headers: []*armapplicationinsights.HeaderField{ + { + HeaderFieldName: to.Ptr("Content-Language"), + HeaderFieldValue: to.Ptr("de-DE"), + }, + { + HeaderFieldName: to.Ptr("Accept-Language"), + HeaderFieldValue: to.Ptr("de-DE"), + }}, + HTTPVerb: to.Ptr("POST"), + RequestBody: to.Ptr("SGVsbG8gd29ybGQ="), + RequestURL: to.Ptr("https://bing.com"), + }, + RetryEnabled: to.Ptr(true), + SyntheticMonitorID: to.Ptr("my-webtest-my-component"), + Timeout: to.Ptr[int32](120), + ValidationRules: &armapplicationinsights.WebTestPropertiesValidationRules{ + SSLCertRemainingLifetimeCheck: to.Ptr[int32](100), + SSLCheck: to.Ptr(true), + }, + }, + }, 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.WebTest = armapplicationinsights.WebTest{ + // Name: to.Ptr("my-webtest-my-component"), + // Type: to.Ptr("Microsoft.Insights/webtests"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), + // Location: to.Ptr("southcentralus"), + // Tags: map[string]*string{ + // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), + // }, + // Properties: &armapplicationinsights.WebTestProperties{ + // Description: to.Ptr("Ping web test alert for mytestwebapp"), + // Enabled: to.Ptr(true), + // Frequency: to.Ptr[int32](900), + // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindStandard), + // Locations: []*armapplicationinsights.WebTestGeolocation{ + // { + // Location: to.Ptr("us-fl-mia-edge"), + // }}, + // WebTestName: to.Ptr("my-webtest-my-component"), + // Request: &armapplicationinsights.WebTestPropertiesRequest{ + // Headers: []*armapplicationinsights.HeaderField{ + // { + // HeaderFieldName: to.Ptr("Content-Language"), + // HeaderFieldValue: to.Ptr("de-DE"), + // }, + // { + // HeaderFieldName: to.Ptr("Accept-Language"), + // HeaderFieldValue: to.Ptr("de-DE"), + // }}, + // HTTPVerb: to.Ptr("POST"), + // RequestBody: to.Ptr("SGVsbG8gd29ybGQ="), + // RequestURL: to.Ptr("https://bing.com"), + // }, + // RetryEnabled: to.Ptr(true), + // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), + // Timeout: to.Ptr[int32](120), + // ValidationRules: &armapplicationinsights.WebTestPropertiesValidationRules{ + // SSLCertRemainingLifetimeCheck: to.Ptr[int32](100), + // SSLCheck: to.Ptr(true), + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdate.json func ExampleWebTestsClient_CreateOrUpdate_webTestUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -270,7 +363,6 @@ func ExampleWebTestsClient_CreateOrUpdate_webTestUpdate() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -297,7 +389,7 @@ func ExampleWebTestsClient_CreateOrUpdate_webTestUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdateTagsOnly.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdateTagsOnly.json func ExampleWebTestsClient_UpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -314,7 +406,6 @@ func ExampleWebTestsClient_UpdateTags() { "CustomField-01": to.Ptr("This is a random value"), "SystemType": to.Ptr("A08"), "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), }, }, nil) if err != nil { @@ -333,7 +424,6 @@ func ExampleWebTestsClient_UpdateTags() { // "CustomField-01": to.Ptr("This is a random value"), // "SystemType": to.Ptr("A08"), // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -360,7 +450,7 @@ func ExampleWebTestsClient_UpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestDelete.json func ExampleWebTestsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -377,7 +467,7 @@ func ExampleWebTestsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestList.json func ExampleWebTestsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -408,7 +498,6 @@ func ExampleWebTestsClient_NewListPager() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ @@ -459,7 +548,7 @@ func ExampleWebTestsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByComponent.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestListByComponent.json func ExampleWebTestsClient_NewListByComponentPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -490,7 +579,6 @@ func ExampleWebTestsClient_NewListByComponentPager() { // Location: to.Ptr("southcentralus"), // Tags: map[string]*string{ // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), // }, // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), // Properties: &armapplicationinsights.WebTestProperties{ diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go index 1930702876f6..b988219f2726 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go @@ -47,9 +47,9 @@ func NewWorkbooksClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Create a new workbook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - workbookProperties - Properties that need to be specified to create a new workbook. // - options - WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate // method. @@ -77,7 +77,7 @@ func (client *WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroup // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *WorkbooksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -95,7 +95,10 @@ func (client *WorkbooksClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { @@ -116,9 +119,9 @@ func (client *WorkbooksClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete a workbook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientDeleteOptions contains the optional parameters for the WorkbooksClient.Delete method. func (client *WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientDeleteOptions) (WorkbooksClientDeleteResponse, error) { var err error @@ -134,7 +137,7 @@ func (client *WorkbooksClient) Delete(ctx context.Context, resourceGroupName str if err != nil { return WorkbooksClientDeleteResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusCreated, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return WorkbooksClientDeleteResponse{}, err } @@ -143,7 +146,7 @@ func (client *WorkbooksClient) Delete(ctx context.Context, resourceGroupName str // deleteCreateRequest creates the Delete request. func (client *WorkbooksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -161,7 +164,7 @@ func (client *WorkbooksClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,9 +173,9 @@ func (client *WorkbooksClient) deleteCreateRequest(ctx context.Context, resource // Get - Get a single workbook by its resourceName. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientGetOptions contains the optional parameters for the WorkbooksClient.Get method. func (client *WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientGetOptions) (WorkbooksClientGetResponse, error) { var err error @@ -198,7 +201,7 @@ func (client *WorkbooksClient) Get(ctx context.Context, resourceGroupName string // getCreateRequest creates the Get request. func (client *WorkbooksClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -216,7 +219,10 @@ func (client *WorkbooksClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +239,7 @@ func (client *WorkbooksClient) getHandleResponse(resp *http.Response) (Workbooks // NewListByResourceGroupPager - Get all Workbooks defined within a specified resource group and category. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - category - Category of workbook to return. // - options - WorkbooksClientListByResourceGroupOptions contains the optional parameters for the WorkbooksClient.NewListByResourceGroupPager @@ -241,21 +247,20 @@ func (client *WorkbooksClient) getHandleResponse(resp *http.Response) (Workbooks func (client *WorkbooksClient) NewListByResourceGroupPager(resourceGroupName string, category CategoryType, options *WorkbooksClientListByResourceGroupOptions) *runtime.Pager[WorkbooksClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[WorkbooksClientListByResourceGroupResponse]{ More: func(page WorkbooksClientListByResourceGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *WorkbooksClientListByResourceGroupResponse) (WorkbooksClientListByResourceGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkbooksClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) - if err != nil { - return WorkbooksClientListByResourceGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) + }, nil) if err != nil { return WorkbooksClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkbooksClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -264,7 +269,7 @@ func (client *WorkbooksClient) NewListByResourceGroupPager(resourceGroupName str // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *WorkbooksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, category CategoryType, options *WorkbooksClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -278,14 +283,17 @@ func (client *WorkbooksClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } reqQP.Set("category", string(category)) + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } if options != nil && options.Tags != nil { reqQP.Set("tags", strings.Join(options.Tags, ",")) } - if options != nil && options.CanFetchContent != nil { - reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) - } - reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,21 +308,217 @@ func (client *WorkbooksClient) listByResourceGroupHandleResponse(resp *http.Resp return result, nil } +// NewListBySubscriptionPager - Get all Workbooks defined within a specified subscription and category. +// +// Generated from API version 2023-06-01 +// - category - Category of workbook to return. +// - options - WorkbooksClientListBySubscriptionOptions contains the optional parameters for the WorkbooksClient.NewListBySubscriptionPager +// method. +func (client *WorkbooksClient) NewListBySubscriptionPager(category CategoryType, options *WorkbooksClientListBySubscriptionOptions) *runtime.Pager[WorkbooksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbooksClientListBySubscriptionResponse]{ + More: func(page WorkbooksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkbooksClientListBySubscriptionResponse) (WorkbooksClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkbooksClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, category, options) + }, nil) + if err != nil { + return WorkbooksClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *WorkbooksClient) listBySubscriptionCreateRequest(ctx context.Context, category CategoryType, options *WorkbooksClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } + reqQP.Set("category", string(category)) + if options != nil && options.Tags != nil { + reqQP.Set("tags", strings.Join(options.Tags, ",")) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *WorkbooksClient) listBySubscriptionHandleResponse(resp *http.Response) (WorkbooksClientListBySubscriptionResponse, error) { + result := WorkbooksClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbooksListResult); err != nil { + return WorkbooksClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// RevisionGet - Get a single workbook revision defined by its revisionId. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the workbook resource. The value must be an UUID. +// - revisionID - The id of the workbook's revision. +// - options - WorkbooksClientRevisionGetOptions contains the optional parameters for the WorkbooksClient.RevisionGet method. +func (client *WorkbooksClient) RevisionGet(ctx context.Context, resourceGroupName string, resourceName string, revisionID string, options *WorkbooksClientRevisionGetOptions) (WorkbooksClientRevisionGetResponse, error) { + var err error + const operationName = "WorkbooksClient.RevisionGet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revisionGetCreateRequest(ctx, resourceGroupName, resourceName, revisionID, options) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientRevisionGetResponse{}, err + } + resp, err := client.revisionGetHandleResponse(httpResp) + return resp, err +} + +// revisionGetCreateRequest creates the RevisionGet request. +func (client *WorkbooksClient) revisionGetCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, revisionID string, options *WorkbooksClientRevisionGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if revisionID == "" { + return nil, errors.New("parameter revisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionId}", url.PathEscape(revisionID)) + 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-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// revisionGetHandleResponse handles the RevisionGet response. +func (client *WorkbooksClient) revisionGetHandleResponse(resp *http.Response) (WorkbooksClientRevisionGetResponse, error) { + result := WorkbooksClientRevisionGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Workbook); err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + return result, nil +} + +// NewRevisionsListPager - Get the revisions for the workbook defined by its resourceName. +// +// Generated from API version 2023-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the workbook resource. The value must be an UUID. +// - options - WorkbooksClientRevisionsListOptions contains the optional parameters for the WorkbooksClient.NewRevisionsListPager +// method. +func (client *WorkbooksClient) NewRevisionsListPager(resourceGroupName string, resourceName string, options *WorkbooksClientRevisionsListOptions) *runtime.Pager[WorkbooksClientRevisionsListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbooksClientRevisionsListResponse]{ + More: func(page WorkbooksClientRevisionsListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkbooksClientRevisionsListResponse) (WorkbooksClientRevisionsListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkbooksClient.NewRevisionsListPager") + 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.revisionsListCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return WorkbooksClientRevisionsListResponse{}, err + } + return client.revisionsListHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// revisionsListCreateRequest creates the RevisionsList request. +func (client *WorkbooksClient) revisionsListCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientRevisionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// revisionsListHandleResponse handles the RevisionsList response. +func (client *WorkbooksClient) revisionsListHandleResponse(resp *http.Response) (WorkbooksClientRevisionsListResponse, error) { + result := WorkbooksClientRevisionsListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbooksListResult); err != nil { + return WorkbooksClientRevisionsListResponse{}, err + } + return result, nil +} + // Update - Updates a workbook that has already been added. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - workbookProperties - Properties that need to be specified to create a new workbook. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientUpdateOptions contains the optional parameters for the WorkbooksClient.Update method. -func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientUpdateOptions) (WorkbooksClientUpdateResponse, error) { +func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientUpdateOptions) (WorkbooksClientUpdateResponse, error) { var err error const operationName = "WorkbooksClient.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, resourceName, workbookProperties, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkbooksClientUpdateResponse{}, err } @@ -322,7 +526,7 @@ func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName str if err != nil { return WorkbooksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return WorkbooksClientUpdateResponse{}, err } @@ -331,8 +535,8 @@ func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName str } // updateCreateRequest creates the Update request. -func (client *WorkbooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}" +func (client *WorkbooksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -350,11 +554,17 @@ func (client *WorkbooksClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { - return nil, err + if options != nil && options.WorkbookUpdateParameters != nil { + if err := runtime.MarshalAsJSON(req, *options.WorkbookUpdateParameters); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go index 3aa0f450ae01..5be4c2d548fd 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go @@ -15,11 +15,114 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbooksList.json -func ExampleWorkbooksClient_NewListByResourceGroupPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksList2.json +func ExampleWorkbooksClient_NewListBySubscriptionPager_workbooksList2() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWorkbooksClient().NewListBySubscriptionPager(armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.WorkbooksClientListBySubscriptionOptions{Tags: []string{}, + CanFetchContent: 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.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ + // Value: []*armapplicationinsights.Workbook{ + // }, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksListSub.json +func ExampleWorkbooksClient_NewListBySubscriptionPager_workbooksListSub() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWorkbooksClient().NewListBySubscriptionPager(armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.WorkbooksClientListBySubscriptionOptions{Tags: []string{}, + CanFetchContent: 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.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ + // Value: []*armapplicationinsights.Workbook{ + // { + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 1"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:00:26.422Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }, + // { + // Name: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 2"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bc"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:00:26.422Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksList.json +func ExampleWorkbooksClient_NewListByResourceGroupPager_workbooksList() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -30,6 +133,7 @@ func ExampleWorkbooksClient_NewListByResourceGroupPager() { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewWorkbooksClient().NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.WorkbooksClientListByResourceGroupOptions{Tags: []string{}, + SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), CanFetchContent: nil, }) for pager.More() { @@ -43,12 +147,55 @@ func ExampleWorkbooksClient_NewListByResourceGroupPager() { } // 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.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ + // Value: []*armapplicationinsights.Workbook{ + // { + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 1"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-04T09:07:17.735Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }, + // { + // Name: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 2"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bc"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-04T09:07:17.735Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookGet.json -func ExampleWorkbooksClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksManagedList.json +func ExampleWorkbooksClient_NewListByResourceGroupPager_workbooksManagedList() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -58,7 +205,90 @@ func ExampleWorkbooksClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) + pager := clientFactory.NewWorkbooksClient().NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.WorkbooksClientListByResourceGroupOptions{Tags: []string{}, + SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac119r124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + CanFetchContent: 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.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ + // Value: []*armapplicationinsights.Workbook{ + // { + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Identity: &armapplicationinsights.WorkbookResourceIdentity{ + // Type: to.Ptr(armapplicationinsights.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armapplicationinsights.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": &armapplicationinsights.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 1"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac119r124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // StorageURI: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac119r124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:00:26.422Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }, + // { + // Name: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1cdd5722"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/c0deea5e-3344-40f2-96f8-6f8e1cdd5722"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 2"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bc"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac119r124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T21:00:26.422Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookGet.json +func ExampleWorkbooksClient_Get_workbookGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", &armapplicationinsights.WorkbooksClientGetOptions{CanFetchContent: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,27 +296,116 @@ func ExampleWorkbooksClient_Get() { _ = 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.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/microsoft.insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), // Location: to.Ptr("westus"), // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), // Properties: &armapplicationinsights.WorkbookProperties{ - // Name: to.Ptr("My New Workbook"), + // Description: to.Ptr("Sample workbook"), // Category: to.Ptr("workbook"), - // SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), + // DisplayName: to.Ptr("Sample workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-24T06:56:31.630Z"); return t}()), // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), + // Version: to.Ptr("Notebook/1.0"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookGet1.json +func ExampleWorkbooksClient_Get_workbookGet1() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", &armapplicationinsights.WorkbooksClientGetOptions{CanFetchContent: 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.Workbook = armapplicationinsights.Workbook{ + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/microsoft.insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Sample workbook"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-24T06:56:31.630Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedGet.json +func ExampleWorkbooksClient_Get_workbookManagedGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", &armapplicationinsights.WorkbooksClientGetOptions{CanFetchContent: 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.Workbook = armapplicationinsights.Workbook{ + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Identity: &armapplicationinsights.WorkbookResourceIdentity{ + // Type: to.Ptr(armapplicationinsights.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armapplicationinsights.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": &armapplicationinsights.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("azuremon"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"testing1\"},\"showPin\":false,\"name\":\"text - 0\"}],\"isLocked\":true,\"fallbackResourceIds\":[\"Azure Monitor\"]}"), + // SourceID: to.Ptr("azure monitor"), + // StorageURI: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-04T09:07:17.735Z"); return t}()), + // UserID: to.Ptr("51d1409c-d725-4550-ac03-98c0bef9ef07"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookDelete.json func ExampleWorkbooksClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,8 +422,8 @@ func ExampleWorkbooksClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookAdd.json -func ExampleWorkbooksClient_CreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookAdd.json +func ExampleWorkbooksClient_CreateOrUpdate_workbookAdd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -114,24 +433,20 @@ func ExampleWorkbooksClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-8bee-4d3b-a059-9be8dac93960", armapplicationinsights.Workbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - Location: to.Ptr("west us"), + res, err := clientFactory.NewWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.Workbook{ + Location: to.Ptr("westus"), Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), + "TagSample01": to.Ptr("sample01"), + "TagSample02": to.Ptr("sample02"), }, + Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), Properties: &armapplicationinsights.WorkbookProperties{ - Name: to.Ptr("Blah Blah Blah"), - Category: to.Ptr("workbook"), - SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - UserID: to.Ptr("userId"), - WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), + Description: to.Ptr("Sample workbook"), + Category: to.Ptr("workbook"), + DisplayName: to.Ptr("Sample workbook"), + SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), }, - }, nil) + }, &armapplicationinsights.WorkbooksClientCreateOrUpdateOptions{SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -139,28 +454,31 @@ func ExampleWorkbooksClient_CreateOrUpdate() { _ = 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.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/microsoft.insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), // Location: to.Ptr("westus"), // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), // Properties: &armapplicationinsights.WorkbookProperties{ - // Name: to.Ptr("Blah Blah Blah"), + // Description: to.Ptr("Sample workbook"), // Category: to.Ptr("workbook"), - // SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), + // DisplayName: to.Ptr("Sample workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-24T06:56:31.630Z"); return t}()), // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), + // Version: to.Ptr("Notebook/1.0"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookUpdate.json -func ExampleWorkbooksClient_Update() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedAdd.json +func ExampleWorkbooksClient_CreateOrUpdate_workbookManagedAdd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -170,23 +488,239 @@ func ExampleWorkbooksClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.Workbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - Location: to.Ptr("west us"), - Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), + res, err := clientFactory.NewWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.Workbook{ + Location: to.Ptr("westus"), + Identity: &armapplicationinsights.WorkbookResourceIdentity{ + Type: to.Ptr(armapplicationinsights.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armapplicationinsights.UserAssignedIdentity{ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": {}, + }, }, + Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), Properties: &armapplicationinsights.WorkbookProperties{ - Name: to.Ptr("Blah Blah Blah"), + Description: to.Ptr("Sample workbook"), Category: to.Ptr("workbook"), - SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - UserID: to.Ptr("userId"), - Version: to.Ptr("ME"), - WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), + DisplayName: to.Ptr("Sample workbook"), + SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"test\"},\"name\":\"text - 0\"}],\"isLocked\":false,\"fallbackResourceIds\":[\"/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group\"]}"), + StorageURI: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer"), + Version: to.Ptr("Notebook/1.0"), }, - }, nil) + }, &armapplicationinsights.WorkbooksClientCreateOrUpdateOptions{SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group")}) + 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.Workbook = armapplicationinsights.Workbook{ + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Identity: &armapplicationinsights.WorkbookResourceIdentity{ + // Type: to.Ptr(armapplicationinsights.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armapplicationinsights.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": &armapplicationinsights.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Sample workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[],\"isLocked\":false,\"fallbackResourceIds\":[\"/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/test-ws\"]}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group"), + // StorageURI: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:00:26.422Z"); return t}()), + // UserID: to.Ptr("70d90f65-8a70-4e42-b8d5-86gv25e0a90f"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedUpdate.json +func ExampleWorkbooksClient_Update_workbookManagedUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", &armapplicationinsights.WorkbooksClientUpdateOptions{SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group"), + WorkbookUpdateParameters: 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.Workbook = armapplicationinsights.Workbook{ + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // "hidden-title": to.Ptr("Sample workbook"), + // }, + // Identity: &armapplicationinsights.WorkbookResourceIdentity{ + // Type: to.Ptr(armapplicationinsights.ManagedServiceIdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armapplicationinsights.UserAssignedIdentity{ + // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": &armapplicationinsights.UserAssignedIdentity{ + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Sample workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"test\"},\"name\":\"text - 0\"}],\"isLocked\":false,\"fallbackResourceIds\":[\"/subscriptions/8980832b-9589-4ac2-b322-a6ae6a97f02b/resourceGroups/my-resource-group\"]}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group"), + // StorageURI: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:15:08.187Z"); return t}()), + // UserID: to.Ptr("70d90f65-8a70-4e42-b8d5-863725e0a90f"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookUpdate.json +func ExampleWorkbooksClient_Update_workbookUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", &armapplicationinsights.WorkbooksClientUpdateOptions{SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + WorkbookUpdateParameters: 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.Workbook = armapplicationinsights.Workbook{ + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("Sample workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // SourceID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/MyApp"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-20T22:00:26.422Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookRevisionsList.json +func ExampleWorkbooksClient_NewRevisionsListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWorkbooksClient().NewRevisionsListPager("my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", 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.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ + // Value: []*armapplicationinsights.Workbook{ + // { + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 1"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1ab"), + // SourceID: to.Ptr("Azure Monitor"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-04T09:07:17.735Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }, + // { + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), + // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), + // Properties: &armapplicationinsights.WorkbookProperties{ + // Description: to.Ptr("Sample workbook"), + // Category: to.Ptr("workbook"), + // DisplayName: to.Ptr("My Workbook 2"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1bb"), + // SourceID: to.Ptr("Azure Monitor"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-04T09:07:17.735Z"); return t}()), + // UserID: to.Ptr("userId"), + // Version: to.Ptr("Notebook/1.0"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookRevisionGet.json +func ExampleWorkbooksClient_RevisionGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbooksClient().RevisionGet(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", "1e2f8435b98248febee70c64ac22e1ab", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -194,22 +728,24 @@ func ExampleWorkbooksClient_Update() { _ = 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.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), + // Name: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), + // Type: to.Ptr("Microsoft.Insights/workbooks"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourcegroups/my-resource-group/providers/Microsoft.Insights/workbooks/deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), // Location: to.Ptr("westus"), // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), + // "TagSample01": to.Ptr("sample01"), + // "TagSample02": to.Ptr("sample02"), // }, + // Kind: to.Ptr(armapplicationinsights.WorkbookSharedTypeKindShared), // Properties: &armapplicationinsights.WorkbookProperties{ - // Name: to.Ptr("Blah Blah Blah"), + // Description: to.Ptr("Sample workbook"), // Category: to.Ptr("workbook"), - // SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), + // DisplayName: to.Ptr("My New Workbook"), + // Revision: to.Ptr("1e2f8435b98248febee70c64ac22e1ab"), // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), + // TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-04T09:07:17.735Z"); return t}()), // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), + // Version: to.Ptr("Notebook/1.0"), // }, // } } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go new file mode 100644 index 000000000000..c50d14b66dc7 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go @@ -0,0 +1,364 @@ +//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 armapplicationinsights + +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" +) + +// WorkbookTemplatesClient contains the methods for the WorkbookTemplates group. +// Don't use this type directly, use NewWorkbookTemplatesClient() instead. +type WorkbookTemplatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkbookTemplatesClient creates a new instance of WorkbookTemplatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkbookTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkbookTemplatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkbookTemplatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a new workbook template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - workbookTemplateProperties - Properties that need to be specified to create a new workbook. +// - options - WorkbookTemplatesClientCreateOrUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.CreateOrUpdate +// method. +func (client *WorkbookTemplatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate, options *WorkbookTemplatesClientCreateOrUpdateOptions) (WorkbookTemplatesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "WorkbookTemplatesClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookTemplateProperties, options) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkbookTemplatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate, options *WorkbookTemplatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, workbookTemplateProperties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkbookTemplatesClient) createOrUpdateHandleResponse(resp *http.Response) (WorkbookTemplatesClientCreateOrUpdateResponse, error) { + result := WorkbookTemplatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a workbook template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientDeleteOptions contains the optional parameters for the WorkbookTemplatesClient.Delete +// method. +func (client *WorkbookTemplatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientDeleteOptions) (WorkbookTemplatesClientDeleteResponse, error) { + var err error + const operationName = "WorkbookTemplatesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientDeleteResponse{}, err + } + return WorkbookTemplatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkbookTemplatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a single workbook template by its resourceName. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientGetOptions contains the optional parameters for the WorkbookTemplatesClient.Get method. +func (client *WorkbookTemplatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientGetOptions) (WorkbookTemplatesClientGetResponse, error) { + var err error + const operationName = "WorkbookTemplatesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WorkbookTemplatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkbookTemplatesClient) getHandleResponse(resp *http.Response) (WorkbookTemplatesClientGetResponse, error) { + result := WorkbookTemplatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all Workbook templates defined within a specified resource group. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - WorkbookTemplatesClientListByResourceGroupOptions contains the optional parameters for the WorkbookTemplatesClient.NewListByResourceGroupPager +// method. +func (client *WorkbookTemplatesClient) NewListByResourceGroupPager(resourceGroupName string, options *WorkbookTemplatesClientListByResourceGroupOptions) *runtime.Pager[WorkbookTemplatesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbookTemplatesClientListByResourceGroupResponse]{ + More: func(page WorkbookTemplatesClientListByResourceGroupResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *WorkbookTemplatesClientListByResourceGroupResponse) (WorkbookTemplatesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkbookTemplatesClient.NewListByResourceGroupPager") + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbookTemplatesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *WorkbookTemplatesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WorkbookTemplatesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *WorkbookTemplatesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkbookTemplatesClientListByResourceGroupResponse, error) { + result := WorkbookTemplatesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplatesListResult); err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Updates a workbook template that has already been added. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.Update +// method. +func (client *WorkbookTemplatesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientUpdateOptions) (WorkbookTemplatesClientUpdateResponse, error) { + var err error + const operationName = "WorkbookTemplatesClient.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, resourceName, options) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *WorkbookTemplatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.WorkbookTemplateUpdateParameters != nil { + if err := runtime.MarshalAsJSON(req, *options.WorkbookTemplateUpdateParameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *WorkbookTemplatesClient) updateHandleResponse(resp *http.Response) (WorkbookTemplatesClientUpdateResponse, error) { + result := WorkbookTemplatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client_example_test.go new file mode 100644 index 000000000000..9cc4c397a126 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client_example_test.go @@ -0,0 +1,298 @@ +//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 armapplicationinsights_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/applicationinsights/armapplicationinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplatesList.json +func ExampleWorkbookTemplatesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWorkbookTemplatesClient().NewListByResourceGroupPager("my-resource-group", 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.WorkbookTemplatesListResult = armapplicationinsights.WorkbookTemplatesListResult{ + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateGet.json +func ExampleWorkbookTemplatesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbookTemplatesClient().Get(ctx, "my-resource-group", "my-resource-name", 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.WorkbookTemplate = armapplicationinsights.WorkbookTemplate{ + // Name: to.Ptr("my-resource-name"), + // Type: to.Ptr("microsoft.insights/workbooktemplate"), + // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/microsoft.insights/workbooktemplates/my-resource-name"), + // Location: to.Ptr("westus"), + // Properties: &armapplicationinsights.WorkbookTemplateProperties{ + // Author: to.Ptr("Contoso"), + // Galleries: []*armapplicationinsights.WorkbookTemplateGallery{ + // { + // Name: to.Ptr("Simple Template"), + // Type: to.Ptr("tsg"), + // Category: to.Ptr("Failures"), + // Order: to.Ptr[int32](100), + // ResourceType: to.Ptr("microsoft.insights/components"), + // }}, + // Priority: to.Ptr[int32](1), + // TemplateData: map[string]any{ + // "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", + // "items":[]any{ + // map[string]any{ + // "name": "text - 2", + // "type": float64(1), + // "content":map[string]any{ + // "json": "## New workbook\n---\n\nWelcome to your new workbook. This area will display text formatted as markdown.\n\n\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.", + // }, + // }, + // map[string]any{ + // "name": "query - 2", + // "type": float64(3), + // "content":map[string]any{ + // "exportToExcelOptions": "visible", + // "query": "union withsource=TableName *\n| summarize Count=count() by TableName\n| render barchart", + // "queryType": float64(0), + // "resourceType": "microsoft.operationalinsights/workspaces", + // "size": float64(1), + // "version": "KqlItem/1.0", + // }, + // }, + // }, + // "styleSettings":map[string]any{ + // }, + // "version": "Notebook/1.0", + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateDelete.json +func ExampleWorkbookTemplatesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewWorkbookTemplatesClient().Delete(ctx, "my-resource-group", "my-template-resource", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateAdd.json +func ExampleWorkbookTemplatesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbookTemplatesClient().CreateOrUpdate(ctx, "my-resource-group", "testtemplate2", armapplicationinsights.WorkbookTemplate{ + Location: to.Ptr("west us"), + Properties: &armapplicationinsights.WorkbookTemplateProperties{ + Author: to.Ptr("Contoso"), + Galleries: []*armapplicationinsights.WorkbookTemplateGallery{ + { + Name: to.Ptr("Simple Template"), + Type: to.Ptr("tsg"), + Category: to.Ptr("Failures"), + Order: to.Ptr[int32](100), + ResourceType: to.Ptr("microsoft.insights/components"), + }}, + Priority: to.Ptr[int32](1), + TemplateData: map[string]any{ + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", + "items": []any{ + map[string]any{ + "name": "text - 2", + "type": float64(1), + "content": map[string]any{ + "json": "## New workbook\n---\n\nWelcome to your new workbook. This area will display text formatted as markdown.\n\n\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.", + }, + }, + map[string]any{ + "name": "query - 2", + "type": float64(3), + "content": map[string]any{ + "exportToExcelOptions": "visible", + "query": "union withsource=TableName *\n| summarize Count=count() by TableName\n| render barchart", + "queryType": float64(0), + "resourceType": "microsoft.operationalinsights/workspaces", + "size": float64(1), + "version": "KqlItem/1.0", + }, + }, + }, + "styleSettings": map[string]any{}, + "version": "Notebook/1.0", + }, + }, + }, 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.WorkbookTemplate = armapplicationinsights.WorkbookTemplate{ + // Name: to.Ptr("testtemplate2"), + // Type: to.Ptr("microsoft.insights/workbooktemplates"), + // ID: to.Ptr("/subscriptions/50359d91-7b9d-4823-85af-eb298a61ba95/resourceGroups/testrg/providers/microsoft.insights/workbooktemplates/testtemplate2"), + // Location: to.Ptr("westeurope"), + // Properties: &armapplicationinsights.WorkbookTemplateProperties{ + // Author: to.Ptr("Contoso"), + // Galleries: []*armapplicationinsights.WorkbookTemplateGallery{ + // { + // Name: to.Ptr("Simple Template"), + // Type: to.Ptr("tsg"), + // Category: to.Ptr("Failures"), + // Order: to.Ptr[int32](100), + // ResourceType: to.Ptr("microsoft.insights/components"), + // }}, + // Priority: to.Ptr[int32](1), + // TemplateData: map[string]any{ + // "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", + // "items":[]any{ + // map[string]any{ + // "name": "text - 2", + // "type": float64(1), + // "content":map[string]any{ + // "json": "## New workbook\n---\n\nWelcome to your new workbook. This area will display text formatted as markdown.\n\n\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.", + // }, + // }, + // map[string]any{ + // "name": "query - 2", + // "type": float64(3), + // "content":map[string]any{ + // "exportToExcelOptions": "visible", + // "query": "union withsource=TableName *\n| summarize Count=count() by TableName\n| render barchart", + // "queryType": float64(0), + // "resourceType": "microsoft.operationalinsights/workspaces", + // "size": float64(1), + // "version": "KqlItem/1.0", + // }, + // }, + // }, + // "styleSettings":map[string]any{ + // }, + // "version": "Notebook/1.0", + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateUpdate.json +func ExampleWorkbookTemplatesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbookTemplatesClient().Update(ctx, "my-resource-group", "my-template-resource", &armapplicationinsights.WorkbookTemplatesClientUpdateOptions{WorkbookTemplateUpdateParameters: 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.WorkbookTemplate = armapplicationinsights.WorkbookTemplate{ + // Name: to.Ptr("testtemplate2"), + // Type: to.Ptr("microsoft.insights/workbooktemplates"), + // ID: to.Ptr("/subscriptions/50359d91-7b9d-4823-85af-eb298a61ba95/resourceGroups/testrg/providers/microsoft.insights/workbooktemplates/testtemplate2"), + // Location: to.Ptr("westeurope"), + // Properties: &armapplicationinsights.WorkbookTemplateProperties{ + // Author: to.Ptr("Contoso"), + // Galleries: []*armapplicationinsights.WorkbookTemplateGallery{ + // { + // Name: to.Ptr("Simple Template"), + // Type: to.Ptr("tsg"), + // Category: to.Ptr("Failures"), + // Order: to.Ptr[int32](100), + // ResourceType: to.Ptr("microsoft.insights/components"), + // }}, + // Priority: to.Ptr[int32](1), + // TemplateData: map[string]any{ + // "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", + // "items":[]any{ + // map[string]any{ + // "name": "text - 2", + // "type": float64(1), + // "content":map[string]any{ + // "json": "## New workbook\n---\n\nWelcome to your new workbook. This area will display text formatted as markdown.\n\n\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.", + // }, + // }, + // map[string]any{ + // "name": "query - 2", + // "type": float64(3), + // "content":map[string]any{ + // "exportToExcelOptions": "visible", + // "query": "union withsource=TableName *\n| summarize Count=count() by TableName\n| render barchart", + // "queryType": float64(0), + // "resourceType": "microsoft.operationalinsights/workspaces", + // "size": float64(1), + // "version": "KqlItem/1.0", + // }, + // }, + // }, + // "styleSettings":map[string]any{ + // }, + // "version": "Notebook/1.0", + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go index e79152b8a29d..801f81c5d748 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigsGet.json func ExampleWorkItemConfigurationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleWorkItemConfigurationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigCreate.json func ExampleWorkItemConfigurationsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +75,7 @@ func ExampleWorkItemConfigurationsClient_Create() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDefaultGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDefaultGet.json func ExampleWorkItemConfigurationsClient_GetDefault() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -102,7 +102,7 @@ func ExampleWorkItemConfigurationsClient_GetDefault() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDelete.json func ExampleWorkItemConfigurationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,7 +119,7 @@ func ExampleWorkItemConfigurationsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigGet.json func ExampleWorkItemConfigurationsClient_GetItem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,7 +146,7 @@ func ExampleWorkItemConfigurationsClient_GetItem() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b43042075540b8d67cce7d3d9f70b9b9f5a359da/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigUpdate.json func ExampleWorkItemConfigurationsClient_UpdateItem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil {