diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md index 697c5f9d6bf1..bedf1442fb41 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md @@ -1,5 +1,160 @@ # Release History +## 2.0.0-beta.1 (2022-06-02) +### Breaking Changes + +- Function `*WorkbooksClient.Update` parameter(s) have been changed from `(context.Context, string, string, Workbook, *WorkbooksClientUpdateOptions)` to `(context.Context, string, string, *WorkbooksClientUpdateOptions)` +- Type of `MyWorkbook.Kind` has been changed from `*SharedTypeKind` to `*Kind` +- Type of `WorkbookProperties.TimeModified` has been changed from `*string` to `*time.Time` +- Type of `Workbook.Kind` has been changed from `*SharedTypeKind` to `*WorkbookSharedTypeKind` +- Const `SharedTypeKindUser` has been removed +- Const `SharedTypeKindShared` has been removed +- Function `PossibleSharedTypeKindValues` has been removed +- Struct `ErrorFieldContract` has been removed +- Struct `LinkProperties` has been removed +- Field `Code` of struct `WorkbookError` has been removed +- Field `Details` of struct `WorkbookError` has been removed +- Field `Message` of struct `WorkbookError` has been removed +- Field `SharedTypeKind` of struct `WorkbookProperties` has been removed +- Field `SourceResourceID` of struct `WorkbookProperties` has been removed +- Field `WorkbookID` of struct `WorkbookProperties` has been removed +- Field `Name` of struct `WorkbookProperties` has been removed +- Field `Code` of struct `MyWorkbookError` has been removed +- Field `Details` of struct `MyWorkbookError` has been removed +- Field `Message` of struct `MyWorkbookError` has been removed + +### Features Added + +- New const `MyWorkbookManagedIdentityTypeNone` +- New const `WorkbookUpdateSharedTypeKindShared` +- New const `CreatedByTypeManagedIdentity` +- New const `ManagedServiceIdentityTypeUserAssigned` +- New const `StorageTypeServiceProfiler` +- New const `KindUser` +- New const `CreatedByTypeApplication` +- New const `CreatedByTypeUser` +- New const `ManagedServiceIdentityTypeSystemAssignedUserAssigned` +- New const `MyWorkbookManagedIdentityTypeUserAssigned` +- New const `WorkbookSharedTypeKindShared` +- New const `CreatedByTypeKey` +- New const `KindShared` +- New const `ManagedServiceIdentityTypeNone` +- New const `ManagedServiceIdentityTypeSystemAssigned` +- New function `TrackedResource.MarshalJSON() ([]byte, error)` +- New function `PossibleWorkbookUpdateSharedTypeKindValues() []WorkbookUpdateSharedTypeKind` +- New function `WorkbookTemplate.MarshalJSON() ([]byte, error)` +- New function `*WorkbooksClient.RevisionGet(context.Context, string, string, string, *WorkbooksClientRevisionGetOptions) (WorkbooksClientRevisionGetResponse, error)` +- New function `WorkbookTemplateProperties.MarshalJSON() ([]byte, error)` +- New function `WorkbookTemplateLocalizedGallery.MarshalJSON() ([]byte, error)` +- New function `WorkbookTemplateResource.MarshalJSON() ([]byte, error)` +- New function `PossibleCreatedByTypeValues() []CreatedByType` +- New function `PossibleStorageTypeValues() []StorageType` +- New function `*WorkbookProperties.UnmarshalJSON([]byte) error` +- New function `WorkbookPropertiesUpdateParameters.MarshalJSON() ([]byte, error)` +- New function `PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType` +- New function `*WorkbooksClient.NewListBySubscriptionPager(CategoryType, *WorkbooksClientListBySubscriptionOptions) *runtime.Pager[WorkbooksClientListBySubscriptionResponse]` +- New function `WorkbookTemplateUpdateParameters.MarshalJSON() ([]byte, error)` +- New function `PossibleWorkbookSharedTypeKindValues() []WorkbookSharedTypeKind` +- New function `PossibleMyWorkbookManagedIdentityTypeValues() []MyWorkbookManagedIdentityType` +- New function `ComponentLinkedStorageAccountsPatch.MarshalJSON() ([]byte, error)` +- New function `WorkbookUpdateParameters.MarshalJSON() ([]byte, error)` +- New function `*WorkbooksClient.NewRevisionsListPager(string, string, *WorkbooksClientRevisionsListOptions) *runtime.Pager[WorkbooksClientRevisionsListResponse]` +- New function `PossibleKindValues() []Kind` +- New function `ManagedServiceIdentity.MarshalJSON() ([]byte, error)` +- New function `WorkbookResourceIdentity.MarshalJSON() ([]byte, error)` +- New function `*SystemData.UnmarshalJSON([]byte) error` +- New function `SystemData.MarshalJSON() ([]byte, error)` +- New struct `ComponentLinkedStorageAccounts` +- New struct `ComponentLinkedStorageAccountsClientCreateAndUpdateOptions` +- New struct `ComponentLinkedStorageAccountsClientCreateAndUpdateResponse` +- New struct `ComponentLinkedStorageAccountsClientDeleteOptions` +- New struct `ComponentLinkedStorageAccountsClientDeleteResponse` +- New struct `ComponentLinkedStorageAccountsClientGetOptions` +- New struct `ComponentLinkedStorageAccountsClientGetResponse` +- New struct `ComponentLinkedStorageAccountsClientUpdateOptions` +- New struct `ComponentLinkedStorageAccountsClientUpdateResponse` +- New struct `ComponentLinkedStorageAccountsPatch` +- New struct `ErrorDefinition` +- New struct `ErrorResponseLinkedStorage` +- New struct `ErrorResponseLinkedStorageError` +- New struct `InnerErrorTrace` +- New struct `LinkedStorageAccountsProperties` +- New struct `LiveTokenClientGetOptions` +- New struct `LiveTokenClientGetResponse` +- New struct `LiveTokenResponse` +- New struct `ManagedServiceIdentity` +- New struct `MyWorkbookManagedIdentity` +- New struct `MyWorkbookUserAssignedIdentities` +- New struct `OperationInfo` +- New struct `OperationLive` +- New struct `OperationsListResult` +- New struct `ProxyResource` +- New struct `Resource` +- New struct `SystemData` +- New struct `TrackedResource` +- New struct `UserAssignedIdentity` +- New struct `WorkbookErrorDefinition` +- New struct `WorkbookInnerErrorTrace` +- New struct `WorkbookPropertiesUpdateParameters` +- New struct `WorkbookResourceIdentity` +- New struct `WorkbookTemplate` +- New struct `WorkbookTemplateError` +- New struct `WorkbookTemplateErrorBody` +- New struct `WorkbookTemplateErrorFieldContract` +- New struct `WorkbookTemplateGallery` +- New struct `WorkbookTemplateLocalizedGallery` +- New struct `WorkbookTemplateProperties` +- New struct `WorkbookTemplateResource` +- New struct `WorkbookTemplateUpdateParameters` +- New struct `WorkbookTemplatesClientCreateOrUpdateOptions` +- New struct `WorkbookTemplatesClientCreateOrUpdateResponse` +- New struct `WorkbookTemplatesClientDeleteOptions` +- New struct `WorkbookTemplatesClientDeleteResponse` +- New struct `WorkbookTemplatesClientGetOptions` +- New struct `WorkbookTemplatesClientGetResponse` +- New struct `WorkbookTemplatesClientListByResourceGroupOptions` +- New struct `WorkbookTemplatesClientListByResourceGroupResponse` +- New struct `WorkbookTemplatesClientUpdateOptions` +- New struct `WorkbookTemplatesClientUpdateResponse` +- New struct `WorkbookTemplatesListResult` +- New struct `WorkbookUpdateParameters` +- New struct `WorkbooksClientListBySubscriptionOptions` +- New struct `WorkbooksClientListBySubscriptionResponse` +- New struct `WorkbooksClientRevisionGetOptions` +- New struct `WorkbooksClientRevisionGetResponse` +- New struct `WorkbooksClientRevisionsListOptions` +- New struct `WorkbooksClientRevisionsListResponse` +- New field `CanFetchContent` in struct `WorkbooksClientGetOptions` +- New field `SourceID` in struct `MyWorkbooksClientListByResourceGroupOptions` +- New field `NextLink` in struct `WorkbooksListResult` +- New field `Etag` in struct `WorkbookResource` +- New field `Identity` in struct `WorkbookResource` +- New field `Kind` in struct `WorkbookResource` +- New field `SystemData` in struct `Workbook` +- New field `Etag` in struct `Workbook` +- New field `Identity` in struct `Workbook` +- New field `Etag` in struct `MyWorkbook` +- New field `Identity` in struct `MyWorkbook` +- New field `SystemData` in struct `MyWorkbook` +- New field `Error` in struct `WorkbookError` +- New field `SourceID` in struct `WorkbooksClientUpdateOptions` +- New field `WorkbookUpdateParameters` in struct `WorkbooksClientUpdateOptions` +- New field `StorageURI` in struct `MyWorkbookProperties` +- New field `SourceID` in struct `MyWorkbooksClientUpdateOptions` +- New field `NextLink` in struct `MyWorkbooksListResult` +- New field `Error` in struct `MyWorkbookError` +- New field `SourceID` in struct `MyWorkbooksClientCreateOrUpdateOptions` +- New field `SourceID` in struct `WorkbooksClientListByResourceGroupOptions` +- New field `SourceID` in struct `WorkbookProperties` +- New field `DisplayName` in struct `WorkbookProperties` +- New field `Revision` in struct `WorkbookProperties` +- New field `StorageURI` in struct `WorkbookProperties` +- New field `Description` in struct `WorkbookProperties` +- New field `Identity` in struct `MyWorkbookResource` +- New field `Etag` in struct `MyWorkbookResource` +- New field `SourceID` in struct `WorkbooksClientCreateOrUpdateOptions` + + ## 1.0.0 (2022-06-02) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md index 0d7509f3d98c..b0566cde58cb 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md @@ -4,11 +4,10 @@ ``` yaml azure-arm: true -tag: package-2020-02-02 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/7932c2df6c8435d6c0e5cbebbca79bce627d5f06/specification/applicationinsights/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/7932c2df6c8435d6c0e5cbebbca79bce627d5f06/specification/applicationinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod index b2fd69ec1aef..da25c4681c1a 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 @@ -19,5 +19,3 @@ require ( golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect ) - -retract v0.5.0 diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_analyticsitems_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_analyticsitems_client_test.go index c7a72d98b529..6de4f1c15e89 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_analyticsitems_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_analyticsitems_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_annotations_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_annotations_client_test.go index 13539a0deb9d..e5e59e565fcb 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_annotations_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_annotations_client_test.go @@ -16,7 +16,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_apikeys_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_apikeys_client_test.go index 9e3da1602d6c..195f391adccf 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_apikeys_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_apikeys_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentavailablefeatures_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentavailablefeatures_client_test.go index edc8459be94a..e9da868e8f79 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentavailablefeatures_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentavailablefeatures_client_test.go @@ -13,7 +13,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AvailableBillingFeaturesGet.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentcurrentbillingfeatures_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentcurrentbillingfeatures_client_test.go index 987bd0b2d543..61a1e7604c2c 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentcurrentbillingfeatures_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentcurrentbillingfeatures_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesGet.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentfeaturecapabilities_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentfeaturecapabilities_client_test.go index 790ea20a6896..fb97f2713497 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentfeaturecapabilities_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentfeaturecapabilities_client_test.go @@ -13,7 +13,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FeatureCapabilitiesGet.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentlinkedstorageaccounts_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentlinkedstorageaccounts_client_test.go new file mode 100644 index 000000000000..a51f10619984 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentlinkedstorageaccounts_client_test.go @@ -0,0 +1,118 @@ +//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. + +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/tree/main/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() + client, err := armapplicationinsights.NewComponentLinkedStorageAccountsClient("86dc51d3-92ed-4d7e-947a-775ea79b4918", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "someResourceGroupName", + "myComponent", + armapplicationinsights.StorageTypeServiceProfiler, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewComponentLinkedStorageAccountsClient("86dc51d3-92ed-4d7e-947a-775ea79b4918", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.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) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewComponentLinkedStorageAccountsClient("86dc51d3-92ed-4d7e-947a-775ea79b4918", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.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) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewComponentLinkedStorageAccountsClient("86dc51d3-92ed-4d7e-947a-775ea79b4918", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.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/ze_generated_example_componentquotastatus_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentquotastatus_client_test.go index cc329fa4334d..ec38b841bc27 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentquotastatus_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_componentquotastatus_client_test.go @@ -13,7 +13,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/QuotaStatusGet.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_components_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_components_client_test.go index 19db742dfa6f..b81ee90608e0 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_components_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_components_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_exportconfigurations_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_exportconfigurations_client_test.go index 2d67ec9b83c7..faa387cd0051 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_exportconfigurations_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_exportconfigurations_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_favorites_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_favorites_client_test.go index e8de2a983929..50424ce908fe 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_favorites_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_favorites_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoritesList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_livetoken_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_livetoken_client_test.go new file mode 100644 index 000000000000..6f4fffb65a30 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_livetoken_client_test.go @@ -0,0 +1,38 @@ +//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. + +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/tree/main/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() + client, err := armapplicationinsights.NewLiveTokenClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.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) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_myworkbooks_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_myworkbooks_client_test.go index c5212454d294..408e09292d7d 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_myworkbooks_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_myworkbooks_client_test.go @@ -14,10 +14,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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList.json func ExampleMyWorkbooksClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -31,6 +31,7 @@ func ExampleMyWorkbooksClient_NewListByResourceGroupPager() { pager := client.NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions{Tags: []string{}, + SourceID: nil, CanFetchContent: nil, }) for pager.More() { @@ -45,7 +46,7 @@ func ExampleMyWorkbooksClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList.json func ExampleMyWorkbooksClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,7 +73,7 @@ func ExampleMyWorkbooksClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookGet.json func ExampleMyWorkbooksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +95,7 @@ func ExampleMyWorkbooksClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookDelete.json func ExampleMyWorkbooksClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -114,7 +115,7 @@ func ExampleMyWorkbooksClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookAdd.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookAdd.json func ExampleMyWorkbooksClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -136,7 +137,7 @@ func ExampleMyWorkbooksClient_CreateOrUpdate() { "0": to.Ptr("TagSample01"), "1": to.Ptr("TagSample02"), }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), + Kind: to.Ptr(armapplicationinsights.KindUser), Properties: &armapplicationinsights.MyWorkbookProperties{ Category: to.Ptr("workbook"), DisplayName: to.Ptr("Blah Blah Blah"), @@ -144,7 +145,7 @@ func ExampleMyWorkbooksClient_CreateOrUpdate() { SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), }, }, - nil) + &armapplicationinsights.MyWorkbooksClientCreateOrUpdateOptions{SourceID: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -152,7 +153,7 @@ func ExampleMyWorkbooksClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookUpdate.json func ExampleMyWorkbooksClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -163,7 +164,7 @@ func ExampleMyWorkbooksClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Update(ctx, + _, err = client.Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.MyWorkbook{ @@ -173,7 +174,7 @@ func ExampleMyWorkbooksClient_Update() { "0": to.Ptr("TagSample01"), "1": to.Ptr("TagSample02"), }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), + Kind: to.Ptr(armapplicationinsights.KindUser), Properties: &armapplicationinsights.MyWorkbookProperties{ Category: to.Ptr("workbook"), DisplayName: to.Ptr("Blah Blah Blah"), @@ -182,10 +183,8 @@ func ExampleMyWorkbooksClient_Update() { Version: to.Ptr("ME"), }, }, - nil) + &armapplicationinsights.MyWorkbooksClientUpdateOptions{SourceID: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item - _ = res } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_proactivedetectionconfigurations_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_proactivedetectionconfigurations_client_test.go index 166d54a16020..309fd2be1e0c 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_proactivedetectionconfigurations_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_proactivedetectionconfigurations_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationsList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtestlocations_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtestlocations_client_test.go index 367d90c959af..223613101919 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtestlocations_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtestlocations_client_test.go @@ -13,7 +13,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestLocationsList.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtests_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtests_client_test.go index 1a80655bd128..55bfa3afc174 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtests_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_webtests_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByResourceGroup.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooks_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooks_client_test.go index fa06ec8099bc..cdff171fc6d7 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooks_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooks_client_test.go @@ -14,10 +14,37 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbooksList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList2.json +func ExampleWorkbooksClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armapplicationinsights.NewWorkbooksClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListBySubscriptionPager(armapplicationinsights.CategoryTypeWorkbook, + &armapplicationinsights.WorkbooksClientListBySubscriptionOptions{Tags: []string{}, + CanFetchContent: nil, + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList.json func ExampleWorkbooksClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -31,6 +58,7 @@ func ExampleWorkbooksClient_NewListByResourceGroupPager() { pager := client.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() { @@ -45,7 +73,7 @@ func ExampleWorkbooksClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet.json func ExampleWorkbooksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,7 +87,7 @@ func ExampleWorkbooksClient_Get() { res, err := client.Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - nil) + &armapplicationinsights.WorkbooksClientGetOptions{CanFetchContent: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -67,14 +95,14 @@ func ExampleWorkbooksClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookDelete.json func ExampleWorkbooksClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armapplicationinsights.NewWorkbooksClient("subid", cred, nil) + client, err := armapplicationinsights.NewWorkbooksClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -87,39 +115,35 @@ func ExampleWorkbooksClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookAdd.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookAdd.json func ExampleWorkbooksClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armapplicationinsights.NewWorkbooksClient("subid", cred, nil) + client, err := armapplicationinsights.NewWorkbooksClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := client.CreateOrUpdate(ctx, "my-resource-group", - "deadb33f-8bee-4d3b-a059-9be8dac93960", + "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.Workbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - Location: to.Ptr("west us"), + 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) } @@ -127,7 +151,7 @@ func ExampleWorkbooksClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedUpdate.json func ExampleWorkbooksClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -138,26 +162,58 @@ func ExampleWorkbooksClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Update(ctx, + _, err = client.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"), - }, - 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}"), - UserID: to.Ptr("userId"), - Version: to.Ptr("ME"), - WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - }, - }, + &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) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-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() + client, err := armapplicationinsights.NewWorkbooksClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewRevisionsListPager("my-resource-group", + "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-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() + client, err := armapplicationinsights.NewWorkbooksClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.RevisionGet(ctx, + "my-resource-group", + "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + "1e2f8435b98248febee70c64ac22e1ab", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooktemplates_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooktemplates_client_test.go new file mode 100644 index 000000000000..7b20e4bd81d6 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workbooktemplates_client_test.go @@ -0,0 +1,170 @@ +//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. + +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/tree/main/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() + client, err := armapplicationinsights.NewWorkbookTemplatesClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("my-resource-group", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewWorkbookTemplatesClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "my-resource-group", + "my-resource-name", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewWorkbookTemplatesClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.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/tree/main/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() + client, err := armapplicationinsights.NewWorkbookTemplatesClient("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.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]interface{}{ + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", + "items": []interface{}{ + map[string]interface{}{ + "name": "text - 2", + "type": float64(1), + "content": map[string]interface{}{ + "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]interface{}{ + "name": "query - 2", + "type": float64(3), + "content": map[string]interface{}{ + "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]interface{}{}, + "version": "Notebook/1.0", + }, + }, + }, + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() + client, err := armapplicationinsights.NewWorkbookTemplatesClient("6b643656-33eb-422f-aee8-3ac145d124af", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, + "my-resource-group", + "my-template-resource", + &armapplicationinsights.WorkbookTemplatesClientUpdateOptions{WorkbookTemplateUpdateParameters: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workitemconfigurations_client_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workitemconfigurations_client_test.go index c687d3b16015..1393ff928899 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workitemconfigurations_client_test.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/ze_generated_example_workitemconfigurations_client_test.go @@ -14,7 +14,7 @@ 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/tree/main/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigsGet.json diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_componentlinkedstorageaccounts_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_componentlinkedstorageaccounts_client.go new file mode 100644 index 000000000000..2b61b8dea873 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_componentlinkedstorageaccounts_client.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. + +package armapplicationinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ComponentLinkedStorageAccountsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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) { + req, err := client.createAndUpdateCreateRequest(ctx, resourceGroupName, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createAndUpdateHandleResponse(resp) +} + +// 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.host, 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, runtime.MarshalAsJSON(req, linkedStorageAccountsProperties) +} + +// 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) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + 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.host, 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ComponentLinkedStorageAccountsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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.host, 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) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// 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.host, 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, runtime.MarshalAsJSON(req, linkedStorageAccountsProperties) +} + +// 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/zz_generated_constants.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_constants.go index d7b1a9a48e1f..5325838b08d5 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_constants.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_constants.go @@ -10,7 +10,7 @@ package armapplicationinsights const ( moduleName = "armapplicationinsights" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0-beta.1" ) // 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,58 @@ func PossibleItemTypeParameterValues() []ItemTypeParameter { } } +// Kind - The kind of workbook. Choices are user and shared. +type Kind string + +const ( + KindShared Kind = "shared" + KindUser Kind = "user" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindShared, + KindUser, + } +} + +// 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, + } +} + +// MyWorkbookManagedIdentityType - The identity type. +type MyWorkbookManagedIdentityType string + +const ( + MyWorkbookManagedIdentityTypeNone MyWorkbookManagedIdentityType = "None" + MyWorkbookManagedIdentityTypeUserAssigned MyWorkbookManagedIdentityType = "UserAssigned" +) + +// PossibleMyWorkbookManagedIdentityTypeValues returns the possible values for the MyWorkbookManagedIdentityType const type. +func PossibleMyWorkbookManagedIdentityTypeValues() []MyWorkbookManagedIdentityType { + return []MyWorkbookManagedIdentityType{ + MyWorkbookManagedIdentityTypeNone, + MyWorkbookManagedIdentityTypeUserAssigned, + } +} + // PublicNetworkAccessType - The network access type for operating on the Application Insights Component. By default it is // Enabled type PublicNetworkAccessType string @@ -248,19 +320,16 @@ 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, } } @@ -279,3 +348,31 @@ func PossibleWebTestKindValues() []WebTestKind { WebTestKindMultistep, } } + +// 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/zz_generated_livetoken_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_livetoken_client.go new file mode 100644 index 000000000000..b1fe546f329e --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_livetoken_client.go @@ -0,0 +1,94 @@ +//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. + +package armapplicationinsights + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &LiveTokenClient{ + host: ep, + pl: pl, + } + 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) { + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LiveTokenClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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.host, 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/zz_generated_models.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models.go index be26e4b12922..b6f1efde4a1a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models.go @@ -528,6 +528,51 @@ type ComponentFeatureCapability struct { Value *string `json:"Value,omitempty" azure:"ro"` } +// ComponentLinkedStorageAccounts - An Application Insights component linked storage accounts +type ComponentLinkedStorageAccounts struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 +} + +// ComponentLinkedStorageAccountsPatch - An Application Insights component linked storage accounts patch +type ComponentLinkedStorageAccountsPatch struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties `json:"properties,omitempty"` +} + // ComponentListResult - Describes the list of Application Insights Resources. type ComponentListResult struct { // REQUIRED; List of Application Insights component definitions. @@ -796,16 +841,16 @@ type ComponentsResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ErrorFieldContract - Error Field contract. -type ErrorFieldContract struct { - // Property level error code. - Code *string `json:"code,omitempty"` +// ErrorDefinition - Error definition. +type ErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty" azure:"ro"` - // Human-readable representation of property-level error. - Message *string `json:"message,omitempty"` + // READ-ONLY; Internal error details. + Innererror interface{} `json:"innererror,omitempty" azure:"ro"` - // Property name. - Target *string `json:"target,omitempty"` + // READ-ONLY; Description of the error. + Message *string `json:"message,omitempty" azure:"ro"` } // ErrorResponse - Error response indicates Insights service is not able to process the incoming request. The reason is provided @@ -834,6 +879,22 @@ type ErrorResponseComponentsError struct { Message *string `json:"message,omitempty" azure:"ro"` } +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 `json:"error,omitempty"` +} + +// 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 `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty" azure:"ro"` +} + // ExportConfigurationsClientCreateOptions contains the optional parameters for the ExportConfigurationsClient.Create method. type ExportConfigurationsClientCreateOptions struct { // placeholder for future optional parameters @@ -901,25 +962,62 @@ type InnerError struct { Time *time.Time `json:"time,omitempty"` } -// LinkProperties - Contains a sourceId and workbook resource id to link two resources. -type LinkProperties struct { - // The category of workbook - Category *string `json:"category,omitempty"` +// InnerErrorTrace - Error details +type InnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string `json:"trace,omitempty" azure:"ro"` +} - // The source Azure resource id - SourceID *string `json:"sourceId,omitempty"` +// LinkedStorageAccountsProperties - An Application Insights component linked storage account +type LinkedStorageAccountsProperties struct { + // Linked storage account resource ID + LinkedStorageAccount *string `json:"linkedStorageAccount,omitempty"` +} - // The workbook Azure resource id - TargetID *string `json:"targetId,omitempty"` +// LiveTokenClientGetOptions contains the optional parameters for the LiveTokenClient.Get method. +type LiveTokenClientGetOptions struct { + // placeholder for future optional parameters +} + +// LiveTokenResponse - The response to a live token query. +type LiveTokenResponse struct { + // READ-ONLY; JWT token for accessing live metrics stream data. + LiveToken *string `json:"liveToken,omitempty" azure:"ro"` +} + +// 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 `json:"type,omitempty"` + + // 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 `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` } // MyWorkbook - An Application Insights private workbook definition. type MyWorkbook struct { + // Resource etag + Etag map[string]*string `json:"etag,omitempty"` + // Azure resource Id ID *string `json:"id,omitempty"` + // Identity used for BYOS + Identity *MyWorkbookManagedIdentity `json:"identity,omitempty"` + // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind `json:"kind,omitempty"` + Kind *Kind `json:"kind,omitempty"` // Resource location Location *string `json:"location,omitempty"` @@ -935,18 +1033,24 @@ type MyWorkbook struct { // Azure resource type Type *string `json:"type,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MyWorkbookError - Error message body that will indicate why the operation failed. +// MyWorkbookError - Error response. type MyWorkbookError struct { - // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - Code *string `json:"code,omitempty"` + // The error details. + Error *ErrorDefinition `json:"error,omitempty"` +} - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract `json:"details,omitempty"` +// MyWorkbookManagedIdentity - Customer Managed Identity +type MyWorkbookManagedIdentity struct { + // The identity type. + Type *MyWorkbookManagedIdentityType `json:"type,omitempty"` - // Human-readable representation of the error. - Message *string `json:"message,omitempty"` + // Customer Managed Identity + UserAssignedIdentities *MyWorkbookUserAssignedIdentities `json:"userAssignedIdentities,omitempty"` } // MyWorkbookProperties - Properties that contain a private workbook. @@ -963,6 +1067,9 @@ type MyWorkbookProperties struct { // Optional resourceId for a source resource. SourceID *string `json:"sourceId,omitempty"` + // BYOS Storage Account URI + StorageURI *string `json:"storageUri,omitempty"` + // A list of 0 or more tags that are associated with this private workbook definition Tags []*string `json:"tags,omitempty"` @@ -978,9 +1085,15 @@ type MyWorkbookProperties struct { // MyWorkbookResource - An azure resource object type MyWorkbookResource struct { + // Resource etag + Etag map[string]*string `json:"etag,omitempty"` + // Azure resource Id ID *string `json:"id,omitempty"` + // Identity used for BYOS + Identity *MyWorkbookManagedIdentity `json:"identity,omitempty"` + // Resource location Location *string `json:"location,omitempty"` @@ -994,9 +1107,19 @@ type MyWorkbookResource struct { Type *string `json:"type,omitempty"` } +// MyWorkbookUserAssignedIdentities - Customer Managed Identity +type MyWorkbookUserAssignedIdentities struct { + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + // MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate method. type MyWorkbooksClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string } // MyWorkbooksClientDeleteOptions contains the optional parameters for the MyWorkbooksClient.Delete method. @@ -1015,6 +1138,8 @@ 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 + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string // Tags presents on each workbook returned. Tags []string } @@ -1031,11 +1156,14 @@ type MyWorkbooksClientListBySubscriptionOptions struct { // MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. type MyWorkbooksClientUpdateOptions struct { - // placeholder for future optional parameters + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string } // MyWorkbooksListResult - Workbook list result. type MyWorkbooksListResult struct { + NextLink *string `json:"nextLink,omitempty"` + // READ-ONLY; An array of private workbooks. Value []*MyWorkbook `json:"value,omitempty" azure:"ro"` } @@ -1061,6 +1189,21 @@ type OperationDisplay struct { Resource *string `json:"resource,omitempty"` } +// OperationInfo - Information about an operation +type OperationInfo struct { + // Description of the operation + Description *string `json:"description,omitempty"` + + // Name of the operation + Operation *string `json:"operation,omitempty"` + + // Name of the provider + Provider *string `json:"provider,omitempty"` + + // Name of the resource type + Resource *string `json:"resource,omitempty"` +} + // 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. type OperationListResult struct { @@ -1071,6 +1214,33 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } +// OperationLive - Represents an operation returned by the GetOperations request +type OperationLive struct { + // Display name of the operation + Display *OperationInfo `json:"display,omitempty"` + + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Name of the operation + Name *string `json:"name,omitempty"` + + // Origin of the operation + Origin *string `json:"origin,omitempty"` + + // Properties of the operation + Properties interface{} `json:"properties,omitempty"` +} + +// 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 `json:"nextLink,omitempty"` + + // A collection of operations + Value []*OperationLive `json:"value,omitempty"` +} + // PrivateLinkScopedResource - The private link scope resource reference. type PrivateLinkScopedResource struct { // The full resource Id of the private link scope resource. @@ -1098,12 +1268,86 @@ type ProactiveDetectionConfigurationsClientUpdateOptions struct { // placeholder for future optional parameters } +// 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 `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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 `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + // 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 `json:"tags,omitempty"` } +// 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 `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + // WebTest - An Application Insights web test definition. type WebTest struct { // REQUIRED; Resource location @@ -1339,40 +1583,61 @@ type WorkItemCreateConfiguration struct { WorkItemProperties map[string]*string `json:"WorkItemProperties,omitempty"` } -// Workbook - An Application Insights workbook definition. +// Workbook - A workbook definition. type Workbook struct { - // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind `json:"kind,omitempty"` - - // Resource location + // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Metadata describing a web test for an Azure resource. + // Resource etag + Etag *string `json:"etag,omitempty"` + + // Identity used for BYOS + Identity *WorkbookResourceIdentity `json:"identity,omitempty"` + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind `json:"kind,omitempty"` + + // Metadata describing a workbook for an Azure resource. Properties *WorkbookProperties `json:"properties,omitempty"` - // Resource tags + // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // 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 `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Azure resource type + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } -// 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. - Code *string `json:"code,omitempty"` + // The error details. + Error *WorkbookErrorDefinition `json:"error,omitempty"` +} - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract `json:"details,omitempty"` +// WorkbookErrorDefinition - Error definition. +type WorkbookErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty" azure:"ro"` - // Human-readable representation of the error. - Message *string `json:"message,omitempty"` + // READ-ONLY; Internal error details. + InnerError interface{} `json:"innerError,omitempty" azure:"ro"` + + // READ-ONLY; Description of the error. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// WorkbookInnerErrorTrace - Error details +type WorkbookInnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string `json:"trace,omitempty" azure:"ro"` } // WorkbookProperties - Properties that contain a workbook. @@ -1380,56 +1645,278 @@ type WorkbookProperties struct { // REQUIRED; Workbook category, as defined by the user at creation time. Category *string `json:"category,omitempty"` - // REQUIRED; The user-defined name of the workbook. - Name *string `json:"name,omitempty"` + // REQUIRED; The user-defined name (display name) of the workbook. + DisplayName *string `json:"displayName,omitempty"` // REQUIRED; Configuration of this particular workbook. Configuration data is a string containing valid JSON SerializedData *string `json:"serializedData,omitempty"` - // 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 `json:"kind,omitempty"` + // The description of the workbook. + Description *string `json:"description,omitempty"` - // REQUIRED; Unique user id of the specific user that owns this workbook. - UserID *string `json:"userId,omitempty"` - - // REQUIRED; Internally assigned unique id of the workbook definition. - WorkbookID *string `json:"workbookId,omitempty"` + // ResourceId for a source resource. + SourceID *string `json:"sourceId,omitempty"` - // Optional resourceId for a source resource. - SourceResourceID *string `json:"sourceResourceId,omitempty"` + // The resourceId to the storage account when bring your own storage is used + StorageURI *string `json:"storageUri,omitempty"` - // A list of 0 or more tags that are associated with this workbook definition + // Being deprecated, please use the other tags field Tags []*string `json:"tags,omitempty"` - // 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 `json:"version,omitempty"` + // READ-ONLY; The unique revision id for this workbook definition + Revision *string `json:"revision,omitempty" azure:"ro"` + // READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. - TimeModified *string `json:"timeModified,omitempty" azure:"ro"` + TimeModified *time.Time `json:"timeModified,omitempty" azure:"ro"` + + // READ-ONLY; Unique user id of the specific user that owns this workbook. + UserID *string `json:"userId,omitempty" azure:"ro"` +} + +// WorkbookPropertiesUpdateParameters - Properties that contain a workbook for PATCH operation. +type WorkbookPropertiesUpdateParameters struct { + // Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + + // The description of the workbook. + Description *string `json:"description,omitempty"` + + // The user-defined name (display name) of the workbook. + DisplayName *string `json:"displayName,omitempty"` + + // The unique revision id for this workbook definition + Revision *string `json:"revision,omitempty"` + + // Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + + // A list of 0 or more tags that are associated with this workbook definition + Tags []*string `json:"tags,omitempty"` } // WorkbookResource - An azure resource object type WorkbookResource struct { - // Resource location + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource etag + Etag *string `json:"etag,omitempty"` + + // Identity used for BYOS + Identity *WorkbookResourceIdentity `json:"identity,omitempty"` + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind `json:"kind,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// WorkbookResourceIdentity - Identity used for BYOS +type WorkbookResourceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType `json:"type,omitempty"` + + // 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 `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// WorkbookTemplate - An Application Insights workbook template definition. +type WorkbookTemplate struct { + // REQUIRED; Resource location Location *string `json:"location,omitempty"` + // Metadata describing a workbook template for an Azure resource. + Properties *WorkbookTemplateProperties `json:"properties,omitempty"` + // Resource tags Tags map[string]*string `json:"tags,omitempty"` // READ-ONLY; Azure resource Id ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Azure resource name + // READ-ONLY; Azure resource name. Name *string `json:"name,omitempty" azure:"ro"` // READ-ONLY; Azure resource type Type *string `json:"type,omitempty" azure:"ro"` } +// 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 `json:"error,omitempty"` +} + +// 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 `json:"code,omitempty"` + + // The list of invalid fields send in request, in case of validation error. + Details []*WorkbookTemplateErrorFieldContract `json:"details,omitempty"` + + // Human-readable representation of the error. + Message *string `json:"message,omitempty"` +} + +// WorkbookTemplateErrorFieldContract - Error Field contract. +type WorkbookTemplateErrorFieldContract struct { + // Property level error code. + Code *string `json:"code,omitempty"` + + // Human-readable representation of property-level error. + Message *string `json:"message,omitempty"` + + // Property name. + Target *string `json:"target,omitempty"` +} + +// WorkbookTemplateGallery - Gallery information for a workbook template. +type WorkbookTemplateGallery struct { + // Category for the gallery. + Category *string `json:"category,omitempty"` + + // Name of the workbook template in the gallery. + Name *string `json:"name,omitempty"` + + // Order of the template within the gallery. + Order *int32 `json:"order,omitempty"` + + // Azure resource type supported by the gallery. + ResourceType *string `json:"resourceType,omitempty"` + + // Type of workbook supported by the workbook template. + Type *string `json:"type,omitempty"` +} + +// WorkbookTemplateLocalizedGallery - Localized template data and gallery information. +type WorkbookTemplateLocalizedGallery struct { + // Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery `json:"galleries,omitempty"` + + // Valid JSON object containing workbook template payload. + TemplateData interface{} `json:"templateData,omitempty"` +} + +// WorkbookTemplateProperties - Properties that contain a workbook template. +type WorkbookTemplateProperties struct { + // REQUIRED; Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery `json:"galleries,omitempty"` + + // REQUIRED; Valid JSON object containing workbook template payload. + TemplateData interface{} `json:"templateData,omitempty"` + + // Information about the author of the workbook template. + Author *string `json:"author,omitempty"` + + // Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. + Localized map[string][]*WorkbookTemplateLocalizedGallery `json:"localized,omitempty"` + + // Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. + Priority *int32 `json:"priority,omitempty"` +} + +// WorkbookTemplateResource - An azure resource object +type WorkbookTemplateResource struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Azure resource name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// WorkbookTemplateUpdateParameters - The parameters that can be provided when updating workbook template. +type WorkbookTemplateUpdateParameters struct { + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookTemplateProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// 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.ListByResourceGroup +// 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 +} + +// WorkbookTemplatesListResult - WorkbookTemplate list result. +type WorkbookTemplatesListResult struct { + // An array of workbook templates. + Value []*WorkbookTemplate `json:"value,omitempty"` +} + +// 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 `json:"kind,omitempty"` + + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookPropertiesUpdateParameters `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + // 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. @@ -1439,12 +1926,25 @@ 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.ListByResourceGroup // method. type WorkbooksClientListByResourceGroupOptions 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 + // 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.ListBySubscription 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 @@ -1452,13 +1952,28 @@ type WorkbooksClientListByResourceGroupOptions struct { 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.RevisionsList 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 } // WorkbooksListResult - Workbook list result. type WorkbooksListResult struct { + NextLink *string `json:"nextLink,omitempty"` + // READ-ONLY; An array of workbooks. Value []*Workbook `json:"value,omitempty" azure:"ro"` } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models_serde.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models_serde.go index 2e85e10b81b8..e83bd08bb9d1 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models_serde.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_models_serde.go @@ -110,6 +110,13 @@ func (c ComponentFavorite) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// MarshalJSON implements the json.Marshaller interface for type ComponentLinkedStorageAccountsPatch. +func (c ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + // MarshalJSON implements the json.Marshaller interface for type ComponentProactiveDetectionConfiguration. func (c ComponentProactiveDetectionConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -287,14 +294,27 @@ func (i *InnerError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + // MarshalJSON implements the json.Marshaller interface for type MyWorkbook. func (m MyWorkbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "kind", m.Kind) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) @@ -307,6 +327,7 @@ func (m MyWorkbookProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "displayName", m.DisplayName) populate(objectMap, "serializedData", m.SerializedData) populate(objectMap, "sourceId", m.SourceID) + populate(objectMap, "storageUri", m.StorageURI) populate(objectMap, "tags", m.Tags) populate(objectMap, "timeModified", m.TimeModified) populate(objectMap, "userId", m.UserID) @@ -317,7 +338,9 @@ func (m MyWorkbookProperties) MarshalJSON() ([]byte, error) { // MarshalJSON implements the json.Marshaller interface for type MyWorkbookResource. func (m MyWorkbookResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "tags", m.Tags) @@ -325,6 +348,53 @@ func (m MyWorkbookResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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]interface{}) @@ -332,6 +402,17 @@ func (t TagsResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) +} + // MarshalJSON implements the json.Marshaller interface for type WebTest. func (w WebTest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -386,11 +467,14 @@ func (w WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { // MarshalJSON implements the json.Marshaller interface for type Workbook. func (w Workbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + 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) @@ -400,20 +484,138 @@ func (w Workbook) MarshalJSON() ([]byte, error) { func (w WorkbookProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "category", w.Category) - populate(objectMap, "name", w.Name) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "revision", w.Revision) populate(objectMap, "serializedData", w.SerializedData) - populate(objectMap, "kind", w.SharedTypeKind) - populate(objectMap, "sourceResourceId", w.SourceResourceID) + populate(objectMap, "sourceId", w.SourceID) + populate(objectMap, "storageUri", w.StorageURI) populate(objectMap, "tags", w.Tags) - populate(objectMap, "timeModified", w.TimeModified) + populateTimeRFC3339(objectMap, "timeModified", w.TimeModified) populate(objectMap, "userId", w.UserID) populate(objectMap, "version", w.Version) - populate(objectMap, "workbookId", w.WorkbookID) + return json.Marshal(objectMap) +} + +// 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) + } + 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 "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 = unpopulateTimeRFC3339(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]interface{}) + 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) } // MarshalJSON implements the json.Marshaller interface for type WorkbookResource. func (w WorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookResourceIdentity. +func (w WorkbookResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", w.PrincipalID) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "type", w.Type) + populate(objectMap, "userAssignedIdentities", w.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplate. +func (w WorkbookTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateLocalizedGallery. +func (w WorkbookTemplateLocalizedGallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "galleries", w.Galleries) + populate(objectMap, "templateData", &w.TemplateData) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateProperties. +func (w WorkbookTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "author", w.Author) + populate(objectMap, "galleries", w.Galleries) + populate(objectMap, "localized", w.Localized) + populate(objectMap, "priority", w.Priority) + populate(objectMap, "templateData", &w.TemplateData) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateResource. +func (w WorkbookTemplateResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", w.ID) populate(objectMap, "location", w.Location) @@ -423,6 +625,23 @@ func (w WorkbookResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateUpdateParameters. +func (w WorkbookTemplateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookUpdateParameters. +func (w WorkbookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + func populate(m map[string]interface{}, k string, v interface{}) { if v == nil { return diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_myworkbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_myworkbooks_client.go index fb55f8b9f01c..827720d1fe73 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_myworkbooks_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_myworkbooks_client.go @@ -57,7 +57,7 @@ func NewMyWorkbooksClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Create a new private workbook. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-05-01 +// Generated from API version 2021-03-08 // 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. @@ -98,7 +98,10 @@ func (client *MyWorkbooksClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workbookProperties) @@ -115,7 +118,7 @@ func (client *MyWorkbooksClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Delete a private workbook. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-05-01 +// Generated from API version 2021-03-08 // 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. @@ -128,7 +131,7 @@ func (client *MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName s if err != nil { return MyWorkbooksClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return MyWorkbooksClientDeleteResponse{}, runtime.NewResponseError(resp) } return MyWorkbooksClientDeleteResponse{}, nil @@ -154,7 +157,7 @@ func (client *MyWorkbooksClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +165,7 @@ func (client *MyWorkbooksClient) deleteCreateRequest(ctx context.Context, resour // 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 +// Generated from API version 2021-03-08 // 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. @@ -201,7 +204,7 @@ func (client *MyWorkbooksClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +221,7 @@ func (client *MyWorkbooksClient) getHandleResponse(resp *http.Response) (MyWorkb // NewListByResourceGroupPager - Get all private workbooks defined within a specified resource group and category. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-05-01 +// Generated from API version 2021-03-08 // 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.ListByResourceGroup @@ -226,10 +229,16 @@ func (client *MyWorkbooksClient) getHandleResponse(resp *http.Response) (MyWorkb 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MyWorkbooksClientListByResourceGroupResponse) (MyWorkbooksClientListByResourceGroupResponse, error) { - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return MyWorkbooksClientListByResourceGroupResponse{}, err } @@ -265,10 +274,13 @@ func (client *MyWorkbooksClient) listByResourceGroupCreateRequest(ctx context.Co if options != nil && options.Tags != nil { reqQP.Set("tags", strings.Join(options.Tags, ",")) } + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } if options != nil && options.CanFetchContent != nil { reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) } - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,17 +297,23 @@ func (client *MyWorkbooksClient) listByResourceGroupHandleResponse(resp *http.Re // NewListBySubscriptionPager - Get all private workbooks defined within a specified subscription and category. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-05-01 +// Generated from API version 2021-03-08 // category - Category of workbook to return. // options - MyWorkbooksClientListBySubscriptionOptions contains the optional parameters for the MyWorkbooksClient.ListBySubscription // 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 + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MyWorkbooksClientListBySubscriptionResponse) (MyWorkbooksClientListBySubscriptionResponse, error) { - req, err := client.listBySubscriptionCreateRequest(ctx, category, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, category, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return MyWorkbooksClientListBySubscriptionResponse{}, err } @@ -330,7 +348,7 @@ func (client *MyWorkbooksClient) listBySubscriptionCreateRequest(ctx context.Con if options != nil && options.CanFetchContent != nil { reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) } - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +365,7 @@ func (client *MyWorkbooksClient) listBySubscriptionHandleResponse(resp *http.Res // 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 +// Generated from API version 2021-03-08 // 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. @@ -361,7 +379,7 @@ func (client *MyWorkbooksClient) Update(ctx context.Context, resourceGroupName s if err != nil { return MyWorkbooksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusCreated) { return MyWorkbooksClientUpdateResponse{}, runtime.NewResponseError(resp) } return client.updateHandleResponse(resp) @@ -387,7 +405,10 @@ func (client *MyWorkbooksClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } + reqQP.Set("api-version", "2021-03-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workbookProperties) diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_response_types.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_response_types.go index 6b1b15b2cb86..eccfe8c931d1 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_response_types.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_response_types.go @@ -91,6 +91,26 @@ type ComponentFeatureCapabilitiesClientGetResponse struct { ComponentFeatureCapabilities } +// ComponentLinkedStorageAccountsClientCreateAndUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.CreateAndUpdate. +type ComponentLinkedStorageAccountsClientCreateAndUpdateResponse struct { + 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 { + ComponentLinkedStorageAccounts +} + +// ComponentLinkedStorageAccountsClientUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.Update. +type ComponentLinkedStorageAccountsClientUpdateResponse struct { + ComponentLinkedStorageAccounts +} + // ComponentQuotaStatusClientGetResponse contains the response from method ComponentQuotaStatusClient.Get. type ComponentQuotaStatusClientGetResponse struct { ComponentQuotaStatus @@ -189,6 +209,11 @@ type FavoritesClientUpdateResponse struct { ComponentFavorite } +// LiveTokenClientGetResponse contains the response from method LiveTokenClient.Get. +type LiveTokenClientGetResponse struct { + LiveTokenResponse +} + // MyWorkbooksClientCreateOrUpdateResponse contains the response from method MyWorkbooksClient.CreateOrUpdate. type MyWorkbooksClientCreateOrUpdateResponse struct { MyWorkbook @@ -305,6 +330,31 @@ type WorkItemConfigurationsClientUpdateItemResponse struct { WorkItemConfiguration } +// WorkbookTemplatesClientCreateOrUpdateResponse contains the response from method WorkbookTemplatesClient.CreateOrUpdate. +type WorkbookTemplatesClientCreateOrUpdateResponse struct { + 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 { + WorkbookTemplate +} + +// WorkbookTemplatesClientListByResourceGroupResponse contains the response from method WorkbookTemplatesClient.ListByResourceGroup. +type WorkbookTemplatesClientListByResourceGroupResponse struct { + WorkbookTemplatesListResult +} + +// WorkbookTemplatesClientUpdateResponse contains the response from method WorkbookTemplatesClient.Update. +type WorkbookTemplatesClientUpdateResponse struct { + WorkbookTemplate +} + // WorkbooksClientCreateOrUpdateResponse contains the response from method WorkbooksClient.CreateOrUpdate. type WorkbooksClientCreateOrUpdateResponse struct { Workbook @@ -325,6 +375,21 @@ type WorkbooksClientListByResourceGroupResponse struct { WorkbooksListResult } +// WorkbooksClientListBySubscriptionResponse contains the response from method WorkbooksClient.ListBySubscription. +type WorkbooksClientListBySubscriptionResponse struct { + WorkbooksListResult +} + +// WorkbooksClientRevisionGetResponse contains the response from method WorkbooksClient.RevisionGet. +type WorkbooksClientRevisionGetResponse struct { + Workbook +} + +// WorkbooksClientRevisionsListResponse contains the response from method WorkbooksClient.RevisionsList. +type WorkbooksClientRevisionsListResponse struct { + WorkbooksListResult +} + // WorkbooksClientUpdateResponse contains the response from method WorkbooksClient.Update. type WorkbooksClientUpdateResponse struct { Workbook diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooks_client.go index 4554db3ef8f7..2b1690ce5b0a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooks_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooks_client.go @@ -57,9 +57,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 2022-04-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 resource. // workbookProperties - Properties that need to be specified to create a new workbook. // options - WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate // method. @@ -80,7 +80,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") } @@ -98,7 +98,10 @@ func (client *WorkbooksClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } + reqQP.Set("api-version", "2022-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, workbookProperties) @@ -115,9 +118,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 2022-04-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 resource. // 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) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) @@ -128,7 +131,7 @@ func (client *WorkbooksClient) Delete(ctx context.Context, resourceGroupName str if err != nil { return WorkbooksClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return WorkbooksClientDeleteResponse{}, runtime.NewResponseError(resp) } return WorkbooksClientDeleteResponse{}, nil @@ -136,7 +139,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") } @@ -154,7 +157,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", "2022-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,9 +165,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 2022-04-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 resource. // 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) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) @@ -183,7 +186,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") } @@ -201,7 +204,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", "2022-04-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 @@ -218,7 +224,7 @@ func (client *WorkbooksClient) getHandleResponse(resp *http.Response) (Workbooks // NewListByResourceGroupPager - Get all Workbooks defined within a specified resource group and category. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-05-01 +// Generated from API version 2022-04-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.ListByResourceGroup @@ -226,10 +232,16 @@ 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) { - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, category, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return WorkbooksClientListByResourceGroupResponse{}, err } @@ -247,7 +259,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") } @@ -265,10 +277,13 @@ func (client *WorkbooksClient) listByResourceGroupCreateRequest(ctx context.Cont if options != nil && options.Tags != nil { reqQP.Set("tags", strings.Join(options.Tags, ",")) } + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } if options != nil && options.CanFetchContent != nil { reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) } - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,15 +298,212 @@ func (client *WorkbooksClient) listByResourceGroupHandleResponse(resp *http.Resp return result, nil } +// NewListBySubscriptionPager - Get all Workbooks defined within a specified subscription and category. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-01 +// category - Category of workbook to return. +// options - WorkbooksClientListBySubscriptionOptions contains the optional parameters for the WorkbooksClient.ListBySubscription +// 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) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, category, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkbooksClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbooksClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbooksClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// 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.host, 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", "2022-04-01") + 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 2022-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the resource. +// 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) { + req, err := client.revisionGetCreateRequest(ctx, resourceGroupName, resourceName, revisionID, options) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbooksClientRevisionGetResponse{}, runtime.NewResponseError(resp) + } + return client.revisionGetHandleResponse(resp) +} + +// 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-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. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-04-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the resource. +// options - WorkbooksClientRevisionsListOptions contains the optional parameters for the WorkbooksClient.RevisionsList 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) { + var req *policy.Request + var err error + if page == nil { + req, err = client.revisionsListCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return WorkbooksClientRevisionsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbooksClientRevisionsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbooksClientRevisionsListResponse{}, runtime.NewResponseError(resp) + } + return client.revisionsListHandleResponse(resp) + }, + }) +} + +// 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-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 2022-04-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 resource. // 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) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) +func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientUpdateOptions) (WorkbooksClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkbooksClientUpdateResponse{}, err } @@ -299,15 +511,15 @@ func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName str if err != nil { return WorkbooksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusCreated) { return WorkbooksClientUpdateResponse{}, runtime.NewResponseError(resp) } return client.updateHandleResponse(resp) } // 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") } @@ -325,10 +537,16 @@ func (client *WorkbooksClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + if options != nil && options.SourceID != nil { + reqQP.Set("sourceId", *options.SourceID) + } + reqQP.Set("api-version", "2022-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, workbookProperties) + if options != nil && options.WorkbookUpdateParameters != nil { + return req, runtime.MarshalAsJSON(req, *options.WorkbookUpdateParameters) + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooktemplates_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooktemplates_client.go new file mode 100644 index 000000000000..b6817ad082fe --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/zz_generated_workbooktemplates_client.go @@ -0,0 +1,336 @@ +//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. + +package armapplicationinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &WorkbookTemplatesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookTemplateProperties, options) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// 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.host, 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, runtime.MarshalAsJSON(req, workbookTemplateProperties) +} + +// 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) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return WorkbookTemplatesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + 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.host, 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbookTemplatesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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.host, 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. +// 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. +// options - WorkbookTemplatesClientListByResourceGroupOptions contains the optional parameters for the WorkbookTemplatesClient.ListByResourceGroup +// 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) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbookTemplatesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// 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.host, 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) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbookTemplatesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// 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.host, 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 { + return req, runtime.MarshalAsJSON(req, *options.WorkbookTemplateUpdateParameters) + } + 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 +}