diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md index 591377c03dfc..6e9f9f062b4f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 2.0.0-beta.3 (2023-10-27) +### Breaking Changes + +- Field `InnerError` of struct `WorkbookErrorDefinition` has been removed + +### Features Added + +- New value `WebTestKindStandard` added to enum type `WebTestKind` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New struct `ErrorFieldContract` +- New struct `HeaderField` +- New struct `WebTestPropertiesRequest` +- New struct `WebTestPropertiesValidationRules` +- New struct `WebTestPropertiesValidationRulesContentValidation` +- New field `Details` in struct `ErrorResponse` +- New field `Request`, `ValidationRules` in struct `WebTestProperties` +- New field `Innererror` in struct `WorkbookErrorDefinition` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go index e87cdac27dd6..7e1d84dbc710 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -55,16 +54,18 @@ func NewAnalyticsItemsClient(subscriptionID string, credential azcore.TokenCrede // to the Application Insights component. // - options - AnalyticsItemsClientDeleteOptions contains the optional parameters for the AnalyticsItemsClient.Delete method. func (client *AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, options *AnalyticsItemsClientDeleteOptions) (AnalyticsItemsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, scopePath, options) if err != nil { return AnalyticsItemsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnalyticsItemsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnalyticsItemsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnalyticsItemsClientDeleteResponse{}, err } return AnalyticsItemsClientDeleteResponse{}, nil } @@ -114,18 +115,21 @@ func (client *AnalyticsItemsClient) deleteCreateRequest(ctx context.Context, res // to the Application Insights component. // - options - AnalyticsItemsClientGetOptions contains the optional parameters for the AnalyticsItemsClient.Get method. func (client *AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, options *AnalyticsItemsClientGetOptions) (AnalyticsItemsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, scopePath, options) if err != nil { return AnalyticsItemsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnalyticsItemsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnalyticsItemsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnalyticsItemsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -183,18 +187,21 @@ func (client *AnalyticsItemsClient) getHandleResponse(resp *http.Response) (Anal // to the Application Insights component. // - options - AnalyticsItemsClientListOptions contains the optional parameters for the AnalyticsItemsClient.List method. func (client *AnalyticsItemsClient) List(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, options *AnalyticsItemsClientListOptions) (AnalyticsItemsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, scopePath, options) if err != nil { return AnalyticsItemsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnalyticsItemsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnalyticsItemsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnalyticsItemsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -256,18 +263,21 @@ func (client *AnalyticsItemsClient) listHandleResponse(resp *http.Response) (Ana // - itemProperties - Properties that need to be specified to create a new item and add it to an Application Insights component. // - options - AnalyticsItemsClientPutOptions contains the optional parameters for the AnalyticsItemsClient.Put method. func (client *AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ComponentAnalyticsItem, options *AnalyticsItemsClientPutOptions) (AnalyticsItemsClientPutResponse, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, resourceName, scopePath, itemProperties, options) if err != nil { return AnalyticsItemsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnalyticsItemsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnalyticsItemsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnalyticsItemsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -300,7 +310,10 @@ func (client *AnalyticsItemsClient) putCreateRequest(ctx context.Context, resour } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, itemProperties) + if err := runtime.MarshalAsJSON(req, itemProperties); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go deleted file mode 100644 index bf67c3157498..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/analyticsitems_client_example_test.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemList.json -func ExampleAnalyticsItemsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalyticsItemsClient().List(ctx, "my-resource-group", "my-component", armapplicationinsights.ItemScopePathAnalyticsItems, &armapplicationinsights.AnalyticsItemsClientListOptions{Scope: nil, - Type: nil, - IncludeContent: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAnalyticsItemArray = []*armapplicationinsights.ComponentAnalyticsItem{ - // { - // Content: to.Ptr("//Top 10 countries by traffic in the past 24 hours\nrequests \n | where timestamp > ago(24h) \n | summarize count() by client_CountryOrRegion\n | top 10 by count_ \n | render piechart"), - // ID: to.Ptr("b753348d-333a-4678-a684-c0e9090713b7"), - // Name: to.Ptr("1"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeModified: to.Ptr("2017-06-29T10:27:03Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("//Top 10 countries by traffic in the past 24 hours\nrequests \n | where timestamp > ago(24h) \n | summarize count() by client_CountryOrRegion\n | top 10 by count_ \n | render piechart"), - // ID: to.Ptr("0d2f1b19-04b2-4c93-bc6f-2466b23c5284"), - // Name: to.Ptr("4"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeModified: to.Ptr("2017-06-29T10:27:13Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("//Top 10 countries by traffic in the past 24 hours\nrequests \n | where timestamp > ago(24h) \n | summarize count() by client_CountryOrRegion\n | top 10 by count_ \n | render piechart"), - // ID: to.Ptr("3d17bebb-0b20-4b58-9bbd-22aeed70be51"), - // Name: to.Ptr("2"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeModified: to.Ptr("2018-02-10T23:21:05.9952874Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("//Top 10 countries by traffic in the past 24 hours\nrequests \n | where timestamp > ago(24h) \n | summarize count() by client_CountryOrRegion\n | top 10 by count_ \n | render piechart"), - // ID: to.Ptr("2be491c6-10d9-4cf6-9490-2a7ce7270c54"), - // Name: to.Ptr("5"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeModified: to.Ptr("2017-06-29T10:27:17Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("//Top 10 countries by traffic in the past 24 hours\nrequests \n | where timestamp > ago(24h) \n | summarize count() by client_CountryOrRegion\n | top 10 by count_ \n | render piechart"), - // ID: to.Ptr("d8f83601-4a40-4dc1-8516-0a28dcb74420"), - // Name: to.Ptr("8"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeCreated: to.Ptr("2018-02-10T23:20:19.0174631Z"), - // TimeModified: to.Ptr("2018-02-10T23:20:19.0174631Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("let newExceptionsTimeRange = 7d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"), - // ID: to.Ptr("fd3afe4d-9139-4c76-9b47-81d0fada977b"), - // Name: to.Ptr("Exceptions - New in the last 7 days"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeUser), - // TimeCreated: to.Ptr("2018-02-11T22:05:57.6019354Z"), - // TimeModified: to.Ptr("2018-02-12T11:01:15.5687326Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }, - // { - // Content: to.Ptr("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"), - // ID: to.Ptr("3466c160-4a10-4df8-afdf-0007f3f6dee5"), - // Name: to.Ptr("Exceptions - New in the last 24 hours"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeShared), - // TimeCreated: to.Ptr("2018-02-12T11:44:39.2980634Z"), - // TimeModified: to.Ptr("2018-02-14T13:13:19.3381394Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemGet.json -func ExampleAnalyticsItemsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalyticsItemsClient().Get(ctx, "my-resource-group", "my-component", armapplicationinsights.ItemScopePathAnalyticsItems, &armapplicationinsights.AnalyticsItemsClientGetOptions{ID: to.Ptr("3466c160-4a10-4df8-afdf-0007f3f6dee5"), - Name: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAnalyticsItem = armapplicationinsights.ComponentAnalyticsItem{ - // Content: to.Ptr("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"), - // ID: to.Ptr("3466c160-4a10-4df8-afdf-0007f3f6dee5"), - // Name: to.Ptr("Exceptions - New in the last 24 hours"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeShared), - // TimeCreated: to.Ptr("2018-02-12T11:44:39.2980634Z"), - // TimeModified: to.Ptr("2018-02-14T13:13:19.3381394Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemPut.json -func ExampleAnalyticsItemsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalyticsItemsClient().Put(ctx, "my-resource-group", "my-component", armapplicationinsights.ItemScopePathAnalyticsItems, armapplicationinsights.ComponentAnalyticsItem{ - Content: to.Ptr("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"), - Name: to.Ptr("Exceptions - New in the last 24 hours"), - Scope: to.Ptr(armapplicationinsights.ItemScopeShared), - Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - }, &armapplicationinsights.AnalyticsItemsClientPutOptions{OverrideItem: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAnalyticsItem = armapplicationinsights.ComponentAnalyticsItem{ - // Content: to.Ptr("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"), - // ID: to.Ptr("3466c160-4a10-4df8-afdf-0007f3f6dee5"), - // Name: to.Ptr("Exceptions - New in the last 24 hours"), - // Scope: to.Ptr(armapplicationinsights.ItemScopeShared), - // TimeCreated: to.Ptr("2018-02-12T11:44:39.2980634Z"), - // TimeModified: to.Ptr("2018-02-14T13:13:19.3381394Z"), - // Type: to.Ptr(armapplicationinsights.ItemTypeQuery), - // Version: to.Ptr("1.0"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemDelete.json -func ExampleAnalyticsItemsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAnalyticsItemsClient().Delete(ctx, "my-resource-group", "my-component", armapplicationinsights.ItemScopePathAnalyticsItems, &armapplicationinsights.AnalyticsItemsClientDeleteOptions{ID: to.Ptr("3466c160-4a10-4df8-afdf-0007f3f6dee5"), - Name: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go index ea158b86f75d..77f6a1bf8f45 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewAnnotationsClient(subscriptionID string, credential azcore.TokenCredenti // - annotationProperties - Properties that need to be specified to create an annotation of a Application Insights component. // - options - AnnotationsClientCreateOptions contains the optional parameters for the AnnotationsClient.Create method. func (client *AnnotationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation, options *AnnotationsClientCreateOptions) (AnnotationsClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, resourceName, annotationProperties, options) if err != nil { return AnnotationsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnnotationsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnnotationsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnnotationsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -90,7 +92,10 @@ func (client *AnnotationsClient) createCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, annotationProperties) + if err := runtime.MarshalAsJSON(req, annotationProperties); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -111,16 +116,18 @@ func (client *AnnotationsClient) createHandleResponse(resp *http.Response) (Anno // - annotationID - The unique annotation ID. This is unique within a Application Insights component. // - options - AnnotationsClientDeleteOptions contains the optional parameters for the AnnotationsClient.Delete method. func (client *AnnotationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string, options *AnnotationsClientDeleteOptions) (AnnotationsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, annotationID, options) if err != nil { return AnnotationsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnnotationsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnnotationsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnnotationsClientDeleteResponse{}, err } return AnnotationsClientDeleteResponse{}, nil } @@ -163,18 +170,21 @@ func (client *AnnotationsClient) deleteCreateRequest(ctx context.Context, resour // - annotationID - The unique annotation ID. This is unique within a Application Insights component. // - options - AnnotationsClientGetOptions contains the optional parameters for the AnnotationsClient.Get method. func (client *AnnotationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string, options *AnnotationsClientGetOptions) (AnnotationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, annotationID, options) if err != nil { return AnnotationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnnotationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnnotationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnnotationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go deleted file mode 100644 index d011da79f3ac..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/annotations_client_example_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsList.json -func ExampleAnnotationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAnnotationsClient().NewListPager("my-resource-group", "my-component", "2018-02-05T00%253A30%253A00.000Z", "2018-02-06T00%253A33A00.000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AnnotationsListResult = armapplicationinsights.AnnotationsListResult{ - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsCreate.json -func ExampleAnnotationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnnotationsClient().Create(ctx, "my-resource-group", "my-component", armapplicationinsights.Annotation{ - AnnotationName: to.Ptr("TestAnnotation"), - Category: to.Ptr("Text"), - EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-31T13:41:38.657Z"); return t }()), - ID: to.Ptr("444e2c08-274a-4bbb-a89e-d77bb720f44a"), - Properties: to.Ptr("{\"Comments\":\"Testing\",\"Label\":\"Success\"}"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnnotationArray = []*armapplicationinsights.Annotation{ - // { - // AnnotationName: to.Ptr("TestAnnotation"), - // Category: to.Ptr("Text"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-31T13:41:38.657+00:00"); return t}()), - // ID: to.Ptr("444e2c08-274a-4bbb-a89e-d77bb720f44a"), - // Properties: to.Ptr("{\"Comments\":\"Testing\",\"Label\":\"Success\"}"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsDelete.json -func ExampleAnnotationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAnnotationsClient().Delete(ctx, "my-resource-group", "my-component", "bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsGet.json -func ExampleAnnotationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnnotationsClient().Get(ctx, "my-resource-group", "my-component", "444e2c08-274a-4bbb-a89e-d77bb720f44a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnnotationArray = []*armapplicationinsights.Annotation{ - // { - // AnnotationName: to.Ptr("TestAnnotation"), - // Category: to.Ptr("Text"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-31T13:41:38.657+00:00"); return t}()), - // ID: to.Ptr("444e2c08-274a-4bbb-a89e-d77bb720f44a"), - // Properties: to.Ptr("{\"Comments\":\"Testing\",\"Label\":\"Success\"}"), - // }} -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client.go index be17d5d649fe..b5f79ed191b5 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewAPIKeysClient(subscriptionID string, credential azcore.TokenCredential, // - apiKeyProperties - Properties that need to be specified to create an API key of a Application Insights component. // - options - APIKeysClientCreateOptions contains the optional parameters for the APIKeysClient.Create method. func (client *APIKeysClient) Create(ctx context.Context, resourceGroupName string, resourceName string, apiKeyProperties APIKeyRequest, options *APIKeysClientCreateOptions) (APIKeysClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, resourceName, apiKeyProperties, options) if err != nil { return APIKeysClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIKeysClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIKeysClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -90,7 +92,10 @@ func (client *APIKeysClient) createCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, apiKeyProperties) + if err := runtime.MarshalAsJSON(req, apiKeyProperties); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -111,18 +116,21 @@ func (client *APIKeysClient) createHandleResponse(resp *http.Response) (APIKeysC // - keyID - The API Key ID. This is unique within a Application Insights component. // - options - APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. func (client *APIKeysClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string, options *APIKeysClientDeleteOptions) (APIKeysClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, keyID, options) if err != nil { return APIKeysClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIKeysClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIKeysClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -173,18 +181,21 @@ func (client *APIKeysClient) deleteHandleResponse(resp *http.Response) (APIKeysC // - keyID - The API Key ID. This is unique within a Application Insights component. // - options - APIKeysClientGetOptions contains the optional parameters for the APIKeysClient.Get method. func (client *APIKeysClient) Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string, options *APIKeysClientGetOptions) (APIKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, keyID, options) if err != nil { return APIKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return APIKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return APIKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go deleted file mode 100644 index ff80fe32b077..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/apikeys_client_example_test.go +++ /dev/null @@ -1,181 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysList.json -func ExampleAPIKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAPIKeysClient().NewListPager("my-resource-group", "my-component", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ComponentAPIKeyListResult = armapplicationinsights.ComponentAPIKeyListResult{ - // Value: []*armapplicationinsights.ComponentAPIKey{ - // { - // Name: to.Ptr("test"), - // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:58:52 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/fe2e0138-47c1-46c5-8726-872f54c1ca08"), - // LinkedReadProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/draft"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/extendqueries"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/search"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/aggregate"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - // LinkedWriteProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/annotations")}, - // }, - // { - // Name: to.Ptr("test2"), - // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:59:18 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a"), - // LinkedReadProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/draft"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/extendqueries"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/search"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/aggregate"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - // LinkedWriteProperties: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysCreate.json -func ExampleAPIKeysClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIKeysClient().Create(ctx, "my-resource-group", "my-component", armapplicationinsights.APIKeyRequest{ - Name: to.Ptr("test2"), - LinkedReadProperties: []*string{ - to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - LinkedWriteProperties: []*string{ - to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/annotations")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAPIKey = armapplicationinsights.ComponentAPIKey{ - // Name: to.Ptr("test"), - // APIKey: to.Ptr("eip8wlzuzlf4wzczhnzao54zcswew25azs4kadhb"), - // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:58:52 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/fe2e0138-47c1-46c5-8726-872f54c1ca08"), - // LinkedReadProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - // LinkedWriteProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/annotations")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysDelete.json -func ExampleAPIKeysClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIKeysClient().Delete(ctx, "my-resource-group", "my-component", "bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAPIKey = armapplicationinsights.ComponentAPIKey{ - // Name: to.Ptr("test2"), - // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:59:18 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a"), - // LinkedReadProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/draft"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/extendqueries"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/search"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/aggregate"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - // LinkedWriteProperties: []*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysGet.json -func ExampleAPIKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAPIKeysClient().Get(ctx, "my-resource-group", "my-component", "bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAPIKey = armapplicationinsights.ComponentAPIKey{ - // Name: to.Ptr("test2"), - // CreatedDate: to.Ptr("Thu, 28 Sep 2017 16:59:18 GMT"), - // ID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/Microsoft.Insights/components/my-component/apikeys/bb820f1b-3110-4a8b-ba2c-8c1129d7eb6a"), - // LinkedReadProperties: []*string{ - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/api"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/draft"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/extendqueries"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/search"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/aggregate"), - // to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component/agentconfig")}, - // LinkedWriteProperties: []*string{ - // }, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md index 13ffcfc32464..f9a4579f00f6 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 -tag: package-2020-02-02 +module-version: 2.0.0-beta.3 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go index f484711feb3d..a5bd92b09792 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -38,28 +37,28 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewAnnotationsClient() *AnnotationsClient { - subClient, _ := NewAnnotationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAPIKeysClient() *APIKeysClient { + subClient, _ := NewAPIKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAPIKeysClient() *APIKeysClient { - subClient, _ := NewAPIKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAnalyticsItemsClient() *AnalyticsItemsClient { + subClient, _ := NewAnalyticsItemsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportConfigurationsClient() *ExportConfigurationsClient { - subClient, _ := NewExportConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAnnotationsClient() *AnnotationsClient { + subClient, _ := NewAnnotationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewComponentCurrentBillingFeaturesClient() *ComponentCurrentBillingFeaturesClient { - subClient, _ := NewComponentCurrentBillingFeaturesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewComponentAvailableFeaturesClient() *ComponentAvailableFeaturesClient { + subClient, _ := NewComponentAvailableFeaturesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewComponentQuotaStatusClient() *ComponentQuotaStatusClient { - subClient, _ := NewComponentQuotaStatusClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewComponentCurrentBillingFeaturesClient() *ComponentCurrentBillingFeaturesClient { + subClient, _ := NewComponentCurrentBillingFeaturesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -68,18 +67,23 @@ func (c *ClientFactory) NewComponentFeatureCapabilitiesClient() *ComponentFeatur return subClient } -func (c *ClientFactory) NewComponentAvailableFeaturesClient() *ComponentAvailableFeaturesClient { - subClient, _ := NewComponentAvailableFeaturesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewComponentLinkedStorageAccountsClient() *ComponentLinkedStorageAccountsClient { + subClient, _ := NewComponentLinkedStorageAccountsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewProactiveDetectionConfigurationsClient() *ProactiveDetectionConfigurationsClient { - subClient, _ := NewProactiveDetectionConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewComponentQuotaStatusClient() *ComponentQuotaStatusClient { + subClient, _ := NewComponentQuotaStatusClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewWorkItemConfigurationsClient() *WorkItemConfigurationsClient { - subClient, _ := NewWorkItemConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewComponentsClient() *ComponentsClient { + subClient, _ := NewComponentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExportConfigurationsClient() *ExportConfigurationsClient { + subClient, _ := NewExportConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -88,6 +92,26 @@ func (c *ClientFactory) NewFavoritesClient() *FavoritesClient { return subClient } +func (c *ClientFactory) NewLiveTokenClient() *LiveTokenClient { + subClient, _ := NewLiveTokenClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewMyWorkbooksClient() *MyWorkbooksClient { + subClient, _ := NewMyWorkbooksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProactiveDetectionConfigurationsClient() *ProactiveDetectionConfigurationsClient { + subClient, _ := NewProactiveDetectionConfigurationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewWebTestLocationsClient() *WebTestLocationsClient { subClient, _ := NewWebTestLocationsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -98,22 +122,17 @@ func (c *ClientFactory) NewWebTestsClient() *WebTestsClient { return subClient } -func (c *ClientFactory) NewAnalyticsItemsClient() *AnalyticsItemsClient { - subClient, _ := NewAnalyticsItemsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewWorkbooksClient() *WorkbooksClient { - subClient, _ := NewWorkbooksClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWorkItemConfigurationsClient() *WorkItemConfigurationsClient { + subClient, _ := NewWorkItemConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMyWorkbooksClient() *MyWorkbooksClient { - subClient, _ := NewMyWorkbooksClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWorkbookTemplatesClient() *WorkbookTemplatesClient { + subClient, _ := NewWorkbookTemplatesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewComponentsClient() *ComponentsClient { - subClient, _ := NewComponentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWorkbooksClient() *WorkbooksClient { + subClient, _ := NewWorkbooksClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client.go index 93d57b6ba74d..ae5ef438c78e 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewComponentAvailableFeaturesClient(subscriptionID string, credential azcor // - options - ComponentAvailableFeaturesClientGetOptions contains the optional parameters for the ComponentAvailableFeaturesClient.Get // method. func (client *ComponentAvailableFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentAvailableFeaturesClientGetOptions) (ComponentAvailableFeaturesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentAvailableFeaturesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentAvailableFeaturesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentAvailableFeaturesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentAvailableFeaturesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go deleted file mode 100644 index 0d2aec46f546..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentavailablefeatures_client_example_test.go +++ /dev/null @@ -1,224 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AvailableBillingFeaturesGet.json -func ExampleComponentAvailableFeaturesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentAvailableFeaturesClient().Get(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentAvailableFeatures = armapplicationinsights.ComponentAvailableFeatures{ - // Result: []*armapplicationinsights.ComponentFeature{ - // { - // Capabilities: []*armapplicationinsights.ComponentFeatureCapability{ - // { - // Description: to.Ptr("Number of application hosts"), - // Name: to.Ptr("hostnumber"), - // Value: to.Ptr("Unlimited"), - // }, - // { - // Description: to.Ptr("Included data"), - // MeterID: to.Ptr("acf26b15-ee92-440d-9973-9a72d77641aa"), - // MeterRateFrequency: to.Ptr("GB/month"), - // Name: to.Ptr("includeddata"), - // Value: to.Ptr("1"), - // }, - // { - // Description: to.Ptr("Additional data"), - // MeterID: to.Ptr("b90f8b65-6c3e-43fc-9149-bdfc73b6a5b9"), - // MeterRateFrequency: to.Ptr("/GB"), - // Name: to.Ptr("additionaldata"), - // }, - // { - // Description: to.Ptr("Data retention"), - // Name: to.Ptr("dataretention"), - // Unit: to.Ptr("days"), - // Value: to.Ptr("90"), - // }, - // { - // Description: to.Ptr("Response time monitoring and diagnostics"), - // Name: to.Ptr("responsetimemonitoring"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Failed requests monitoring and diagnostics"), - // Name: to.Ptr("failedrequestsmonitoring"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Browser performance"), - // Name: to.Ptr("browserperformance"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Usage analysis"), - // Name: to.Ptr("usageanalysis"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Server monitoring"), - // Name: to.Ptr("servermonitoring"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Alerting and notifications"), - // Name: to.Ptr("alertingandnotifications"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Daily notification of failed request rate spikes"), - // Name: to.Ptr("notificationfailedrequestrate"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Telemetry analyzer"), - // Name: to.Ptr("telemetryanalyzer"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Search and Analytics"), - // Name: to.Ptr("searchandanalytics"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Web tests (multi-step tests)"), - // MeterID: to.Ptr("0aa0e0e9-3f58-4dcf-9bb0-9db7ae1d5954"), - // MeterRateFrequency: to.Ptr("/test (per month)"), - // Name: to.Ptr("webtests"), - // }, - // { - // Description: to.Ptr("Live stream metrics"), - // Name: to.Ptr("livestreammetrics"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Application map"), - // Name: to.Ptr("applicationmap"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Daily notification for many key metrics"), - // Name: to.Ptr("dailynotificationforkeymetrics"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Work item integration"), - // Name: to.Ptr("workitemintegration"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("API access"), - // Name: to.Ptr("apiaccess"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Power BI integration"), - // Name: to.Ptr("powerbiintegration"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Bulk data import"), - // Name: to.Ptr("bulkdataimport"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Automatic data evaluation"), - // Name: to.Ptr("automaticdataevaluation"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Analytics integration with Azure dashboards"), - // Name: to.Ptr("analyticsintegration"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Continuous export"), - // MeterID: to.Ptr("90fa4d31-3ea2-4178-a894-ec4c76c712b2"), - // MeterRateFrequency: to.Ptr("/GB"), - // Name: to.Ptr("continuousexport"), - // Value: to.Ptr("Enabled"), - // }, - // { - // Description: to.Ptr("Default daily cap"), - // Name: to.Ptr("defaultdailycap"), - // Unit: to.Ptr("G"), - // Value: to.Ptr("100"), - // }, - // { - // Description: to.Ptr("Default maximum daily cap"), - // Name: to.Ptr("defaultmaxdailycap"), - // Unit: to.Ptr("G"), - // Value: to.Ptr("1000"), - // }}, - // FeatureName: to.Ptr("Basic"), - // IsHidden: to.Ptr(true), - // IsMainFeature: to.Ptr(true), - // MeterID: to.Ptr("c9a05f12-4910-4527-a9ec-1db4e4dba60e"), - // MeterRateFrequency: to.Ptr("/month"), - // SupportedAddonFeatures: to.Ptr("Application Insights Enterprise"), - // Title: to.Ptr("Application Insights Basic"), - // }, - // { - // Capabilities: []*armapplicationinsights.ComponentFeatureCapability{ - // { - // Description: to.Ptr("Enterprise Included data"), - // MeterID: to.Ptr("acf26b15-ee92-440d-9973-9a72d77641aa"), - // MeterRateFrequency: to.Ptr("GB/month"), - // Name: to.Ptr("enterpriseincludeddata"), - // Value: to.Ptr("0.20"), - // }, - // { - // Description: to.Ptr("Enterprise Additional data"), - // MeterID: to.Ptr("3fedc88a-b68f-4936-bbf0-f290a254388c"), - // MeterRateFrequency: to.Ptr("/GB"), - // Name: to.Ptr("enterpriseadditionaldata"), - // }, - // { - // Description: to.Ptr("Default daily cap"), - // Name: to.Ptr("defaultdailycap"), - // Unit: to.Ptr("G"), - // Value: to.Ptr("100"), - // }, - // { - // Description: to.Ptr("Default maximum daily cap"), - // Name: to.Ptr("defaultmaxdailycap"), - // Unit: to.Ptr("G"), - // Value: to.Ptr("1000"), - // }}, - // FeatureName: to.Ptr("Application Insights Enterprise"), - // IsHidden: to.Ptr(false), - // IsMainFeature: to.Ptr(false), - // MeterID: to.Ptr("222f32c5-a319-4787-b934-5fb95105b2c8"), - // MeterRateFrequency: to.Ptr("/node/month"), - // Title: to.Ptr("Enterprise"), - // }}, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client.go index 34573fb55ba5..bf7b1a189b7f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewComponentCurrentBillingFeaturesClient(subscriptionID string, credential // - options - ComponentCurrentBillingFeaturesClientGetOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Get // method. func (client *ComponentCurrentBillingFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentCurrentBillingFeaturesClientGetOptions) (ComponentCurrentBillingFeaturesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentCurrentBillingFeaturesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentCurrentBillingFeaturesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentCurrentBillingFeaturesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentCurrentBillingFeaturesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -113,18 +115,21 @@ func (client *ComponentCurrentBillingFeaturesClient) getHandleResponse(resp *htt // - options - ComponentCurrentBillingFeaturesClientUpdateOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Update // method. func (client *ComponentCurrentBillingFeaturesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ComponentBillingFeatures, options *ComponentCurrentBillingFeaturesClientUpdateOptions) (ComponentCurrentBillingFeaturesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, billingFeaturesProperties, options) if err != nil { return ComponentCurrentBillingFeaturesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentCurrentBillingFeaturesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentCurrentBillingFeaturesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentCurrentBillingFeaturesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -150,7 +155,10 @@ func (client *ComponentCurrentBillingFeaturesClient) updateCreateRequest(ctx con reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, billingFeaturesProperties) + if err := runtime.MarshalAsJSON(req, billingFeaturesProperties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go deleted file mode 100644 index a98a751d8e33..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentcurrentbillingfeatures_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesGet.json -func ExampleComponentCurrentBillingFeaturesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentCurrentBillingFeaturesClient().Get(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentBillingFeatures = armapplicationinsights.ComponentBillingFeatures{ - // CurrentBillingFeatures: []*string{ - // to.Ptr("Basic")}, - // DataVolumeCap: &armapplicationinsights.ComponentDataVolumeCap{ - // Cap: to.Ptr[float32](500), - // MaxHistoryCap: to.Ptr[float32](500), - // ResetTime: to.Ptr[int32](16), - // StopSendNotificationWhenHitCap: to.Ptr(false), - // StopSendNotificationWhenHitThreshold: to.Ptr(false), - // WarningThreshold: to.Ptr[int32](90), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesUpdate.json -func ExampleComponentCurrentBillingFeaturesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentCurrentBillingFeaturesClient().Update(ctx, "my-resource-group", "my-component", armapplicationinsights.ComponentBillingFeatures{ - CurrentBillingFeatures: []*string{ - to.Ptr("Basic"), - to.Ptr("Application Insights Enterprise")}, - DataVolumeCap: &armapplicationinsights.ComponentDataVolumeCap{ - Cap: to.Ptr[float32](100), - StopSendNotificationWhenHitCap: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentBillingFeatures = armapplicationinsights.ComponentBillingFeatures{ - // CurrentBillingFeatures: []*string{ - // to.Ptr("Basic"), - // to.Ptr("Application Insights Enterprise")}, - // DataVolumeCap: &armapplicationinsights.ComponentDataVolumeCap{ - // Cap: to.Ptr[float32](100), - // MaxHistoryCap: to.Ptr[float32](500), - // ResetTime: to.Ptr[int32](16), - // StopSendNotificationWhenHitCap: to.Ptr(true), - // StopSendNotificationWhenHitThreshold: to.Ptr(false), - // WarningThreshold: to.Ptr[int32](90), - // }, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client.go index 39e8d2f2aa14..94766963303d 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewComponentFeatureCapabilitiesClient(subscriptionID string, credential azc // - options - ComponentFeatureCapabilitiesClientGetOptions contains the optional parameters for the ComponentFeatureCapabilitiesClient.Get // method. func (client *ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentFeatureCapabilitiesClientGetOptions) (ComponentFeatureCapabilitiesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentFeatureCapabilitiesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentFeatureCapabilitiesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentFeatureCapabilitiesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentFeatureCapabilitiesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go deleted file mode 100644 index 2bec2d8f6a94..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentfeaturecapabilities_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FeatureCapabilitiesGet.json -func ExampleComponentFeatureCapabilitiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentFeatureCapabilitiesClient().Get(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentFeatureCapabilities = armapplicationinsights.ComponentFeatureCapabilities{ - // AnalyticsIntegration: to.Ptr(true), - // APIAccessLevel: to.Ptr("Premium"), - // ApplicationMap: to.Ptr(true), - // BurstThrottlePolicy: to.Ptr("B2"), - // DailyCap: to.Ptr[float32](0.0323), - // DailyCapResetTime: to.Ptr[float32](4), - // LiveStreamMetrics: to.Ptr(true), - // MultipleStepWebTest: to.Ptr(true), - // OpenSchema: to.Ptr(true), - // PowerBIIntegration: to.Ptr(true), - // ProactiveDetection: to.Ptr(false), - // SupportExportData: to.Ptr(true), - // ThrottleRate: to.Ptr[float32](0), - // TrackingType: to.Ptr("Basic"), - // WorkItemIntegration: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go new file mode 100644 index 000000000000..411870aad096 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentlinkedstorageaccounts_client.go @@ -0,0 +1,308 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapplicationinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ComponentLinkedStorageAccountsClient contains the methods for the ComponentLinkedStorageAccounts group. +// Don't use this type directly, use NewComponentLinkedStorageAccountsClient() instead. +type ComponentLinkedStorageAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewComponentLinkedStorageAccountsClient creates a new instance of ComponentLinkedStorageAccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewComponentLinkedStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ComponentLinkedStorageAccountsClient, error) { + cl, err := arm.NewClient(moduleName+".ComponentLinkedStorageAccountsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ComponentLinkedStorageAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateAndUpdate - Replace current linked storage account for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - linkedStorageAccountsProperties - Properties that need to be specified to update linked storage accounts for an Application +// Insights component. +// - options - ComponentLinkedStorageAccountsClientCreateAndUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.CreateAndUpdate +// method. +func (client *ComponentLinkedStorageAccountsClient) CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccounts, options *ComponentLinkedStorageAccountsClientCreateAndUpdateOptions) (ComponentLinkedStorageAccountsClientCreateAndUpdateResponse, error) { + var err error + req, err := client.createAndUpdateCreateRequest(ctx, resourceGroupName, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + resp, err := client.createAndUpdateHandleResponse(httpResp) + return resp, err +} + +// createAndUpdateCreateRequest creates the CreateAndUpdate request. +func (client *ComponentLinkedStorageAccountsClient) createAndUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccounts, options *ComponentLinkedStorageAccountsClientCreateAndUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, linkedStorageAccountsProperties); err != nil { + return nil, err + } + return req, nil +} + +// createAndUpdateHandleResponse handles the CreateAndUpdate response. +func (client *ComponentLinkedStorageAccountsClient) createAndUpdateHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientCreateAndUpdateResponse, error) { + result := ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientCreateAndUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete linked storage accounts for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - options - ComponentLinkedStorageAccountsClientDeleteOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Delete +// method. +func (client *ComponentLinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientDeleteOptions) (ComponentLinkedStorageAccountsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientDeleteResponse{}, err + } + return ComponentLinkedStorageAccountsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ComponentLinkedStorageAccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the current linked storage settings for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - options - ComponentLinkedStorageAccountsClientGetOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Get +// method. +func (client *ComponentLinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientGetOptions) (ComponentLinkedStorageAccountsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, storageType, options) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ComponentLinkedStorageAccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, options *ComponentLinkedStorageAccountsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ComponentLinkedStorageAccountsClient) getHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientGetResponse, error) { + result := ComponentLinkedStorageAccountsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientGetResponse{}, err + } + return result, nil +} + +// Update - Update linked storage accounts for an Application Insights component. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - storageType - The type of the Application Insights component data source for the linked storage account. +// - linkedStorageAccountsProperties - Properties that need to be specified to update a linked storage accounts for an Application +// Insights component. +// - options - ComponentLinkedStorageAccountsClientUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Update +// method. +func (client *ComponentLinkedStorageAccountsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch, options *ComponentLinkedStorageAccountsClientUpdateOptions) (ComponentLinkedStorageAccountsClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, storageType, linkedStorageAccountsProperties, options) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ComponentLinkedStorageAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, storageType StorageType, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch, options *ComponentLinkedStorageAccountsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if storageType == "" { + return nil, errors.New("parameter storageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageType}", url.PathEscape(string(storageType))) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, linkedStorageAccountsProperties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ComponentLinkedStorageAccountsClient) updateHandleResponse(resp *http.Response) (ComponentLinkedStorageAccountsClientUpdateResponse, error) { + result := ComponentLinkedStorageAccountsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComponentLinkedStorageAccounts); err != nil { + return ComponentLinkedStorageAccountsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client.go index f04ed9ec11ec..3f8cde48725f 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -53,18 +52,21 @@ func NewComponentQuotaStatusClient(subscriptionID string, credential azcore.Toke // - options - ComponentQuotaStatusClientGetOptions contains the optional parameters for the ComponentQuotaStatusClient.Get // method. func (client *ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentQuotaStatusClientGetOptions) (ComponentQuotaStatusClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentQuotaStatusClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentQuotaStatusClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentQuotaStatusClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentQuotaStatusClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go deleted file mode 100644 index a017fb3ba42e..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/componentquotastatus_client_example_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/QuotaStatusGet.json -func ExampleComponentQuotaStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentQuotaStatusClient().Get(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentQuotaStatus = armapplicationinsights.ComponentQuotaStatus{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ExpirationTime: to.Ptr("2017-08-10T05:00:00"), - // ShouldBeThrottled: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go index f5b5e09c8f69..50872d960ab7 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -55,18 +54,21 @@ func NewComponentsClient(subscriptionID string, credential azcore.TokenCredentia // - options - ComponentsClientCreateOrUpdateOptions contains the optional parameters for the ComponentsClient.CreateOrUpdate // method. func (client *ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties Component, options *ComponentsClientCreateOrUpdateOptions) (ComponentsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, insightProperties, options) if err != nil { return ComponentsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -92,7 +94,10 @@ func (client *ComponentsClient) createOrUpdateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2020-02-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, insightProperties) + if err := runtime.MarshalAsJSON(req, insightProperties); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,16 +117,18 @@ func (client *ComponentsClient) createOrUpdateHandleResponse(resp *http.Response // - resourceName - The name of the Application Insights component resource. // - options - ComponentsClientDeleteOptions contains the optional parameters for the ComponentsClient.Delete method. func (client *ComponentsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentsClientDeleteOptions) (ComponentsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ComponentsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientDeleteResponse{}, err } return ComponentsClientDeleteResponse{}, nil } @@ -160,18 +167,21 @@ func (client *ComponentsClient) deleteCreateRequest(ctx context.Context, resourc // - resourceName - The name of the Application Insights component resource. // - options - ComponentsClientGetOptions contains the optional parameters for the ComponentsClient.Get method. func (client *ComponentsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ComponentsClientGetOptions) (ComponentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ComponentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -219,18 +229,21 @@ func (client *ComponentsClient) getHandleResponse(resp *http.Response) (Componen // - options - ComponentsClientGetPurgeStatusOptions contains the optional parameters for the ComponentsClient.GetPurgeStatus // method. func (client *ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string, options *ComponentsClientGetPurgeStatusOptions) (ComponentsClientGetPurgeStatusResponse, error) { + var err error req, err := client.getPurgeStatusCreateRequest(ctx, resourceGroupName, resourceName, purgeID, options) if err != nil { return ComponentsClientGetPurgeStatusResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientGetPurgeStatusResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentsClientGetPurgeStatusResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientGetPurgeStatusResponse{}, err } - return client.getPurgeStatusHandleResponse(resp) + resp, err := client.getPurgeStatusHandleResponse(httpResp) + return resp, err } // getPurgeStatusCreateRequest creates the GetPurgeStatus request. @@ -400,7 +413,11 @@ func (client *ComponentsClient) listByResourceGroupHandleResponse(resp *http.Res // In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution // of purge requests by sending a single command whose predicate includes all // user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior -// to using for a purge request to verify that the results are expected. +// to using for a purge request to verify that the results are expected. Note: +// this operation is intended for Classic resources, for workspace-based Application Insights resource please run purge operation +// (directly on the +// workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , scoped to specific resource +// id. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2020-02-02 @@ -409,18 +426,21 @@ func (client *ComponentsClient) listByResourceGroupHandleResponse(resp *http.Res // - body - Describes the body of a request to purge data in a single table of an Application Insights component // - options - ComponentsClientPurgeOptions contains the optional parameters for the ComponentsClient.Purge method. func (client *ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody, options *ComponentsClientPurgeOptions) (ComponentsClientPurgeResponse, error) { + var err error req, err := client.purgeCreateRequest(ctx, resourceGroupName, resourceName, body, options) if err != nil { return ComponentsClientPurgeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientPurgeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return ComponentsClientPurgeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientPurgeResponse{}, err } - return client.purgeHandleResponse(resp) + resp, err := client.purgeHandleResponse(httpResp) + return resp, err } // purgeCreateRequest creates the Purge request. @@ -446,7 +466,10 @@ func (client *ComponentsClient) purgeCreateRequest(ctx context.Context, resource reqQP.Set("api-version", "2020-02-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // purgeHandleResponse handles the Purge response. @@ -467,18 +490,21 @@ func (client *ComponentsClient) purgeHandleResponse(resp *http.Response) (Compon // - componentTags - Updated tag information to set into the component instance. // - options - ComponentsClientUpdateTagsOptions contains the optional parameters for the ComponentsClient.UpdateTags method. func (client *ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource, options *ComponentsClientUpdateTagsOptions) (ComponentsClientUpdateTagsResponse, error) { + var err error req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, componentTags, options) if err != nil { return ComponentsClientUpdateTagsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ComponentsClientUpdateTagsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ComponentsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComponentsClientUpdateTagsResponse{}, err } - return client.updateTagsHandleResponse(resp) + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err } // updateTagsCreateRequest creates the UpdateTags request. @@ -504,7 +530,10 @@ func (client *ComponentsClient) updateTagsCreateRequest(ctx context.Context, res reqQP.Set("api-version", "2020-02-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, componentTags) + if err := runtime.MarshalAsJSON(req, componentTags); err != nil { + return nil, err + } + return req, nil } // updateTagsHandleResponse handles the UpdateTags response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go deleted file mode 100644 index 3292b81f2fc6..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/components_client_example_test.go +++ /dev/null @@ -1,483 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsList.json -func ExampleComponentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewComponentsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ComponentListResult = armapplicationinsights.ComponentListResult{ - // Value: []*armapplicationinsights.Component{ - // { - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("16526d1a-dfba-4362-a9e9-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=dc5931c7-a7ad-4ad0-89d6-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-14T12:24:05.0041213+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("dc5931c7-a7ad-4ad0-89d6-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](75), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // }, - // { - // Name: to.Ptr("my-other-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-other-resource-group/providers/Microsoft.Insights/components/my-other-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-other-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](30), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsListByResourceGroup.json -func ExampleComponentsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewComponentsClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ComponentListResult = armapplicationinsights.ComponentListResult{ - // Value: []*armapplicationinsights.Component{ - // { - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("16526d1a-dfba-4362-a9e9-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=dc5931c7-a7ad-4ad0-89d6-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-14T12:24:05.0041213+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("dc5931c7-a7ad-4ad0-89d6-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](100), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // }, - // { - // Name: to.Ptr("my-other-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-other-resource-group/providers/Microsoft.Insights/components/my-other-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-other-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](50), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsDelete.json -func ExampleComponentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewComponentsClient().Delete(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsGet.json -func ExampleComponentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentsClient().Get(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Component = armapplicationinsights.Component{ - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](100), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsCreate.json -func ExampleComponentsClient_CreateOrUpdate_componentCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentsClient().CreateOrUpdate(ctx, "my-resource-group", "my-component", armapplicationinsights.Component{ - Location: to.Ptr("South Central US"), - Kind: to.Ptr("web"), - Properties: &armapplicationinsights.ComponentProperties{ - ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Component = armapplicationinsights.Component{ - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](100), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdate.json -func ExampleComponentsClient_CreateOrUpdate_componentUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentsClient().CreateOrUpdate(ctx, "my-resource-group", "my-component", armapplicationinsights.Component{ - Location: to.Ptr("South Central US"), - Tags: map[string]*string{ - "ApplicationGatewayType": to.Ptr("Internal-Only"), - "BillingEntity": to.Ptr("Self"), - }, - Kind: to.Ptr("web"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Component = armapplicationinsights.Component{ - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // "ApplicationGatewayType": to.Ptr("Internal-Only"), - // "BillingEntity": to.Ptr("Self"), - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](100), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdateTagsOnly.json -func ExampleComponentsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentsClient().UpdateTags(ctx, "my-resource-group", "my-component", armapplicationinsights.TagsResource{ - Tags: map[string]*string{ - "ApplicationGatewayType": to.Ptr("Internal-Only"), - "BillingEntity": to.Ptr("Self"), - "Color": to.Ptr("AzureBlue"), - "CustomField_01": to.Ptr("Custom text in some random field named randomly"), - "NodeType": to.Ptr("Edge"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Component = armapplicationinsights.Component{ - // Name: to.Ptr("my-component"), - // Type: to.Ptr("Microsoft.Insights/components"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // "ApplicationGatewayType": to.Ptr("Internal-Only"), - // "BillingEntity": to.Ptr("Self"), - // "Color": to.Ptr("AzureBlue"), - // "CustomField_01": to.Ptr("Custom text in some random field named randomly"), - // "NodeType": to.Ptr("Edge"), - // }, - // Kind: to.Ptr("web"), - // Properties: &armapplicationinsights.ComponentProperties{ - // AppID: to.Ptr("887f4bfd-b5fd-40d7-9fc3-123456789abc"), - // ApplicationID: to.Ptr("my-component"), - // ApplicationType: to.Ptr(armapplicationinsights.ApplicationTypeWeb), - // ConnectionString: to.Ptr("InstrumentationKey=bc095013-3cf2-45ac-ab47-123456789abc"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-24T01:05:38.5934061+00:00"); return t}()), - // DisableIPMasking: to.Ptr(false), - // FlowType: to.Ptr(armapplicationinsights.FlowTypeBluefield), - // HockeyAppID: to.Ptr(""), - // HockeyAppToken: to.Ptr(""), - // IngestionMode: to.Ptr(armapplicationinsights.IngestionModeLogAnalytics), - // InstrumentationKey: to.Ptr("bc095013-3cf2-45ac-ab47-123456789abc"), - // RequestSource: to.Ptr(armapplicationinsights.RequestSourceRest), - // SamplingPercentage: to.Ptr[float64](100), - // TenantID: to.Ptr("f438d567-7177-4fe1-a5e3-123456789abc"), - // WorkspaceResourceID: to.Ptr("/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccessForIngestion: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // PublicNetworkAccessForQuery: to.Ptr(armapplicationinsights.PublicNetworkAccessTypeEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurge.json -func ExampleComponentsClient_Purge() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewComponentsClient().Purge(ctx, "OIAutoRest5123", "aztest5048", armapplicationinsights.ComponentPurgeBody{ - Filters: []*armapplicationinsights.ComponentPurgeBodyFilters{ - { - Column: to.Ptr("TimeGenerated"), - Operator: to.Ptr(">"), - Value: "2017-09-01T00:00:00", - }}, - Table: to.Ptr("Heartbeat"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurgeStatus.json -func ExampleComponentsClient_GetPurgeStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComponentsClient().GetPurgeStatus(ctx, "OIAutoRest5123", "aztest5048", "purge-970318e7-b859-4edb-8903-83b1b54d0b74", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentPurgeStatusResponse = armapplicationinsights.ComponentPurgeStatusResponse{ - // Status: to.Ptr(armapplicationinsights.PurgeStateCompleted), - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go index 6397cba71adc..279c65df3cc2 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights const ( moduleName = "armapplicationinsights" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.3" ) // ApplicationType - Type of application being monitored. @@ -49,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 ( @@ -199,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 @@ -249,34 +320,61 @@ func PossibleRequestSourceValues() []RequestSource { } } -// SharedTypeKind - The kind of workbook. Choices are user and shared. -type SharedTypeKind string +type StorageType string const ( - SharedTypeKindShared SharedTypeKind = "shared" - SharedTypeKindUser SharedTypeKind = "user" + StorageTypeServiceProfiler StorageType = "ServiceProfiler" ) -// PossibleSharedTypeKindValues returns the possible values for the SharedTypeKind const type. -func PossibleSharedTypeKindValues() []SharedTypeKind { - return []SharedTypeKind{ - SharedTypeKindShared, - SharedTypeKindUser, +// PossibleStorageTypeValues returns the possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{ + StorageTypeServiceProfiler, } } -// WebTestKind - The kind of web test that this web test watches. Choices are ping and multistep. +// WebTestKind - The kind of WebTest that this web test watches. Choices are ping, multistep and standard. type WebTestKind string const ( - WebTestKindPing WebTestKind = "ping" WebTestKindMultistep WebTestKind = "multistep" + WebTestKindPing WebTestKind = "ping" + WebTestKindStandard WebTestKind = "standard" ) // PossibleWebTestKindValues returns the possible values for the WebTestKind const type. func PossibleWebTestKindValues() []WebTestKind { return []WebTestKind{ - WebTestKindPing, WebTestKindMultistep, + WebTestKindPing, + WebTestKindStandard, + } +} + +// WorkbookSharedTypeKind - The kind of workbook. Only valid value is shared. +type WorkbookSharedTypeKind string + +const ( + WorkbookSharedTypeKindShared WorkbookSharedTypeKind = "shared" +) + +// PossibleWorkbookSharedTypeKindValues returns the possible values for the WorkbookSharedTypeKind const type. +func PossibleWorkbookSharedTypeKindValues() []WorkbookSharedTypeKind { + return []WorkbookSharedTypeKind{ + WorkbookSharedTypeKindShared, + } +} + +// WorkbookUpdateSharedTypeKind - The kind of workbook. Only valid value is shared. +type WorkbookUpdateSharedTypeKind string + +const ( + WorkbookUpdateSharedTypeKindShared WorkbookUpdateSharedTypeKind = "shared" +) + +// PossibleWorkbookUpdateSharedTypeKindValues returns the possible values for the WorkbookUpdateSharedTypeKind const type. +func PossibleWorkbookUpdateSharedTypeKindValues() []WorkbookUpdateSharedTypeKind { + return []WorkbookUpdateSharedTypeKind{ + WorkbookUpdateSharedTypeKindShared, } } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client.go index 69c92e572a50..65eda70f1fb1 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -55,18 +54,21 @@ func NewExportConfigurationsClient(subscriptionID string, credential azcore.Toke // - options - ExportConfigurationsClientCreateOptions contains the optional parameters for the ExportConfigurationsClient.Create // method. func (client *ExportConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ComponentExportRequest, options *ExportConfigurationsClientCreateOptions) (ExportConfigurationsClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, resourceName, exportProperties, options) if err != nil { return ExportConfigurationsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportConfigurationsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportConfigurationsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExportConfigurationsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -92,7 +94,10 @@ func (client *ExportConfigurationsClient) createCreateRequest(ctx context.Contex reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, exportProperties) + if err := runtime.MarshalAsJSON(req, exportProperties); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -114,18 +119,21 @@ func (client *ExportConfigurationsClient) createHandleResponse(resp *http.Respon // - options - ExportConfigurationsClientDeleteOptions contains the optional parameters for the ExportConfigurationsClient.Delete // method. func (client *ExportConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string, options *ExportConfigurationsClientDeleteOptions) (ExportConfigurationsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, exportID, options) if err != nil { return ExportConfigurationsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportConfigurationsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportConfigurationsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExportConfigurationsClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -177,18 +185,21 @@ func (client *ExportConfigurationsClient) deleteHandleResponse(resp *http.Respon // - options - ExportConfigurationsClientGetOptions contains the optional parameters for the ExportConfigurationsClient.Get // method. func (client *ExportConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string, options *ExportConfigurationsClientGetOptions) (ExportConfigurationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, exportID, options) if err != nil { return ExportConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExportConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -239,18 +250,21 @@ func (client *ExportConfigurationsClient) getHandleResponse(resp *http.Response) // - options - ExportConfigurationsClientListOptions contains the optional parameters for the ExportConfigurationsClient.List // method. func (client *ExportConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *ExportConfigurationsClientListOptions) (ExportConfigurationsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ExportConfigurationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportConfigurationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExportConfigurationsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -299,18 +313,21 @@ func (client *ExportConfigurationsClient) listHandleResponse(resp *http.Response // - options - ExportConfigurationsClientUpdateOptions contains the optional parameters for the ExportConfigurationsClient.Update // method. func (client *ExportConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ComponentExportRequest, options *ExportConfigurationsClientUpdateOptions) (ExportConfigurationsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, exportID, exportProperties, options) if err != nil { return ExportConfigurationsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportConfigurationsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportConfigurationsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExportConfigurationsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -340,7 +357,10 @@ func (client *ExportConfigurationsClient) updateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, exportProperties) + if err := runtime.MarshalAsJSON(req, exportProperties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go deleted file mode 100644 index 8149befa4866..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/exportconfigurations_client_example_test.go +++ /dev/null @@ -1,246 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsList.json -func ExampleExportConfigurationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportConfigurationsClient().List(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentExportConfigurationArray = []*armapplicationinsights.ComponentExportConfiguration{ - // { - // ApplicationName: to.Ptr("my-component"), - // ContainerName: to.Ptr("mystorageblob"), - // DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob"), - // DestinationStorageLocationID: to.Ptr("eastasia"), - // DestinationStorageSubscriptionID: to.Ptr("subidc"), - // DestinationType: to.Ptr("Blob"), - // ExportID: to.Ptr("uGOoki0jQsyEs3IdQ83Q4QsNr4="), - // ExportStatus: to.Ptr("Preparing"), - // InstrumentationKey: to.Ptr("8330b4a4-0b8e-40cf-a643-bbaf60d375c9"), - // IsUserEnabled: to.Ptr("False"), - // LastGapTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastSuccessTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastUserUpdate: to.Ptr("2017-06-05T06:34:26.957Z"), - // NotificationQueueEnabled: to.Ptr("False"), - // PermanentErrorReason: to.Ptr("None"), - // RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - // ResourceGroup: to.Ptr("2"), - // StorageName: to.Ptr("mystorageblob"), - // SubscriptionID: to.Ptr("subid"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsPost.json -func ExampleExportConfigurationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportConfigurationsClient().Create(ctx, "my-resource-group", "my-component", armapplicationinsights.ComponentExportRequest{ - DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorageblob"), - DestinationAddress: to.Ptr("https://mystorageblob.blob.core.windows.net/testexport?sv=2015-04-05&sr=c&sig=token"), - DestinationStorageLocationID: to.Ptr("eastus"), - DestinationStorageSubscriptionID: to.Ptr("subid"), - DestinationType: to.Ptr("Blob"), - IsEnabled: to.Ptr("true"), - NotificationQueueEnabled: to.Ptr("false"), - NotificationQueueURI: to.Ptr(""), - RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentExportConfigurationArray = []*armapplicationinsights.ComponentExportConfiguration{ - // { - // ApplicationName: to.Ptr("my-component"), - // ContainerName: to.Ptr("mystorageblob"), - // DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob"), - // DestinationStorageLocationID: to.Ptr("eastasia"), - // DestinationStorageSubscriptionID: to.Ptr("subidc"), - // DestinationType: to.Ptr("Blob"), - // ExportID: to.Ptr("uGOoki0jQsyEs3IdQ83Q4QsNr4="), - // ExportStatus: to.Ptr("Preparing"), - // InstrumentationKey: to.Ptr("8330b4a4-0b8e-40cf-a643-bbaf60d375c9"), - // IsUserEnabled: to.Ptr("False"), - // LastGapTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastSuccessTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastUserUpdate: to.Ptr("2017-06-05T06:34:26.957Z"), - // NotificationQueueEnabled: to.Ptr("False"), - // PermanentErrorReason: to.Ptr("None"), - // RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - // ResourceGroup: to.Ptr("2"), - // StorageName: to.Ptr("mystorageblob"), - // SubscriptionID: to.Ptr("subid"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationDelete.json -func ExampleExportConfigurationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportConfigurationsClient().Delete(ctx, "my-resource-group", "my-component", "uGOoki0jQsyEs3IdQ83Q4QsNr4=", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentExportConfiguration = armapplicationinsights.ComponentExportConfiguration{ - // ApplicationName: to.Ptr("my-component"), - // ContainerName: to.Ptr("mystorageblob"), - // DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob"), - // DestinationStorageLocationID: to.Ptr("eastasia"), - // DestinationStorageSubscriptionID: to.Ptr("subidc"), - // DestinationType: to.Ptr("Blob"), - // ExportID: to.Ptr("uGOoki0jQsyEs3IdQ83Q4QsNr4="), - // ExportStatus: to.Ptr("Preparing"), - // InstrumentationKey: to.Ptr("8330b4a4-0b8e-40cf-a643-bbaf60d375c9"), - // IsUserEnabled: to.Ptr("False"), - // LastGapTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastSuccessTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastUserUpdate: to.Ptr("2017-06-05T06:34:26.957Z"), - // NotificationQueueEnabled: to.Ptr("False"), - // PermanentErrorReason: to.Ptr("None"), - // RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - // ResourceGroup: to.Ptr("2"), - // StorageName: to.Ptr("mystorageblob"), - // SubscriptionID: to.Ptr("subid"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationGet.json -func ExampleExportConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportConfigurationsClient().Get(ctx, "my-resource-group", "my-component", "uGOoki0jQsyEs3IdQ83Q4QsNr4=", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentExportConfiguration = armapplicationinsights.ComponentExportConfiguration{ - // ApplicationName: to.Ptr("my-component"), - // ContainerName: to.Ptr("mystorageblob"), - // DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob"), - // DestinationStorageLocationID: to.Ptr("eastasia"), - // DestinationStorageSubscriptionID: to.Ptr("subidc"), - // DestinationType: to.Ptr("Blob"), - // ExportID: to.Ptr("uGOoki0jQsyEs3IdQ83Q4QsNr4="), - // ExportStatus: to.Ptr("Preparing"), - // InstrumentationKey: to.Ptr("8330b4a4-0b8e-40cf-a643-bbaf60d375c9"), - // IsUserEnabled: to.Ptr("False"), - // LastGapTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastSuccessTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastUserUpdate: to.Ptr("2017-06-05T06:34:26.957Z"), - // NotificationQueueEnabled: to.Ptr("False"), - // PermanentErrorReason: to.Ptr("None"), - // RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - // ResourceGroup: to.Ptr("2"), - // StorageName: to.Ptr("mystorageblob"), - // SubscriptionID: to.Ptr("subid"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationUpdate.json -func ExampleExportConfigurationsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportConfigurationsClient().Update(ctx, "my-resource-group", "my-component", "uGOoki0jQsyEs3IdQ83Q4QsNr4=", armapplicationinsights.ComponentExportRequest{ - DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorageblob"), - DestinationAddress: to.Ptr("https://mystorageblob.blob.core.windows.net/fchentest?sv=2015-04-05&sr=c&sig=token"), - DestinationStorageLocationID: to.Ptr("eastus"), - DestinationStorageSubscriptionID: to.Ptr("subid"), - DestinationType: to.Ptr("Blob"), - IsEnabled: to.Ptr("true"), - NotificationQueueEnabled: to.Ptr("false"), - NotificationQueueURI: to.Ptr(""), - RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentExportConfiguration = armapplicationinsights.ComponentExportConfiguration{ - // ApplicationName: to.Ptr("my-component"), - // ContainerName: to.Ptr("mystorageblob"), - // DestinationAccountID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageblob"), - // DestinationStorageLocationID: to.Ptr("eastasia"), - // DestinationStorageSubscriptionID: to.Ptr("subidc"), - // DestinationType: to.Ptr("Blob"), - // ExportID: to.Ptr("uGOoki0jQsyEs3IdQ83Q4QsNr4="), - // ExportStatus: to.Ptr("Preparing"), - // InstrumentationKey: to.Ptr("8330b4a4-0b8e-40cf-a643-bbaf60d375c9"), - // IsUserEnabled: to.Ptr("False"), - // LastGapTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastSuccessTime: to.Ptr("9999-12-31T23:59:59.999Z"), - // LastUserUpdate: to.Ptr("2017-06-05T06:34:26.957Z"), - // NotificationQueueEnabled: to.Ptr("False"), - // PermanentErrorReason: to.Ptr("None"), - // RecordTypes: to.Ptr("Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability"), - // ResourceGroup: to.Ptr("2"), - // StorageName: to.Ptr("mystorageblob"), - // SubscriptionID: to.Ptr("subid"), - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go index 184a76b94d09..1a4bb71f0b59 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -56,18 +55,21 @@ func NewFavoritesClient(subscriptionID string, credential azcore.TokenCredential // component. // - options - FavoritesClientAddOptions contains the optional parameters for the FavoritesClient.Add method. func (client *FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ComponentFavorite, options *FavoritesClientAddOptions) (FavoritesClientAddResponse, error) { + var err error req, err := client.addCreateRequest(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties, options) if err != nil { return FavoritesClientAddResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoritesClientAddResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoritesClientAddResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoritesClientAddResponse{}, err } - return client.addHandleResponse(resp) + resp, err := client.addHandleResponse(httpResp) + return resp, err } // addCreateRequest creates the Add request. @@ -97,7 +99,10 @@ func (client *FavoritesClient) addCreateRequest(ctx context.Context, resourceGro reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, favoriteProperties) + if err := runtime.MarshalAsJSON(req, favoriteProperties); err != nil { + return nil, err + } + return req, nil } // addHandleResponse handles the Add response. @@ -118,16 +123,18 @@ func (client *FavoritesClient) addHandleResponse(resp *http.Response) (Favorites // - favoriteID - The Id of a specific favorite defined in the Application Insights component // - options - FavoritesClientDeleteOptions contains the optional parameters for the FavoritesClient.Delete method. func (client *FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, options *FavoritesClientDeleteOptions) (FavoritesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, favoriteID, options) if err != nil { return FavoritesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoritesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoritesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoritesClientDeleteResponse{}, err } return FavoritesClientDeleteResponse{}, nil } @@ -170,18 +177,21 @@ func (client *FavoritesClient) deleteCreateRequest(ctx context.Context, resource // - favoriteID - The Id of a specific favorite defined in the Application Insights component // - options - FavoritesClientGetOptions contains the optional parameters for the FavoritesClient.Get method. func (client *FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, options *FavoritesClientGetOptions) (FavoritesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, favoriteID, options) if err != nil { return FavoritesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoritesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoritesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoritesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -231,18 +241,21 @@ func (client *FavoritesClient) getHandleResponse(resp *http.Response) (Favorites // - resourceName - The name of the Application Insights component resource. // - options - FavoritesClientListOptions contains the optional parameters for the FavoritesClient.List method. func (client *FavoritesClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *FavoritesClientListOptions) (FavoritesClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return FavoritesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoritesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoritesClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoritesClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -302,18 +315,21 @@ func (client *FavoritesClient) listHandleResponse(resp *http.Response) (Favorite // - favoriteProperties - Properties that need to be specified to update the existing favorite. // - options - FavoritesClientUpdateOptions contains the optional parameters for the FavoritesClient.Update method. func (client *FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ComponentFavorite, options *FavoritesClientUpdateOptions) (FavoritesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties, options) if err != nil { return FavoritesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoritesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoritesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoritesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -343,7 +359,10 @@ func (client *FavoritesClient) updateCreateRequest(ctx context.Context, resource reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, favoriteProperties) + if err := runtime.MarshalAsJSON(req, favoriteProperties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go deleted file mode 100644 index 868b06414a08..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/favorites_client_example_test.go +++ /dev/null @@ -1,205 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoritesList.json -func ExampleFavoritesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoritesClient().List(ctx, "my-resource-group", "my-ai-component", &armapplicationinsights.FavoritesClientListOptions{FavoriteType: nil, - SourceType: nil, - CanFetchContent: nil, - Tags: []string{}, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentFavoriteArray = []*armapplicationinsights.ComponentFavorite{ - // { - // Config: to.Ptr("blah blah"), - // FavoriteID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - // IsGeneratedFromTemplate: to.Ptr(false), - // Name: to.Ptr("Example Metric Chart Favorite"), - // Tags: []*string{ - // }, - // TimeModified: to.Ptr("2018-01-31T23:56:16.008902Z"), - // Version: to.Ptr("ME"), - // }, - // { - // Config: to.Ptr("{\"TimeSelection\":{\"durationMs\":1800000,\"endTime\":\"2018-01-31T23:56:15.493Z\",\"createdTime\":\"Wed Jan 31 2018 15:58:36 GMT-0800 (Pacific Standard Time)\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},\"SearchFilter\":{\"eventTypes\":[1,2],\"typeFacets\":{},\"isPermissive\":false},\"QueryText\":\"*\",\"partId\":\"99e33a16-1b00-4a7d-b98f-a3c1bb3a4df8\"}"), - // FavoriteID: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), - // FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - // IsGeneratedFromTemplate: to.Ptr(false), - // Name: to.Ptr("Example Search Blade Favorite"), - // Tags: []*string{ - // to.Ptr("SampleTag01"), - // to.Ptr("SampleTag2")}, - // TimeModified: to.Ptr("2018-01-31T23:59:25.4594264Z"), - // Version: to.Ptr("Search"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteGet.json -func ExampleFavoritesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoritesClient().Get(ctx, "my-resource-group", "my-ai-component", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentFavorite = armapplicationinsights.ComponentFavorite{ - // Config: to.Ptr("{\"TimeSelection\":{\"durationMs\":1800000,\"endTime\":\"2018-01-31T23:56:15.493Z\",\"createdTime\":\"Wed Jan 31 2018 15:58:36 GMT-0800 (Pacific Standard Time)\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},\"SearchFilter\":{\"eventTypes\":[1,2],\"typeFacets\":{},\"isPermissive\":false},\"QueryText\":\"*\",\"partId\":\"99e33a16-1b00-4a7d-b98f-a3c1bb3a4df8\"}"), - // FavoriteID: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), - // FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - // IsGeneratedFromTemplate: to.Ptr(false), - // Name: to.Ptr("Example Search Blade Favorite"), - // Tags: []*string{ - // to.Ptr("SampleTag1"), - // to.Ptr("SampleTag2")}, - // TimeModified: to.Ptr("2018-01-31T23:59:25.4594264Z"), - // Version: to.Ptr("Search"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteAdd.json -func ExampleFavoritesClient_Add() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoritesClient().Add(ctx, "my-resource-group", "my-ai-component", "deadb33f-8bee-4d3b-a059-9be8dac93960", armapplicationinsights.ComponentFavorite{ - Config: to.Ptr("{\"MEDataModelRawJSON\":\"{\\n \\\"version\\\": \\\"1.4.1\\\",\\n \\\"isCustomDataModel\\\": true,\\n \\\"items\\\": [\\n {\\n \\\"id\\\": \\\"90a7134d-9a38-4c25-88d3-a495209873eb\\\",\\n \\\"chartType\\\": \\\"Area\\\",\\n \\\"chartHeight\\\": 4,\\n \\\"metrics\\\": [\\n {\\n \\\"id\\\": \\\"preview/requests/count\\\",\\n \\\"metricAggregation\\\": \\\"Sum\\\",\\n \\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"\\n }\\n ],\\n \\\"priorPeriod\\\": false,\\n \\\"clickAction\\\": {\\n \\\"defaultBlade\\\": \\\"SearchBlade\\\"\\n },\\n \\\"horizontalBars\\\": true,\\n \\\"showOther\\\": true,\\n \\\"aggregation\\\": \\\"Sum\\\",\\n \\\"percentage\\\": false,\\n \\\"palette\\\": \\\"fail\\\",\\n \\\"yAxisOption\\\": 0,\\n \\\"title\\\": \\\"\\\"\\n },\\n {\\n \\\"id\\\": \\\"0c289098-88e8-4010-b212-546815cddf70\\\",\\n \\\"chartType\\\": \\\"Area\\\",\\n \\\"chartHeight\\\": 2,\\n \\\"metrics\\\": [\\n {\\n \\\"id\\\": \\\"preview/requests/duration\\\",\\n \\\"metricAggregation\\\": \\\"Avg\\\",\\n \\\"color\\\": \\\"msportalfx-bgcolor-j1\\\"\\n }\\n ],\\n \\\"priorPeriod\\\": false,\\n \\\"clickAction\\\": {\\n \\\"defaultBlade\\\": \\\"SearchBlade\\\"\\n },\\n \\\"horizontalBars\\\": true,\\n \\\"showOther\\\": true,\\n \\\"aggregation\\\": \\\"Avg\\\",\\n \\\"percentage\\\": false,\\n \\\"palette\\\": \\\"greenHues\\\",\\n \\\"yAxisOption\\\": 0,\\n \\\"title\\\": \\\"\\\"\\n },\\n {\\n \\\"id\\\": \\\"cbdaab6f-a808-4f71-aca5-b3976cbb7345\\\",\\n \\\"chartType\\\": \\\"Bar\\\",\\n \\\"chartHeight\\\": 4,\\n \\\"metrics\\\": [\\n {\\n \\\"id\\\": \\\"preview/requests/duration\\\",\\n \\\"metricAggregation\\\": \\\"Avg\\\",\\n \\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"\\n }\\n ],\\n \\\"priorPeriod\\\": false,\\n \\\"clickAction\\\": {\\n \\\"defaultBlade\\\": \\\"SearchBlade\\\"\\n },\\n \\\"horizontalBars\\\": true,\\n \\\"showOther\\\": true,\\n \\\"aggregation\\\": \\\"Avg\\\",\\n \\\"percentage\\\": false,\\n \\\"palette\\\": \\\"magentaHues\\\",\\n \\\"yAxisOption\\\": 0,\\n \\\"title\\\": \\\"\\\"\\n },\\n {\\n \\\"id\\\": \\\"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\\\",\\n \\\"grouping\\\": {\\n \\\"kind\\\": \\\"ByDimension\\\",\\n \\\"dimension\\\": \\\"context.application.version\\\"\\n },\\n \\\"chartType\\\": \\\"Grid\\\",\\n \\\"chartHeight\\\": 1,\\n \\\"metrics\\\": [\\n {\\n \\\"id\\\": \\\"basicException.count\\\",\\n \\\"metricAggregation\\\": \\\"Sum\\\",\\n \\\"color\\\": \\\"msportalfx-bgcolor-g0\\\"\\n },\\n {\\n \\\"id\\\": \\\"requestFailed.count\\\",\\n \\\"metricAggregation\\\": \\\"Sum\\\",\\n \\\"color\\\": \\\"msportalfx-bgcolor-f0s2\\\"\\n }\\n ],\\n \\\"priorPeriod\\\": true,\\n \\\"clickAction\\\": {\\n \\\"defaultBlade\\\": \\\"SearchBlade\\\"\\n },\\n \\\"horizontalBars\\\": true,\\n \\\"showOther\\\": true,\\n \\\"percentage\\\": false,\\n \\\"palette\\\": \\\"blueHues\\\",\\n \\\"yAxisOption\\\": 0,\\n \\\"title\\\": \\\"\\\"\\n }\\n ],\\n \\\"currentFilter\\\": {\\n \\\"eventTypes\\\": [\\n 1,\\n 2\\n ],\\n \\\"typeFacets\\\": {},\\n \\\"isPermissive\\\": false\\n },\\n \\\"timeContext\\\": {\\n \\\"durationMs\\\": 75600000,\\n \\\"endTime\\\": \\\"2018-01-31T20:30:00.000Z\\\",\\n \\\"createdTime\\\": \\\"2018-01-31T23:54:26.280Z\\\",\\n \\\"isInitialTime\\\": false,\\n \\\"grain\\\": 1,\\n \\\"useDashboardTimeRange\\\": false\\n },\\n \\\"jsonUri\\\": \\\"Favorite_BlankChart\\\",\\n \\\"timeSource\\\": 0\\n}\"}"), - FavoriteID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - IsGeneratedFromTemplate: to.Ptr(false), - Name: to.Ptr("Blah Blah Blah"), - Tags: []*string{ - to.Ptr("TagSample01"), - to.Ptr("TagSample02")}, - Version: to.Ptr("ME"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentFavorite = armapplicationinsights.ComponentFavorite{ - // Category: to.Ptr(""), - // Config: to.Ptr("{\"MEDataModelRawJSON\":{\n \"version\": \"1.4.1\",\n \"isCustomDataModel\": true,\n \"items\": [\n {\n \"id\": \"90a7134d-9a38-4c25-88d3-a495209873eb\",\n \"chartType\": \"Area\",\n \"chartHeight\": 4,\n \"metrics\": [\n {\n \"id\": \"preview/requests/count\",\n \"metricAggregation\": \"Sum\",\n \"color\": \"msportalfx-bgcolor-d0\"\n }\n],\n \"priorPeriod\": false,\n \"clickAction\": {\n \"defaultBlade\": \"SearchBlade\"\n },\n \"horizontalBars\": true,\n \"showOther\": true,\n \"aggregation\": \"Sum\",\n \"percentage\": false,\n \"palette\": \"fail\",\n \"yAxisOption\": 0,\n \"title\": \"\"\n },\n {\n \"id\": \"0c289098-88e8-4010-b212-546815cddf70\",\n \"chartType\": \"Area\",\n \"chartHeight\": 2,\n \"metrics\": [\n {\n \"id\": \"preview/requests/duration\",\n \"metricAggregation\": \"Avg\",\n \"color\": \"msportalfx-bgcolor-j1\"\n }\n ],\n \"priorPeriod\": false,\n \"clickAction\": {\n \"defaultBlade\": \"SearchBlade\"\n },\n \"horizontalBars\": true,\n \"showOther\": true,\n \"aggregation\": \"Avg\",\n \"percentage\": false,\n \"palette\": \"greenHues\",\n \"yAxisOption\": 0,\n \"title\": \"\"\n },\n {\n \"id\": \"cbdaab6f-a808-4f71-aca5-b3976cbb7345\",\n \"chartType\": \"Bar\",\n \"chartHeight\": 4,\n \"metrics\": [\n {\n \"id\": \"preview/requests/duration\",\n \"metricAggregation\": \"Avg\",\n \"color\": \"msportalfx-bgcolor-d0\"\n }\n ],\n \"priorPeriod\": false,\n \"clickAction\": {\n \"defaultBlade\": \"SearchBlade\"\n },\n \"horizontalBars\": true,\n \"showOther\": true,\n \"aggregation\": \"Avg\",\n \"percentage\": false,\n \"palette\": \"magentaHues\",\n \"yAxisOption\": 0,\n \"title\": \"\"\n },\n {\n \"id\": \"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\",\n \"grouping\": {\n \"kind\": \"ByDimension\",\n \"dimension\": \"context.application.version\"\n },\n \"chartType\": \"Grid\",\n \"chartHeight\": 1,\n \"metrics\": [\n {\n \"id\": \"basicException.count\",\n \"metricAggregation\": \"Sum\",\n \"color\": \"msportalfx-bgcolor-g0\"\n },\n {\n \"id\": \"requestFailed.count\",\n \"metricAggregation\": \"Sum\",\n \"color\": \"msportalfx-bgcolor-f0s2\"\n }\n ],\n \"priorPeriod\": true,\n \"clickAction\": {\n \"defaultBlade\": \"SearchBlade\"\n },\n \"horizontalBars\": true,\n \"showOther\": true,\n \"percentage\": false,\n \"palette\": \"blueHues\",\n \"yAxisOption\": 0,\n \"title\": \"\"\n }\n ],\n \"currentFilter\": {\n \"eventTypes\": [\n 1,\n 2\n ],\n \"typeFacets\": {},\n \"isPermissive\": false\n },\n \"timeContext\": {\n \"durationMs\": 75600000,\n \"endTime\": \"2018-01-31T20:30:00.000Z\",\n \"createdTime\": \"2018-01-31T23:54:26.280Z\",\n \"isInitialTime\": false,\n \"grain\": 1,\n \"useDashboardTimeRange\": false\n },\n \"jsonUri\": \"Favorite_BlankChart\",\n \"timeSource\": 0\n}\"}"), - // FavoriteID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - // IsGeneratedFromTemplate: to.Ptr(false), - // Name: to.Ptr("Blah Blah Blah"), - // SourceType: to.Ptr(""), - // Tags: []*string{ - // to.Ptr("TagSample01"), - // to.Ptr("TagSample02")}, - // TimeModified: to.Ptr("2018-02-02T23:18:32.1850959Z"), - // Version: to.Ptr("ME"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteUpdate.json -func ExampleFavoritesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoritesClient().Update(ctx, "my-resource-group", "my-ai-component", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.ComponentFavorite{ - Config: to.Ptr("{\"MEDataModelRawJSON\":\"{\\\"version\\\": \\\"1.4.1\\\",\\\"isCustomDataModel\\\": true,\\\"items\\\": [{\\\"id\\\": \\\"90a7134d-9a38-4c25-88d3-a495209873eb\\\",\\\"chartType\\\": \\\"Area\\\",\\\"chartHeight\\\": 4,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Sum\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"fail\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"0c289098-88e8-4010-b212-546815cddf70\\\",\\\"chartType\\\": \\\"Area\\\",\\\"chartHeight\\\": 2,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/duration\\\",\\\"metricAggregation\\\": \\\"Avg\\\",\\\"color\\\": \\\"msportalfx-bgcolor-j1\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Avg\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"greenHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"cbdaab6f-a808-4f71-aca5-b3976cbb7345\\\",\\\"chartType\\\": \\\"Bar\\\",\\\"chartHeight\\\": 4,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/duration\\\",\\\"metricAggregation\\\": \\\"Avg\\\",\\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Avg\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"magentaHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\\\",\\\"grouping\\\": {\\\"kind\\\": \\\"ByDimension\\\",\\\"dimension\\\": \\\"context.application.version\\\"},\\\"chartType\\\": \\\"Grid\\\",\\\"chartHeight\\\": 1,\\\"metrics\\\": [{\\\"id\\\": \\\"basicException.count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-g0\\\"},{\\\"id\\\": \\\"requestFailed.count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-f0s2\\\"}],\\\"priorPeriod\\\": true,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"percentage\\\": false,\\\"palette\\\": \\\"blueHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"}],\\\"currentFilter\\\": {\\\"eventTypes\\\": [1,2],\\\"typeFacets\\\": {},\\\"isPermissive\\\": false},\\\"timeContext\\\": {\\\"durationMs\\\": 75600000,\\\"endTime\\\": \\\"2018-01-31T20:30:00.000Z\\\",\\\"createdTime\\\": \\\"2018-01-31T23:54:26.280Z\\\",\\\"isInitialTime\\\": false,\\\"grain\\\": 1,\\\"useDashboardTimeRange\\\": false},\\\"jsonUri\\\": \\\"Favorite_BlankChart\\\",\\\"timeSource\\\": 0}\"}"), - FavoriteID: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), - FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - IsGeneratedFromTemplate: to.Ptr(false), - Name: to.Ptr("Derek Changed This"), - Tags: []*string{ - to.Ptr("TagSample01"), - to.Ptr("TagSample02"), - to.Ptr("TagSample03")}, - TimeModified: to.Ptr("2018-02-02T18:39:11.6569686Z"), - Version: to.Ptr("ME"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentFavorite = armapplicationinsights.ComponentFavorite{ - // Config: to.Ptr("{\"MEDataModelRawJSON\":\"{\\\"version\\\": \\\"1.4.1\\\",\\\"isCustomDataModel\\\": true,\\\"items\\\": [{\\\"id\\\": \\\"90a7134d-9a38-4c25-88d3-a495209873eb\\\",\\\"chartType\\\": \\\"Area\\\",\\\"chartHeight\\\": 4,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Sum\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"fail\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"0c289098-88e8-4010-b212-546815cddf70\\\",\\\"chartType\\\": \\\"Area\\\",\\\"chartHeight\\\": 2,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/duration\\\",\\\"metricAggregation\\\": \\\"Avg\\\",\\\"color\\\": \\\"msportalfx-bgcolor-j1\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Avg\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"greenHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"cbdaab6f-a808-4f71-aca5-b3976cbb7345\\\",\\\"chartType\\\": \\\"Bar\\\",\\\"chartHeight\\\": 4,\\\"metrics\\\": [{\\\"id\\\": \\\"preview/requests/duration\\\",\\\"metricAggregation\\\": \\\"Avg\\\",\\\"color\\\": \\\"msportalfx-bgcolor-d0\\\"}],\\\"priorPeriod\\\": false,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"aggregation\\\": \\\"Avg\\\",\\\"percentage\\\": false,\\\"palette\\\": \\\"magentaHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"},{\\\"id\\\": \\\"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\\\",\\\"grouping\\\": {\\\"kind\\\": \\\"ByDimension\\\",\\\"dimension\\\": \\\"context.application.version\\\"},\\\"chartType\\\": \\\"Grid\\\",\\\"chartHeight\\\": 1,\\\"metrics\\\": [{\\\"id\\\": \\\"basicException.count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-g0\\\"},{\\\"id\\\": \\\"requestFailed.count\\\",\\\"metricAggregation\\\": \\\"Sum\\\",\\\"color\\\": \\\"msportalfx-bgcolor-f0s2\\\"}],\\\"priorPeriod\\\": true,\\\"clickAction\\\": {\\\"defaultBlade\\\": \\\"SearchBlade\\\"},\\\"horizontalBars\\\": true,\\\"showOther\\\": true,\\\"percentage\\\": false,\\\"palette\\\": \\\"blueHues\\\",\\\"yAxisOption\\\": 0,\\\"title\\\": \\\"\\\"}],\\\"currentFilter\\\": {\\\"eventTypes\\\": [1,2],\\\"typeFacets\\\": {},\\\"isPermissive\\\": false},\\\"timeContext\\\": {\\\"durationMs\\\": 75600000,\\\"endTime\\\": \\\"2018-01-31T20:30:00.000Z\\\",\\\"createdTime\\\": \\\"2018-01-31T23:54:26.280Z\\\",\\\"isInitialTime\\\": false,\\\"grain\\\": 1,\\\"useDashboardTimeRange\\\": false},\\\"jsonUri\\\": \\\"Favorite_BlankChart\\\",\\\"timeSource\\\": 0}\"}"), - // FavoriteID: to.Ptr("deadb33f-5e0d-4064-8ebb-1a4ed0313eb2"), - // FavoriteType: to.Ptr(armapplicationinsights.FavoriteTypeShared), - // IsGeneratedFromTemplate: to.Ptr(false), - // Name: to.Ptr("Derek Changed This"), - // Tags: []*string{ - // to.Ptr("TagSample01"), - // to.Ptr("TagSample02"), - // to.Ptr("TagSample03")}, - // TimeModified: to.Ptr("2018-02-02T18:39:11.6569686Z"), - // Version: to.Ptr("ME"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteDelete.json -func ExampleFavoritesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewFavoritesClient().Delete(ctx, "my-resource-group", "my-ai-component", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod index 97cc8a662d0c..012b0aaef2e1 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.mod @@ -1,21 +1,13 @@ -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 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.sum b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.sum +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go new file mode 100644 index 000000000000..2a96cffa7189 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/livetoken_client.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapplicationinsights + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// LiveTokenClient contains the methods for the LiveToken group. +// Don't use this type directly, use NewLiveTokenClient() instead. +type LiveTokenClient struct { + internal *arm.Client +} + +// NewLiveTokenClient creates a new instance of LiveTokenClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLiveTokenClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LiveTokenClient, error) { + cl, err := arm.NewClient(moduleName+".LiveTokenClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LiveTokenClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets an access token for live metrics stream data. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-10-14 +// - resourceURI - The identifier of the resource. +// - options - LiveTokenClientGetOptions contains the optional parameters for the LiveTokenClient.Get method. +func (client *LiveTokenClient) Get(ctx context.Context, resourceURI string, options *LiveTokenClientGetOptions) (LiveTokenClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceURI, options) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LiveTokenClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LiveTokenClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LiveTokenClient) getCreateRequest(ctx context.Context, resourceURI string, options *LiveTokenClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.Insights/generatelivetoken" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-14") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LiveTokenClient) getHandleResponse(resp *http.Response) (LiveTokenClientGetResponse, error) { + result := LiveTokenClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveTokenResponse); err != nil { + return LiveTokenClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go index 9a78e5f65b3c..1f9953cc5892 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -23,59 +22,6 @@ type APIKeyRequest struct { Name *string } -// APIKeysClientCreateOptions contains the optional parameters for the APIKeysClient.Create method. -type APIKeysClientCreateOptions struct { - // placeholder for future optional parameters -} - -// APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. -type APIKeysClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// APIKeysClientGetOptions contains the optional parameters for the APIKeysClient.Get method. -type APIKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// APIKeysClientListOptions contains the optional parameters for the APIKeysClient.NewListPager method. -type APIKeysClientListOptions struct { - // placeholder for future optional parameters -} - -// AnalyticsItemsClientDeleteOptions contains the optional parameters for the AnalyticsItemsClient.Delete method. -type AnalyticsItemsClientDeleteOptions struct { - // The Id of a specific item defined in the Application Insights component - ID *string - // The name of a specific item defined in the Application Insights component - Name *string -} - -// AnalyticsItemsClientGetOptions contains the optional parameters for the AnalyticsItemsClient.Get method. -type AnalyticsItemsClientGetOptions struct { - // The Id of a specific item defined in the Application Insights component - ID *string - // The name of a specific item defined in the Application Insights component - Name *string -} - -// AnalyticsItemsClientListOptions contains the optional parameters for the AnalyticsItemsClient.List method. -type AnalyticsItemsClientListOptions struct { - // Flag indicating whether or not to return the content of each applicable item. If false, only return the item information. - IncludeContent *bool - // Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application - // Insights component. - Scope *ItemScope - // Enum indicating the type of the Analytics item. - Type *ItemTypeParameter -} - -// AnalyticsItemsClientPutOptions contains the optional parameters for the AnalyticsItemsClient.Put method. -type AnalyticsItemsClientPutOptions struct { - // Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. - OverrideItem *bool -} - // Annotation associated with an application insights resource. type Annotation struct { // Name of annotation @@ -109,26 +55,6 @@ type AnnotationError struct { Message *string } -// AnnotationsClientCreateOptions contains the optional parameters for the AnnotationsClient.Create method. -type AnnotationsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// AnnotationsClientDeleteOptions contains the optional parameters for the AnnotationsClient.Delete method. -type AnnotationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AnnotationsClientGetOptions contains the optional parameters for the AnnotationsClient.Get method. -type AnnotationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AnnotationsClientListOptions contains the optional parameters for the AnnotationsClient.NewListPager method. -type AnnotationsClientListOptions struct { - // placeholder for future optional parameters -} - // AnnotationsListResult - Annotations list result. type AnnotationsListResult struct { // READ-ONLY; An array of annotations. @@ -235,12 +161,6 @@ type ComponentAvailableFeatures struct { Result []*ComponentFeature } -// ComponentAvailableFeaturesClientGetOptions contains the optional parameters for the ComponentAvailableFeaturesClient.Get -// method. -type ComponentAvailableFeaturesClientGetOptions struct { - // placeholder for future optional parameters -} - // ComponentBillingFeatures - An Application Insights component billing features type ComponentBillingFeatures struct { // Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application @@ -251,18 +171,6 @@ type ComponentBillingFeatures struct { DataVolumeCap *ComponentDataVolumeCap } -// ComponentCurrentBillingFeaturesClientGetOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Get -// method. -type ComponentCurrentBillingFeaturesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ComponentCurrentBillingFeaturesClientUpdateOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Update -// method. -type ComponentCurrentBillingFeaturesClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ComponentDataVolumeCap - An Application Insights component daily data volume cap type ComponentDataVolumeCap struct { // Daily data volume cap in GB. @@ -502,12 +410,6 @@ type ComponentFeatureCapabilities struct { WorkItemIntegration *bool } -// ComponentFeatureCapabilitiesClientGetOptions contains the optional parameters for the ComponentFeatureCapabilitiesClient.Get -// method. -type ComponentFeatureCapabilitiesClientGetOptions struct { - // placeholder for future optional parameters -} - // ComponentFeatureCapability - An Application Insights component feature capability type ComponentFeatureCapability struct { // READ-ONLY; The description of the capability. @@ -529,6 +431,27 @@ type ComponentFeatureCapability struct { Value *string } +// ComponentLinkedStorageAccounts - An Application Insights component linked storage accounts +type ComponentLinkedStorageAccounts struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ComponentLinkedStorageAccountsPatch - An Application Insights component linked storage accounts patch +type ComponentLinkedStorageAccountsPatch struct { + // The properties of the linked storage accounts. + Properties *LinkedStorageAccountsProperties +} + // ComponentListResult - Describes the list of Application Insights Resources. type ComponentListResult struct { // REQUIRED; List of Application Insights component definitions. @@ -724,11 +647,6 @@ type ComponentQuotaStatus struct { ShouldBeThrottled *bool } -// ComponentQuotaStatusClientGetOptions contains the optional parameters for the ComponentQuotaStatusClient.Get method. -type ComponentQuotaStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // ComponentWebTestLocation - Properties that define a web test location available to an Application Insights Component. type ComponentWebTestLocation struct { // READ-ONLY; The display name of the web test location. @@ -738,47 +656,6 @@ type ComponentWebTestLocation struct { Tag *string } -// ComponentsClientCreateOrUpdateOptions contains the optional parameters for the ComponentsClient.CreateOrUpdate method. -type ComponentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientDeleteOptions contains the optional parameters for the ComponentsClient.Delete method. -type ComponentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientGetOptions contains the optional parameters for the ComponentsClient.Get method. -type ComponentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientGetPurgeStatusOptions contains the optional parameters for the ComponentsClient.GetPurgeStatus method. -type ComponentsClientGetPurgeStatusOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientListByResourceGroupOptions contains the optional parameters for the ComponentsClient.NewListByResourceGroupPager -// method. -type ComponentsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientListOptions contains the optional parameters for the ComponentsClient.NewListPager method. -type ComponentsClientListOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientPurgeOptions contains the optional parameters for the ComponentsClient.Purge method. -type ComponentsClientPurgeOptions struct { - // placeholder for future optional parameters -} - -// ComponentsClientUpdateTagsOptions contains the optional parameters for the ComponentsClient.UpdateTags method. -type ComponentsClientUpdateTagsOptions struct { - // placeholder for future optional parameters -} - // ComponentsResource - An azure resource object type ComponentsResource struct { // REQUIRED; Resource location @@ -797,6 +674,18 @@ type ComponentsResource struct { Type *string } +// ErrorDefinition - Error definition. +type ErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string + + // READ-ONLY; Internal error details. + Innererror any + + // READ-ONLY; Description of the error. + Message *string +} + // ErrorFieldContract - Error Field contract. type ErrorFieldContract struct { // Property level error code. @@ -815,6 +704,9 @@ type ErrorResponse struct { // Error code. Code *string + // The list of invalid fields send in request, in case of validation error. + Details []*ErrorFieldContract + // Error message indicating why the operation failed. Message *string } @@ -835,92 +727,91 @@ type ErrorResponseComponentsError struct { Message *string } -// ExportConfigurationsClientCreateOptions contains the optional parameters for the ExportConfigurationsClient.Create method. -type ExportConfigurationsClientCreateOptions struct { - // placeholder for future optional parameters +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 } -// ExportConfigurationsClientDeleteOptions contains the optional parameters for the ExportConfigurationsClient.Delete method. -type ExportConfigurationsClientDeleteOptions struct { - // placeholder for future optional parameters -} +// 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 -// ExportConfigurationsClientGetOptions contains the optional parameters for the ExportConfigurationsClient.Get method. -type ExportConfigurationsClientGetOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Error message indicating why the operation failed. + Message *string } -// ExportConfigurationsClientListOptions contains the optional parameters for the ExportConfigurationsClient.List method. -type ExportConfigurationsClientListOptions struct { - // placeholder for future optional parameters -} +// HeaderField - A header to add to the WebTest. +type HeaderField struct { + // The name of the header. + HeaderFieldName *string -// ExportConfigurationsClientUpdateOptions contains the optional parameters for the ExportConfigurationsClient.Update method. -type ExportConfigurationsClientUpdateOptions struct { - // placeholder for future optional parameters + // The value of the header. + HeaderFieldValue *string } -// FavoritesClientAddOptions contains the optional parameters for the FavoritesClient.Add method. -type FavoritesClientAddOptions struct { - // placeholder for future optional parameters -} +// InnerError - Inner error +type InnerError struct { + // Provides correlation for request + Diagnosticcontext *string -// FavoritesClientDeleteOptions contains the optional parameters for the FavoritesClient.Delete method. -type FavoritesClientDeleteOptions struct { - // placeholder for future optional parameters + // Request time + Time *time.Time } -// FavoritesClientGetOptions contains the optional parameters for the FavoritesClient.Get method. -type FavoritesClientGetOptions struct { - // placeholder for future optional parameters +// InnerErrorTrace - Error details +type InnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string } -// FavoritesClientListOptions contains the optional parameters for the FavoritesClient.List method. -type FavoritesClientListOptions struct { - // Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content - // for favorites. - CanFetchContent *bool - // The type of favorite. Value can be either shared or user. - FavoriteType *FavoriteType - // Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum). - SourceType *FavoriteSourceType - // Tags that must be present on each favorite returned. - Tags []string +// LinkedStorageAccountsProperties - An Application Insights component linked storage account +type LinkedStorageAccountsProperties struct { + // Linked storage account resource ID + LinkedStorageAccount *string } -// FavoritesClientUpdateOptions contains the optional parameters for the FavoritesClient.Update method. -type FavoritesClientUpdateOptions 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 } -// InnerError - Inner error -type InnerError struct { - // Provides correlation for request - Diagnosticcontext *string - - // Request time - Time *time.Time -} +// 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 -// LinkProperties - Contains a sourceId and workbook resource id to link two resources. -type LinkProperties struct { - // The category of workbook - Category *string + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity - // The source Azure resource id - SourceID *string + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string - // The workbook Azure resource id - TargetID *string + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string } // MyWorkbook - An Application Insights private workbook definition. type MyWorkbook struct { + // Resource etag + Etag map[string]*string + // Azure resource Id ID *string + // Identity used for BYOS + Identity *MyWorkbookManagedIdentity + // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind + Kind *Kind // Resource location Location *string @@ -936,18 +827,24 @@ type MyWorkbook struct { // Azure resource type Type *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData } -// 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 + // The error details. + Error *ErrorDefinition +} - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract +// MyWorkbookManagedIdentity - Customer Managed Identity +type MyWorkbookManagedIdentity struct { + // The identity type. + Type *MyWorkbookManagedIdentityType - // Human-readable representation of the error. - Message *string + // Customer Managed Identity + UserAssignedIdentities *MyWorkbookUserAssignedIdentities } // MyWorkbookProperties - Properties that contain a private workbook. @@ -964,6 +861,9 @@ type MyWorkbookProperties struct { // Optional resourceId for a source resource. SourceID *string + // BYOS Storage Account URI + StorageURI *string + // A list of 0 or more tags that are associated with this private workbook definition Tags []*string @@ -979,9 +879,15 @@ type MyWorkbookProperties struct { // MyWorkbookResource - An azure resource object type MyWorkbookResource struct { + // Resource etag + Etag map[string]*string + // Azure resource Id ID *string + // Identity used for BYOS + Identity *MyWorkbookManagedIdentity + // Resource location Location *string @@ -995,53 +901,24 @@ type MyWorkbookResource struct { Type *string } -// MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate method. -type MyWorkbooksClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MyWorkbooksClientDeleteOptions contains the optional parameters for the MyWorkbooksClient.Delete method. -type MyWorkbooksClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MyWorkbooksClientGetOptions contains the optional parameters for the MyWorkbooksClient.Get method. -type MyWorkbooksClientGetOptions struct { - // placeholder for future optional parameters -} +// MyWorkbookUserAssignedIdentities - Customer Managed Identity +type MyWorkbookUserAssignedIdentities struct { + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string -// MyWorkbooksClientListByResourceGroupOptions contains the optional parameters for the MyWorkbooksClient.NewListByResourceGroupPager -// method. -type MyWorkbooksClientListByResourceGroupOptions struct { - // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content - // for workbooks. - CanFetchContent *bool - // Tags presents on each workbook returned. - Tags []string -} - -// MyWorkbooksClientListBySubscriptionOptions contains the optional parameters for the MyWorkbooksClient.NewListBySubscriptionPager -// method. -type MyWorkbooksClientListBySubscriptionOptions struct { - // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content - // for workbooks. - CanFetchContent *bool - // Tags presents on each workbook returned. - Tags []string -} - -// MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. -type MyWorkbooksClientUpdateOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The tenant ID of resource. + TenantID *string } // MyWorkbooksListResult - Workbook list result. type MyWorkbooksListResult struct { + NextLink *string + // READ-ONLY; An array of private workbooks. Value []*MyWorkbook } -// Operation - CDN REST API operation +// Operation - Azure Workbooks REST API operation type Operation struct { // The object that represents the operation. Display *OperationDisplay @@ -1055,23 +932,65 @@ type OperationDisplay struct { // Operation type: Read, write, delete, etc. Operation *string - // Service provider: Microsoft.Cdn + // Service provider: Microsoft.Insights Provider *string // Resource on which the operation is performed: Profile, endpoint, etc. Resource *string } -// OperationListResult - Result of the request to list CDN operations. It contains a list of operations and a URL link to -// get the next set of results. +// OperationInfo - Information about an operation +type OperationInfo struct { + // Description of the operation + Description *string + + // Name of the operation + Operation *string + + // Name of the provider + Provider *string + + // Name of the resource type + Resource *string +} + +// OperationListResult - Result of the request to list Azure Workbooks operations. It contains a list of operations and a +// URL link to get the next set of results. type OperationListResult struct { // URL to get the next set of operation list results if there are any. NextLink *string - // List of CDN operations supported by the CDN resource provider. + // List of Workbook operations supported by the Microsoft.Insights resource provider. Value []*Operation } +// OperationLive - Represents an operation returned by the GetOperations request +type OperationLive struct { + // Display name of the operation + Display *OperationInfo + + // Indicates whether the operation is a data action + IsDataAction *bool + + // Name of the operation + Name *string + + // Origin of the operation + Origin *string + + // Properties of the operation + Properties any +} + +// OperationsListResult - Result of the List Operations operation +type OperationsListResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string + + // A collection of operations + Value []*OperationLive +} + // PrivateLinkScopedResource - The private link scope resource reference. type PrivateLinkScopedResource struct { // The full resource Id of the private link scope resource. @@ -1081,22 +1000,50 @@ type PrivateLinkScopedResource struct { ScopeID *string } -// ProactiveDetectionConfigurationsClientGetOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Get -// method. -type ProactiveDetectionConfigurationsClientGetOptions 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 + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ProactiveDetectionConfigurationsClientListOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.List -// method. -type ProactiveDetectionConfigurationsClientListOptions struct { - // placeholder for future optional parameters +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ProactiveDetectionConfigurationsClientUpdateOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Update -// method. -type ProactiveDetectionConfigurationsClientUpdateOptions struct { - // placeholder for future optional parameters +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } // TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags on a WebTest instance. @@ -1105,12 +1052,40 @@ type TagsResource struct { Tags map[string]*string } -// WebTest - An Application Insights web test definition. +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// WebTest - An Application Insights WebTest definition. type WebTest struct { // REQUIRED; Resource location Location *string - // The kind of web test that this web test watches. Choices are ping and multistep. + // The kind of WebTest that this web test watches. Choices are ping, multistep and standard. Kind *WebTestKind // Metadata describing a web test for an Azure resource. @@ -1129,28 +1104,23 @@ type WebTest struct { Type *string } -// WebTestGeolocation - Geo-physical location to run a web test from. You must specify one or more locations for the test -// to run from. +// WebTestGeolocation - Geo-physical location to run a WebTest from. You must specify one or more locations for the test to +// run from. type WebTestGeolocation struct { - // Location ID for the webtest to run from. + // Location ID for the WebTest to run from. Location *string } -// WebTestListResult - A list of 0 or more Application Insights web test definitions. +// WebTestListResult - A list of 0 or more Application Insights WebTest definitions. type WebTestListResult struct { - // REQUIRED; Set of Application Insights web test definitions. + // REQUIRED; Set of Application Insights WebTest definitions. Value []*WebTest - // The link to get the next part of the returned list of web tests, should the return set be too large for a single request. + // The link to get the next part of the returned list of WebTest, should the return set be too large for a single request. // May be null. NextLink *string } -// WebTestLocationsClientListOptions contains the optional parameters for the WebTestLocationsClient.NewListPager method. -type WebTestLocationsClientListOptions struct { - // placeholder for future optional parameters -} - // WebTestLocationsListResult - Describes the list of web test locations available to an Application Insights Component. type WebTestLocationsListResult struct { // REQUIRED; List of web test locations. @@ -1165,7 +1135,7 @@ type WebTestProperties struct { // REQUIRED; Unique ID of this WebTest. This is typically the same value as the Name field. SyntheticMonitorID *string - // REQUIRED; The kind of web test this is, valid choices are ping and multistep. + // REQUIRED; The kind of web test this is, valid choices are ping, multistep and standard. WebTestKind *WebTestKind // REQUIRED; User defined name if this WebTest. @@ -1174,7 +1144,7 @@ type WebTestProperties struct { // An XML configuration specification for a WebTest. Configuration *WebTestPropertiesConfiguration - // Purpose/user defined descriptive test for this WebTest. + // User defined description for this WebTest. Description *string // Is the test actively being monitored. @@ -1183,12 +1153,18 @@ type WebTestProperties struct { // Interval in seconds between test runs for this WebTest. Default value is 300. Frequency *int32 + // The collection of request properties + Request *WebTestPropertiesRequest + // Allow for retries should this WebTest fail. RetryEnabled *bool // Seconds until this WebTest will timeout and fail. Default value is 30. Timeout *int32 + // The collection of validation rule properties + ValidationRules *WebTestPropertiesValidationRules + // READ-ONLY; Current state of this component, whether or not is has been provisioned within the resource group it is defined. // Users cannot change this value but are able to read from it. Values will include // Succeeded, Deploying, Canceled, and Failed. @@ -1201,40 +1177,57 @@ type WebTestPropertiesConfiguration struct { WebTest *string } -// WebTestsClientCreateOrUpdateOptions contains the optional parameters for the WebTestsClient.CreateOrUpdate method. -type WebTestsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} +// WebTestPropertiesRequest - The collection of request properties +type WebTestPropertiesRequest struct { + // Follow redirects for this web test. + FollowRedirects *bool -// WebTestsClientDeleteOptions contains the optional parameters for the WebTestsClient.Delete method. -type WebTestsClientDeleteOptions struct { - // placeholder for future optional parameters -} + // Http verb to use for this web test. + HTTPVerb *string -// WebTestsClientGetOptions contains the optional parameters for the WebTestsClient.Get method. -type WebTestsClientGetOptions struct { - // placeholder for future optional parameters -} + // List of headers and their values to add to the WebTest call. + Headers []*HeaderField -// WebTestsClientListByComponentOptions contains the optional parameters for the WebTestsClient.NewListByComponentPager method. -type WebTestsClientListByComponentOptions struct { - // placeholder for future optional parameters -} + // Parse Dependent request for this WebTest. + ParseDependentRequests *bool + + // Base64 encoded string body to send with this web test. + RequestBody *string -// WebTestsClientListByResourceGroupOptions contains the optional parameters for the WebTestsClient.NewListByResourceGroupPager -// method. -type WebTestsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters + // Url location to test. + RequestURL *string } -// WebTestsClientListOptions contains the optional parameters for the WebTestsClient.NewListPager method. -type WebTestsClientListOptions struct { - // placeholder for future optional parameters +// WebTestPropertiesValidationRules - The collection of validation rule properties +type WebTestPropertiesValidationRules struct { + // The collection of content validation properties + ContentValidation *WebTestPropertiesValidationRulesContentValidation + + // Validate that the WebTest returns the http status code provided. + ExpectedHTTPStatusCode *int32 + + // When set, validation will ignore the status code. + IgnoreHTTPStatusCode *bool + + // A number of days to check still remain before the the existing SSL cert expires. Value must be positive and the SSLCheck + // must be set to true. + SSLCertRemainingLifetimeCheck *int32 + + // Checks to see if the SSL cert is still valid. + SSLCheck *bool } -// WebTestsClientUpdateTagsOptions contains the optional parameters for the WebTestsClient.UpdateTags method. -type WebTestsClientUpdateTagsOptions struct { - // placeholder for future optional parameters +// WebTestPropertiesValidationRulesContentValidation - The collection of content validation properties +type WebTestPropertiesValidationRulesContentValidation struct { + // Content to look for in the return of the WebTest. Must not be null or empty. + ContentMatch *string + + // When set, this value makes the ContentMatch validation case insensitive. + IgnoreCase *bool + + // When true, validation will pass if there is a match for the ContentMatch string. If false, validation will fail if there + // is a match + PassIfTextFound *bool } // WebtestsResource - An azure resource object @@ -1285,42 +1278,6 @@ type WorkItemConfigurationError struct { Message *string } -// WorkItemConfigurationsClientCreateOptions contains the optional parameters for the WorkItemConfigurationsClient.Create -// method. -type WorkItemConfigurationsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// WorkItemConfigurationsClientDeleteOptions contains the optional parameters for the WorkItemConfigurationsClient.Delete -// method. -type WorkItemConfigurationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// WorkItemConfigurationsClientGetDefaultOptions contains the optional parameters for the WorkItemConfigurationsClient.GetDefault -// method. -type WorkItemConfigurationsClientGetDefaultOptions struct { - // placeholder for future optional parameters -} - -// WorkItemConfigurationsClientGetItemOptions contains the optional parameters for the WorkItemConfigurationsClient.GetItem -// method. -type WorkItemConfigurationsClientGetItemOptions struct { - // placeholder for future optional parameters -} - -// WorkItemConfigurationsClientListOptions contains the optional parameters for the WorkItemConfigurationsClient.NewListPager -// method. -type WorkItemConfigurationsClientListOptions struct { - // placeholder for future optional parameters -} - -// WorkItemConfigurationsClientUpdateItemOptions contains the optional parameters for the WorkItemConfigurationsClient.UpdateItem -// method. -type WorkItemConfigurationsClientUpdateItemOptions struct { - // placeholder for future optional parameters -} - // WorkItemConfigurationsListResult - Work item configuration list result. type WorkItemConfigurationsListResult struct { // READ-ONLY; An array of work item configurations. @@ -1342,126 +1299,312 @@ type WorkItemCreateConfiguration struct { WorkItemProperties map[string]*string } -// Workbook - An Application Insights workbook definition. +// Workbook - A workbook definition. type Workbook struct { - // The kind of workbook. Choices are user and shared. - Kind *SharedTypeKind - - // Resource location + // REQUIRED; The geo-location where the resource lives Location *string - // Metadata describing a web test for an Azure resource. + // Resource etag + Etag *string + + // Identity used for BYOS + Identity *WorkbookResourceIdentity + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Metadata describing a workbook for an Azure resource. Properties *WorkbookProperties - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; Azure resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure resource type + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// WorkbookError - Error message body that will indicate why the operation failed. +// WorkbookError - Error response. type WorkbookError struct { - // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + // The error details. + Error *WorkbookErrorDefinition +} + +// WorkbookErrorDefinition - Error definition. +type WorkbookErrorDefinition struct { + // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. Code *string - // The list of invalid fields send in request, in case of validation error. - Details []*ErrorFieldContract + // READ-ONLY; Internal error details. + Innererror *WorkbookInnerErrorTrace - // Human-readable representation of the error. + // READ-ONLY; Description of the error. Message *string } +// WorkbookInnerErrorTrace - Error details +type WorkbookInnerErrorTrace struct { + // READ-ONLY; detailed error trace + Trace []*string +} + // WorkbookProperties - Properties that contain a workbook. type WorkbookProperties struct { // REQUIRED; Workbook category, as defined by the user at creation time. Category *string - // REQUIRED; The user-defined name of the workbook. - Name *string + // REQUIRED; The user-defined name (display name) of the workbook. + DisplayName *string // REQUIRED; Configuration of this particular workbook. Configuration data is a string containing valid JSON SerializedData *string - // REQUIRED; Enum indicating if this workbook definition is owned by a specific user or is shared between all users with access - // to the Application Insights component. - SharedTypeKind *SharedTypeKind - - // REQUIRED; Unique user id of the specific user that owns this workbook. - UserID *string + // The description of the workbook. + Description *string - // REQUIRED; Internally assigned unique id of the workbook definition. - WorkbookID *string + // ResourceId for a source resource. + SourceID *string - // Optional resourceId for a source resource. - SourceResourceID *string + // The resourceId to the storage account when bring your own storage is used + StorageURI *string - // A list of 0 or more tags that are associated with this workbook definition + // Being deprecated, please use the other tags field Tags []*string - // This instance's version of the data model. This can change as new features are added that can be marked workbook. + // Workbook schema version format, like 'Notebook/1.0', which should match the workbook in serializedData Version *string + // READ-ONLY; The unique revision id for this workbook definition + Revision *string + // READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. - TimeModified *string + TimeModified *time.Time + + // READ-ONLY; Unique user id of the specific user that owns this workbook. + UserID *string +} + +// WorkbookPropertiesUpdateParameters - Properties that contain a workbook for PATCH operation. +type WorkbookPropertiesUpdateParameters struct { + // Workbook category, as defined by the user at creation time. + Category *string + + // The description of the workbook. + Description *string + + // The user-defined name (display name) of the workbook. + DisplayName *string + + // The unique revision id for this workbook definition + Revision *string + + // Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string + + // A list of 0 or more tags that are associated with this workbook definition + Tags []*string } // WorkbookResource - An azure resource object type WorkbookResource struct { - // Resource location + // REQUIRED; The geo-location where the resource lives Location *string + // Resource etag + Etag *string + + // Identity used for BYOS + Identity *WorkbookResourceIdentity + + // The kind of workbook. Only valid value is shared. + Kind *WorkbookSharedTypeKind + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WorkbookResourceIdentity - Identity used for BYOS +type WorkbookResourceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// WorkbookTemplate - An Application Insights workbook template definition. +type WorkbookTemplate struct { + // REQUIRED; Resource location + Location *string + + // Metadata describing a workbook template for an Azure resource. + Properties *WorkbookTemplateProperties + // Resource tags Tags map[string]*string // READ-ONLY; Azure resource Id ID *string - // READ-ONLY; Azure resource name + // READ-ONLY; Azure resource name. Name *string // READ-ONLY; Azure resource type Type *string } -// WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate method. -type WorkbooksClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +// 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 } -// WorkbooksClientDeleteOptions contains the optional parameters for the WorkbooksClient.Delete method. -type WorkbooksClientDeleteOptions struct { - // placeholder for future optional parameters +// WorkbookTemplateErrorBody - Error message body that will indicate why the operation failed. +type WorkbookTemplateErrorBody struct { + // Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string + + // The list of invalid fields send in request, in case of validation error. + Details []*WorkbookTemplateErrorFieldContract + + // Human-readable representation of the error. + Message *string } -// WorkbooksClientGetOptions contains the optional parameters for the WorkbooksClient.Get method. -type WorkbooksClientGetOptions struct { - // placeholder for future optional parameters +// WorkbookTemplateErrorFieldContract - Error Field contract. +type WorkbookTemplateErrorFieldContract struct { + // Property level error code. + Code *string + + // Human-readable representation of property-level error. + Message *string + + // Property name. + Target *string } -// WorkbooksClientListByResourceGroupOptions contains the optional parameters for the WorkbooksClient.NewListByResourceGroupPager -// 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 - // Tags presents on each workbook returned. - Tags []string +// WorkbookTemplateGallery - Gallery information for a workbook template. +type WorkbookTemplateGallery struct { + // Category for the gallery. + Category *string + + // Name of the workbook template in the gallery. + Name *string + + // Order of the template within the gallery. + Order *int32 + + // Azure resource type supported by the gallery. + ResourceType *string + + // Type of workbook supported by the workbook template. + Type *string +} + +// WorkbookTemplateLocalizedGallery - Localized template data and gallery information. +type WorkbookTemplateLocalizedGallery struct { + // Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery + + // Valid JSON object containing workbook template payload. + TemplateData any +} + +// WorkbookTemplateProperties - Properties that contain a workbook template. +type WorkbookTemplateProperties struct { + // REQUIRED; Workbook galleries supported by the template. + Galleries []*WorkbookTemplateGallery + + // REQUIRED; Valid JSON object containing workbook template payload. + TemplateData any + + // Information about the author of the workbook template. + Author *string + + // Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. + Localized map[string][]*WorkbookTemplateLocalizedGallery + + // Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. + Priority *int32 +} + +// WorkbookTemplateResource - An azure resource object +type WorkbookTemplateResource struct { + // REQUIRED; Resource location + Location *string + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Azure resource Id + ID *string + + // READ-ONLY; Azure resource name. + Name *string + + // READ-ONLY; Azure resource type + Type *string } -// WorkbooksClientUpdateOptions contains the optional parameters for the WorkbooksClient.Update method. -type WorkbooksClientUpdateOptions struct { - // placeholder for future optional parameters +// WorkbookTemplateUpdateParameters - The parameters that can be provided when updating workbook template. +type WorkbookTemplateUpdateParameters struct { + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookTemplateProperties + + // Resource tags + Tags map[string]*string +} + +// WorkbookTemplatesListResult - WorkbookTemplate list result. +type WorkbookTemplatesListResult struct { + // An array of workbook templates. + Value []*WorkbookTemplate +} + +// WorkbookUpdateParameters - The parameters that can be provided when updating workbook properties properties. +type WorkbookUpdateParameters struct { + // The kind of workbook. Only valid value is shared. + Kind *WorkbookUpdateSharedTypeKind + + // Metadata describing a workbook for an Azure resource. + Properties *WorkbookPropertiesUpdateParameters + + // Resource tags. + Tags map[string]*string } // WorkbooksListResult - Workbook list result. type WorkbooksListResult struct { + NextLink *string + // READ-ONLY; An array of workbooks. Value []*Workbook } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go index fcf30fea69c9..bc677e27e123 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -898,6 +897,72 @@ func (c *ComponentFeatureCapability) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ComponentLinkedStorageAccounts. +func (c ComponentLinkedStorageAccounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentLinkedStorageAccounts. +func (c *ComponentLinkedStorageAccounts) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentLinkedStorageAccountsPatch. +func (c ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentLinkedStorageAccountsPatch. +func (c *ComponentLinkedStorageAccountsPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ComponentListResult. func (c ComponentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1387,6 +1452,41 @@ func (c *ComponentsResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populateAny(objectMap, "innererror", e.Innererror) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. +func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &e.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorFieldContract. func (e ErrorFieldContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1426,6 +1526,7 @@ func (e *ErrorFieldContract) UnmarshalJSON(data []byte) error { func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } @@ -1442,6 +1543,9 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) @@ -1511,6 +1615,95 @@ func (e *ErrorResponseComponentsError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseLinkedStorage. +func (e ErrorResponseLinkedStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseLinkedStorage. +func (e *ErrorResponseLinkedStorage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseLinkedStorageError. +func (e ErrorResponseLinkedStorageError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseLinkedStorageError. +func (e *ErrorResponseLinkedStorageError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HeaderField. +func (h HeaderField) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", h.HeaderFieldName) + populate(objectMap, "value", h.HeaderFieldValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HeaderField. +func (h *HeaderField) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "HeaderFieldName", &h.HeaderFieldName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "HeaderFieldValue", &h.HeaderFieldValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type InnerError. func (i InnerError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1542,32 +1735,78 @@ func (i *InnerError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LinkProperties. -func (l LinkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InnerErrorTrace. +func (i InnerErrorTrace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", l.Category) - populate(objectMap, "sourceId", l.SourceID) - populate(objectMap, "targetId", l.TargetID) + populate(objectMap, "trace", i.Trace) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LinkProperties. -func (l *LinkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorTrace. +func (i *InnerErrorTrace) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &l.Category) + case "trace": + err = unpopulate(val, "Trace", &i.Trace) delete(rawMsg, key) - case "sourceId": - err = unpopulate(val, "SourceID", &l.SourceID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkedStorageAccountsProperties. +func (l LinkedStorageAccountsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "linkedStorageAccount", l.LinkedStorageAccount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkedStorageAccountsProperties. +func (l *LinkedStorageAccountsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkedStorageAccount": + err = unpopulate(val, "LinkedStorageAccount", &l.LinkedStorageAccount) delete(rawMsg, key) - case "targetId": - err = unpopulate(val, "TargetID", &l.TargetID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LiveTokenResponse. +func (l LiveTokenResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "liveToken", l.LiveToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveTokenResponse. +func (l *LiveTokenResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "liveToken": + err = unpopulate(val, "LiveToken", &l.LiveToken) delete(rawMsg, key) } if err != nil { @@ -1577,14 +1816,56 @@ func (l *LinkProperties) 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]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MyWorkbook. func (m MyWorkbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + 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) @@ -1599,9 +1880,15 @@ func (m *MyWorkbook) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &m.Kind) delete(rawMsg, key) @@ -1614,6 +1901,9 @@ func (m *MyWorkbook) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) @@ -1631,9 +1921,7 @@ func (m *MyWorkbook) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MyWorkbookError. func (m MyWorkbookError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", m.Code) - populate(objectMap, "details", m.Details) - populate(objectMap, "message", m.Message) + populate(objectMap, "error", m.Error) return json.Marshal(objectMap) } @@ -1646,14 +1934,8 @@ func (m *MyWorkbookError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &m.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &m.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &m.Message) + case "error": + err = unpopulate(val, "Error", &m.Error) delete(rawMsg, key) } if err != nil { @@ -1663,22 +1945,16 @@ func (m *MyWorkbookError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MyWorkbookProperties. -func (m MyWorkbookProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MyWorkbookManagedIdentity. +func (m MyWorkbookManagedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "serializedData", m.SerializedData) - populate(objectMap, "sourceId", m.SourceID) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "timeModified", m.TimeModified) - populate(objectMap, "userId", m.UserID) - populate(objectMap, "version", m.Version) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookProperties. -func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookManagedIdentity. +func (m *MyWorkbookManagedIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1686,10 +1962,48 @@ func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) - case "displayName": + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MyWorkbookProperties. +func (m MyWorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", m.Category) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "serializedData", m.SerializedData) + populate(objectMap, "sourceId", m.SourceID) + populate(objectMap, "storageUri", m.StorageURI) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "timeModified", m.TimeModified) + populate(objectMap, "userId", m.UserID) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookProperties. +func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "displayName": err = unpopulate(val, "DisplayName", &m.DisplayName) delete(rawMsg, key) case "serializedData": @@ -1698,6 +2012,9 @@ func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { case "sourceId": err = unpopulate(val, "SourceID", &m.SourceID) delete(rawMsg, key) + case "storageUri": + err = unpopulate(val, "StorageURI", &m.StorageURI) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) @@ -1721,7 +2038,9 @@ func (m *MyWorkbookProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MyWorkbookResource. func (m MyWorkbookResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + 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) @@ -1738,9 +2057,15 @@ func (m *MyWorkbookResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -1761,9 +2086,41 @@ func (m *MyWorkbookResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MyWorkbookUserAssignedIdentities. +func (m MyWorkbookUserAssignedIdentities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MyWorkbookUserAssignedIdentities. +func (m *MyWorkbookUserAssignedIdentities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MyWorkbooksListResult. func (m MyWorkbooksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -1777,6 +2134,9 @@ func (m *MyWorkbooksListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -1854,6 +2214,45 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationInfo. +func (o OperationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInfo. +func (o *OperationInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1885,6 +2284,80 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationLive. +func (o OperationLive) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populateAny(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLive. +func (o *OperationLive) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. +func (o OperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResult. +func (o *OperationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1916,170 +2389,361 @@ func (p *PrivateLinkScopedResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", t.Tags) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. -func (t *TagsResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTest. -func (w WebTest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "kind", w.Kind) - populate(objectMap, "location", w.Location) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "type", w.Type) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTest. -func (w *WebTest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &w.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &w.Tags) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &w.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestGeolocation. -func (w WebTestGeolocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "Id", w.Location) + 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 WebTestGeolocation. -func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { +// 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "Id": - err = unpopulate(val, "Location", &w.Location) + 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestListResult. -func (w WebTestListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) + populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestListResult. -func (w *WebTestListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestLocationsListResult. -func (w WebTestLocationsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", w.Value) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestLocationsListResult. -func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &w.Value) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebTestProperties. +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTest. +func (w WebTest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTest. +func (w *WebTest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestGeolocation. +func (w WebTestGeolocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "Id", w.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestGeolocation. +func (w *WebTestGeolocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "Id": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestListResult. +func (w WebTestListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestListResult. +func (w *WebTestListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestLocationsListResult. +func (w WebTestLocationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestLocationsListResult. +func (w *WebTestLocationsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestProperties. func (w WebTestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "Configuration", w.Configuration) @@ -2088,9 +2752,11 @@ func (w WebTestProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "Frequency", w.Frequency) populate(objectMap, "Locations", w.Locations) populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "Request", w.Request) populate(objectMap, "RetryEnabled", w.RetryEnabled) populate(objectMap, "SyntheticMonitorId", w.SyntheticMonitorID) populate(objectMap, "Timeout", w.Timeout) + populate(objectMap, "ValidationRules", w.ValidationRules) populate(objectMap, "Kind", w.WebTestKind) populate(objectMap, "Name", w.WebTestName) return json.Marshal(objectMap) @@ -2123,6 +2789,9 @@ func (w *WebTestProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) delete(rawMsg, key) + case "Request": + err = unpopulate(val, "Request", &w.Request) + delete(rawMsg, key) case "RetryEnabled": err = unpopulate(val, "RetryEnabled", &w.RetryEnabled) delete(rawMsg, key) @@ -2132,6 +2801,9 @@ func (w *WebTestProperties) UnmarshalJSON(data []byte) error { case "Timeout": err = unpopulate(val, "Timeout", &w.Timeout) delete(rawMsg, key) + case "ValidationRules": + err = unpopulate(val, "ValidationRules", &w.ValidationRules) + delete(rawMsg, key) case "Kind": err = unpopulate(val, "WebTestKind", &w.WebTestKind) delete(rawMsg, key) @@ -2173,6 +2845,131 @@ func (w *WebTestPropertiesConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesRequest. +func (w WebTestPropertiesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "FollowRedirects", w.FollowRedirects) + populate(objectMap, "HttpVerb", w.HTTPVerb) + populate(objectMap, "Headers", w.Headers) + populate(objectMap, "ParseDependentRequests", w.ParseDependentRequests) + populate(objectMap, "RequestBody", w.RequestBody) + populate(objectMap, "RequestUrl", w.RequestURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesRequest. +func (w *WebTestPropertiesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "FollowRedirects": + err = unpopulate(val, "FollowRedirects", &w.FollowRedirects) + delete(rawMsg, key) + case "HttpVerb": + err = unpopulate(val, "HTTPVerb", &w.HTTPVerb) + delete(rawMsg, key) + case "Headers": + err = unpopulate(val, "Headers", &w.Headers) + delete(rawMsg, key) + case "ParseDependentRequests": + err = unpopulate(val, "ParseDependentRequests", &w.ParseDependentRequests) + delete(rawMsg, key) + case "RequestBody": + err = unpopulate(val, "RequestBody", &w.RequestBody) + delete(rawMsg, key) + case "RequestUrl": + err = unpopulate(val, "RequestURL", &w.RequestURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesValidationRules. +func (w WebTestPropertiesValidationRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ContentValidation", w.ContentValidation) + populate(objectMap, "ExpectedHttpStatusCode", w.ExpectedHTTPStatusCode) + populate(objectMap, "IgnoreHttpStatusCode", w.IgnoreHTTPStatusCode) + populate(objectMap, "SSLCertRemainingLifetimeCheck", w.SSLCertRemainingLifetimeCheck) + populate(objectMap, "SSLCheck", w.SSLCheck) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesValidationRules. +func (w *WebTestPropertiesValidationRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ContentValidation": + err = unpopulate(val, "ContentValidation", &w.ContentValidation) + delete(rawMsg, key) + case "ExpectedHttpStatusCode": + err = unpopulate(val, "ExpectedHTTPStatusCode", &w.ExpectedHTTPStatusCode) + delete(rawMsg, key) + case "IgnoreHttpStatusCode": + err = unpopulate(val, "IgnoreHTTPStatusCode", &w.IgnoreHTTPStatusCode) + delete(rawMsg, key) + case "SSLCertRemainingLifetimeCheck": + err = unpopulate(val, "SSLCertRemainingLifetimeCheck", &w.SSLCertRemainingLifetimeCheck) + delete(rawMsg, key) + case "SSLCheck": + err = unpopulate(val, "SSLCheck", &w.SSLCheck) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebTestPropertiesValidationRulesContentValidation. +func (w WebTestPropertiesValidationRulesContentValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ContentMatch", w.ContentMatch) + populate(objectMap, "IgnoreCase", w.IgnoreCase) + populate(objectMap, "PassIfTextFound", w.PassIfTextFound) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebTestPropertiesValidationRulesContentValidation. +func (w *WebTestPropertiesValidationRulesContentValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ContentMatch": + err = unpopulate(val, "ContentMatch", &w.ContentMatch) + delete(rawMsg, key) + case "IgnoreCase": + err = unpopulate(val, "IgnoreCase", &w.IgnoreCase) + delete(rawMsg, key) + case "PassIfTextFound": + err = unpopulate(val, "PassIfTextFound", &w.PassIfTextFound) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WebtestsResource. func (w WebtestsResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2363,11 +3160,14 @@ func (w *WorkItemCreateConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Workbook. func (w Workbook) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "etag", w.Etag) populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) populate(objectMap, "kind", w.Kind) populate(objectMap, "location", w.Location) populate(objectMap, "name", w.Name) populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) populate(objectMap, "tags", w.Tags) populate(objectMap, "type", w.Type) return json.Marshal(objectMap) @@ -2382,9 +3182,15 @@ func (w *Workbook) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &w.Kind) delete(rawMsg, key) @@ -2397,6 +3203,9 @@ func (w *Workbook) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) @@ -2414,9 +3223,7 @@ func (w *Workbook) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkbookError. func (w WorkbookError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", w.Code) - populate(objectMap, "details", w.Details) - populate(objectMap, "message", w.Message) + populate(objectMap, "error", w.Error) return json.Marshal(objectMap) } @@ -2429,14 +3236,8 @@ func (w *WorkbookError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &w.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &w.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &w.Message) + case "error": + err = unpopulate(val, "Error", &w.Error) delete(rawMsg, key) } if err != nil { @@ -2446,19 +3247,82 @@ func (w *WorkbookError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkbookProperties. -func (w WorkbookProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WorkbookErrorDefinition. +func (w WorkbookErrorDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", w.Category) - populate(objectMap, "name", w.Name) - populate(objectMap, "serializedData", w.SerializedData) - populate(objectMap, "kind", w.SharedTypeKind) - populate(objectMap, "sourceResourceId", w.SourceResourceID) - populate(objectMap, "tags", w.Tags) - populate(objectMap, "timeModified", w.TimeModified) - populate(objectMap, "userId", w.UserID) - populate(objectMap, "version", w.Version) - populate(objectMap, "workbookId", w.WorkbookID) + populate(objectMap, "code", w.Code) + populate(objectMap, "innererror", w.Innererror) + populate(objectMap, "message", w.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookErrorDefinition. +func (w *WorkbookErrorDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &w.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &w.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookInnerErrorTrace. +func (w WorkbookInnerErrorTrace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "trace", w.Trace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookInnerErrorTrace. +func (w *WorkbookInnerErrorTrace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "trace": + err = unpopulate(val, "Trace", &w.Trace) + 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 WorkbookProperties. +func (w WorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", w.Category) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "serializedData", w.SerializedData) + populate(objectMap, "sourceId", w.SourceID) + populate(objectMap, "storageUri", w.StorageURI) + populate(objectMap, "tags", w.Tags) + populateTimeRFC3339(objectMap, "timeModified", w.TimeModified) + populate(objectMap, "userId", w.UserID) + populate(objectMap, "version", w.Version) return json.Marshal(objectMap) } @@ -2474,23 +3338,29 @@ func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { case "category": err = unpopulate(val, "Category", &w.Category) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) + 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 "kind": - err = unpopulate(val, "SharedTypeKind", &w.SharedTypeKind) + case "sourceId": + err = unpopulate(val, "SourceID", &w.SourceID) delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &w.SourceResourceID) + 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 = unpopulate(val, "TimeModified", &w.TimeModified) + err = unpopulateTimeRFC3339(val, "TimeModified", &w.TimeModified) delete(rawMsg, key) case "userId": err = unpopulate(val, "UserID", &w.UserID) @@ -2498,8 +3368,52 @@ func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { case "version": err = unpopulate(val, "Version", &w.Version) delete(rawMsg, key) - case "workbookId": - err = unpopulate(val, "WorkbookID", &w.WorkbookID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookPropertiesUpdateParameters. +func (w WorkbookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", w.Category) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "revision", w.Revision) + populate(objectMap, "serializedData", w.SerializedData) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookPropertiesUpdateParameters. +func (w *WorkbookPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &w.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &w.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &w.Revision) + delete(rawMsg, key) + case "serializedData": + err = unpopulate(val, "SerializedData", &w.SerializedData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) delete(rawMsg, key) } if err != nil { @@ -2512,7 +3426,10 @@ func (w *WorkbookProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkbookResource. func (w WorkbookResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "etag", w.Etag) populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "kind", w.Kind) populate(objectMap, "location", w.Location) populate(objectMap, "name", w.Name) populate(objectMap, "tags", w.Tags) @@ -2529,9 +3446,18 @@ func (w *WorkbookResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &w.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &w.Kind) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &w.Location) delete(rawMsg, key) @@ -2552,9 +3478,446 @@ func (w *WorkbookResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WorkbookResourceIdentity. +func (w WorkbookResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", w.PrincipalID) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "type", w.Type) + populate(objectMap, "userAssignedIdentities", w.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookResourceIdentity. +func (w *WorkbookResourceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &w.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &w.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplate. +func (w WorkbookTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplate. +func (w *WorkbookTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateError. +func (w WorkbookTemplateError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", w.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateError. +func (w *WorkbookTemplateError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &w.Error) + 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 WorkbookTemplateErrorBody. +func (w WorkbookTemplateErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", w.Code) + populate(objectMap, "details", w.Details) + populate(objectMap, "message", w.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateErrorBody. +func (w *WorkbookTemplateErrorBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &w.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &w.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) + 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 WorkbookTemplateErrorFieldContract. +func (w WorkbookTemplateErrorFieldContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", w.Code) + populate(objectMap, "message", w.Message) + populate(objectMap, "target", w.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateErrorFieldContract. +func (w *WorkbookTemplateErrorFieldContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &w.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &w.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateGallery. +func (w WorkbookTemplateGallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", w.Category) + populate(objectMap, "name", w.Name) + populate(objectMap, "order", w.Order) + populate(objectMap, "resourceType", w.ResourceType) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateGallery. +func (w *WorkbookTemplateGallery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &w.Category) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &w.Order) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &w.ResourceType) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateLocalizedGallery. +func (w WorkbookTemplateLocalizedGallery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "galleries", w.Galleries) + populateAny(objectMap, "templateData", w.TemplateData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateLocalizedGallery. +func (w *WorkbookTemplateLocalizedGallery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "galleries": + err = unpopulate(val, "Galleries", &w.Galleries) + delete(rawMsg, key) + case "templateData": + err = unpopulate(val, "TemplateData", &w.TemplateData) + 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 WorkbookTemplateProperties. +func (w WorkbookTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "author", w.Author) + populate(objectMap, "galleries", w.Galleries) + populate(objectMap, "localized", w.Localized) + populate(objectMap, "priority", w.Priority) + populateAny(objectMap, "templateData", w.TemplateData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateProperties. +func (w *WorkbookTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &w.Author) + delete(rawMsg, key) + case "galleries": + err = unpopulate(val, "Galleries", &w.Galleries) + delete(rawMsg, key) + case "localized": + err = unpopulate(val, "Localized", &w.Localized) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &w.Priority) + delete(rawMsg, key) + case "templateData": + err = unpopulate(val, "TemplateData", &w.TemplateData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateResource. +func (w WorkbookTemplateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateResource. +func (w *WorkbookTemplateResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplateUpdateParameters. +func (w WorkbookTemplateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplateUpdateParameters. +func (w *WorkbookTemplateUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookTemplatesListResult. +func (w WorkbookTemplatesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookTemplatesListResult. +func (w *WorkbookTemplatesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbookUpdateParameters. +func (w WorkbookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", w.Kind) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbookUpdateParameters. +func (w *WorkbookUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &w.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WorkbooksListResult. func (w WorkbooksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) populate(objectMap, "value", w.Value) return json.Marshal(objectMap) } @@ -2568,6 +3931,9 @@ func (w *WorkbooksListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &w.Value) delete(rawMsg, key) diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go index 1fc87a48d719..9a1c7db15209 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -48,25 +47,28 @@ 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. // - options - MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate // method. func (client *MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientCreateOrUpdateOptions) (MyWorkbooksClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) if err != nil { return MyWorkbooksClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MyWorkbooksClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return MyWorkbooksClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MyWorkbooksClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -89,10 +91,16 @@ 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) + if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,21 +115,23 @@ 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. func (client *MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientDeleteOptions) (MyWorkbooksClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return MyWorkbooksClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MyWorkbooksClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusNoContent) { - return MyWorkbooksClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MyWorkbooksClientDeleteResponse{}, err } return MyWorkbooksClientDeleteResponse{}, nil } @@ -146,7 +156,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 @@ -155,23 +165,26 @@ 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. func (client *MyWorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *MyWorkbooksClientGetOptions) (MyWorkbooksClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return MyWorkbooksClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MyWorkbooksClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MyWorkbooksClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MyWorkbooksClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -194,7 +207,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 @@ -211,7 +224,7 @@ func (client *MyWorkbooksClient) getHandleResponse(resp *http.Response) (MyWorkb // NewListByResourceGroupPager - Get all private workbooks defined within a specified resource group and category. // -// 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.NewListByResourceGroupPager @@ -219,10 +232,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 } @@ -258,10 +277,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 @@ -278,17 +300,23 @@ func (client *MyWorkbooksClient) listByResourceGroupHandleResponse(resp *http.Re // NewListBySubscriptionPager - Get all private workbooks defined within a specified subscription and category. // -// 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.NewListBySubscriptionPager // method. func (client *MyWorkbooksClient) NewListBySubscriptionPager(category CategoryType, options *MyWorkbooksClientListBySubscriptionOptions) *runtime.Pager[MyWorkbooksClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[MyWorkbooksClientListBySubscriptionResponse]{ More: func(page MyWorkbooksClientListBySubscriptionResponse) bool { - return false + 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 } @@ -323,7 +351,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 @@ -341,24 +369,27 @@ 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. // - options - MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. func (client *MyWorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook, options *MyWorkbooksClientUpdateOptions) (MyWorkbooksClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) if err != nil { return MyWorkbooksClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MyWorkbooksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MyWorkbooksClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MyWorkbooksClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -381,10 +412,16 @@ 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) + if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go deleted file mode 100644 index 4b73073e4eb5..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/myworkbooks_client_example_test.go +++ /dev/null @@ -1,210 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json -func ExampleMyWorkbooksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMyWorkbooksClient().NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.MyWorkbooksClientListByResourceGroupOptions{Tags: []string{}, - CanFetchContent: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MyWorkbooksListResult = armapplicationinsights.MyWorkbooksListResult{ - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookGet.json -func ExampleMyWorkbooksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/microsoft.insights/myworkbooks/deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("My New Workbook"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookDelete.json -func ExampleMyWorkbooksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMyWorkbooksClient().Delete(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookAdd.json -func ExampleMyWorkbooksClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-8bee-4d3b-a059-9be8dac93960", armapplicationinsights.MyWorkbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - Location: to.Ptr("west us"), - Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), - }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - Properties: &armapplicationinsights.MyWorkbookProperties{ - Category: to.Ptr("workbook"), - DisplayName: to.Ptr("Blah Blah Blah"), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group/providers/microsoft.insights/myworkbooks/deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("Blah Blah Blah"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // Version: to.Ptr("ME"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookUpdate.json -func ExampleMyWorkbooksClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMyWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.MyWorkbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - Location: to.Ptr("west us"), - Tags: map[string]*string{ - "0": to.Ptr("TagSample01"), - "1": to.Ptr("TagSample02"), - }, - Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - Properties: &armapplicationinsights.MyWorkbookProperties{ - Category: to.Ptr("workbook"), - DisplayName: to.Ptr("Blah Blah Blah"), - SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - Version: to.Ptr("ME"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MyWorkbook = armapplicationinsights.MyWorkbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr("microsoft.insights/myworkbooks"), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Kind: to.Ptr(armapplicationinsights.SharedTypeKindUser), - // Properties: &armapplicationinsights.MyWorkbookProperties{ - // Category: to.Ptr("workbook"), - // DisplayName: to.Ptr("Blah Blah Blah"), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens"), - // Version: to.Ptr("ME"), - // }, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go new file mode 100644 index 000000000000..4b9d0393f921 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/operations_client.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapplicationinsights + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all of the available insights REST API operations. +// +// Generated from API version 2021-03-08 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Insights/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-03-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go new file mode 100644 index 000000000000..dbc18df36746 --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/options.go @@ -0,0 +1,483 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapplicationinsights + +// APIKeysClientCreateOptions contains the optional parameters for the APIKeysClient.Create method. +type APIKeysClientCreateOptions struct { + // placeholder for future optional parameters +} + +// APIKeysClientDeleteOptions contains the optional parameters for the APIKeysClient.Delete method. +type APIKeysClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// APIKeysClientGetOptions contains the optional parameters for the APIKeysClient.Get method. +type APIKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// APIKeysClientListOptions contains the optional parameters for the APIKeysClient.NewListPager method. +type APIKeysClientListOptions struct { + // placeholder for future optional parameters +} + +// AnalyticsItemsClientDeleteOptions contains the optional parameters for the AnalyticsItemsClient.Delete method. +type AnalyticsItemsClientDeleteOptions struct { + // The Id of a specific item defined in the Application Insights component + ID *string + + // The name of a specific item defined in the Application Insights component + Name *string +} + +// AnalyticsItemsClientGetOptions contains the optional parameters for the AnalyticsItemsClient.Get method. +type AnalyticsItemsClientGetOptions struct { + // The Id of a specific item defined in the Application Insights component + ID *string + + // The name of a specific item defined in the Application Insights component + Name *string +} + +// AnalyticsItemsClientListOptions contains the optional parameters for the AnalyticsItemsClient.List method. +type AnalyticsItemsClientListOptions struct { + // Flag indicating whether or not to return the content of each applicable item. If false, only return the item information. + IncludeContent *bool + + // Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application + // Insights component. + Scope *ItemScope + + // Enum indicating the type of the Analytics item. + Type *ItemTypeParameter +} + +// AnalyticsItemsClientPutOptions contains the optional parameters for the AnalyticsItemsClient.Put method. +type AnalyticsItemsClientPutOptions struct { + // Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. + OverrideItem *bool +} + +// AnnotationsClientCreateOptions contains the optional parameters for the AnnotationsClient.Create method. +type AnnotationsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AnnotationsClientDeleteOptions contains the optional parameters for the AnnotationsClient.Delete method. +type AnnotationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AnnotationsClientGetOptions contains the optional parameters for the AnnotationsClient.Get method. +type AnnotationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AnnotationsClientListOptions contains the optional parameters for the AnnotationsClient.NewListPager method. +type AnnotationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ComponentAvailableFeaturesClientGetOptions contains the optional parameters for the ComponentAvailableFeaturesClient.Get +// method. +type ComponentAvailableFeaturesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentCurrentBillingFeaturesClientGetOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Get +// method. +type ComponentCurrentBillingFeaturesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentCurrentBillingFeaturesClientUpdateOptions contains the optional parameters for the ComponentCurrentBillingFeaturesClient.Update +// method. +type ComponentCurrentBillingFeaturesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ComponentFeatureCapabilitiesClientGetOptions contains the optional parameters for the ComponentFeatureCapabilitiesClient.Get +// method. +type ComponentFeatureCapabilitiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientCreateAndUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.CreateAndUpdate +// method. +type ComponentLinkedStorageAccountsClientCreateAndUpdateOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientDeleteOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Delete +// method. +type ComponentLinkedStorageAccountsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientGetOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Get +// method. +type ComponentLinkedStorageAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentLinkedStorageAccountsClientUpdateOptions contains the optional parameters for the ComponentLinkedStorageAccountsClient.Update +// method. +type ComponentLinkedStorageAccountsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ComponentQuotaStatusClientGetOptions contains the optional parameters for the ComponentQuotaStatusClient.Get method. +type ComponentQuotaStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientCreateOrUpdateOptions contains the optional parameters for the ComponentsClient.CreateOrUpdate method. +type ComponentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientDeleteOptions contains the optional parameters for the ComponentsClient.Delete method. +type ComponentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientGetOptions contains the optional parameters for the ComponentsClient.Get method. +type ComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientGetPurgeStatusOptions contains the optional parameters for the ComponentsClient.GetPurgeStatus method. +type ComponentsClientGetPurgeStatusOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientListByResourceGroupOptions contains the optional parameters for the ComponentsClient.NewListByResourceGroupPager +// method. +type ComponentsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientListOptions contains the optional parameters for the ComponentsClient.NewListPager method. +type ComponentsClientListOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientPurgeOptions contains the optional parameters for the ComponentsClient.Purge method. +type ComponentsClientPurgeOptions struct { + // placeholder for future optional parameters +} + +// ComponentsClientUpdateTagsOptions contains the optional parameters for the ComponentsClient.UpdateTags method. +type ComponentsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// ExportConfigurationsClientCreateOptions contains the optional parameters for the ExportConfigurationsClient.Create method. +type ExportConfigurationsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ExportConfigurationsClientDeleteOptions contains the optional parameters for the ExportConfigurationsClient.Delete method. +type ExportConfigurationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ExportConfigurationsClientGetOptions contains the optional parameters for the ExportConfigurationsClient.Get method. +type ExportConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExportConfigurationsClientListOptions contains the optional parameters for the ExportConfigurationsClient.List method. +type ExportConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ExportConfigurationsClientUpdateOptions contains the optional parameters for the ExportConfigurationsClient.Update method. +type ExportConfigurationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// FavoritesClientAddOptions contains the optional parameters for the FavoritesClient.Add method. +type FavoritesClientAddOptions struct { + // placeholder for future optional parameters +} + +// FavoritesClientDeleteOptions contains the optional parameters for the FavoritesClient.Delete method. +type FavoritesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// FavoritesClientGetOptions contains the optional parameters for the FavoritesClient.Get method. +type FavoritesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FavoritesClientListOptions contains the optional parameters for the FavoritesClient.List method. +type FavoritesClientListOptions struct { + // Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content + // for favorites. + CanFetchContent *bool + + // The type of favorite. Value can be either shared or user. + FavoriteType *FavoriteType + + // Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum). + SourceType *FavoriteSourceType + + // Tags that must be present on each favorite returned. + Tags []string +} + +// FavoritesClientUpdateOptions contains the optional parameters for the FavoritesClient.Update method. +type FavoritesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// LiveTokenClientGetOptions contains the optional parameters for the LiveTokenClient.Get method. +type LiveTokenClientGetOptions struct { + // placeholder for future optional parameters +} + +// MyWorkbooksClientCreateOrUpdateOptions contains the optional parameters for the MyWorkbooksClient.CreateOrUpdate method. +type MyWorkbooksClientCreateOrUpdateOptions struct { + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string +} + +// MyWorkbooksClientDeleteOptions contains the optional parameters for the MyWorkbooksClient.Delete method. +type MyWorkbooksClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MyWorkbooksClientGetOptions contains the optional parameters for the MyWorkbooksClient.Get method. +type MyWorkbooksClientGetOptions struct { + // placeholder for future optional parameters +} + +// MyWorkbooksClientListByResourceGroupOptions contains the optional parameters for the MyWorkbooksClient.NewListByResourceGroupPager +// method. +type MyWorkbooksClientListByResourceGroupOptions struct { + // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content + // for workbooks. + CanFetchContent *bool + + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string + + // Tags presents on each workbook returned. + Tags []string +} + +// MyWorkbooksClientListBySubscriptionOptions contains the optional parameters for the MyWorkbooksClient.NewListBySubscriptionPager +// method. +type MyWorkbooksClientListBySubscriptionOptions struct { + // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content + // for workbooks. + CanFetchContent *bool + + // Tags presents on each workbook returned. + Tags []string +} + +// MyWorkbooksClientUpdateOptions contains the optional parameters for the MyWorkbooksClient.Update method. +type MyWorkbooksClientUpdateOptions struct { + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProactiveDetectionConfigurationsClientGetOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Get +// method. +type ProactiveDetectionConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProactiveDetectionConfigurationsClientListOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.List +// method. +type ProactiveDetectionConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProactiveDetectionConfigurationsClientUpdateOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Update +// method. +type ProactiveDetectionConfigurationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebTestLocationsClientListOptions contains the optional parameters for the WebTestLocationsClient.NewListPager method. +type WebTestLocationsClientListOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientCreateOrUpdateOptions contains the optional parameters for the WebTestsClient.CreateOrUpdate method. +type WebTestsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientDeleteOptions contains the optional parameters for the WebTestsClient.Delete method. +type WebTestsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientGetOptions contains the optional parameters for the WebTestsClient.Get method. +type WebTestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientListByComponentOptions contains the optional parameters for the WebTestsClient.NewListByComponentPager method. +type WebTestsClientListByComponentOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientListByResourceGroupOptions contains the optional parameters for the WebTestsClient.NewListByResourceGroupPager +// method. +type WebTestsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientListOptions contains the optional parameters for the WebTestsClient.NewListPager method. +type WebTestsClientListOptions struct { + // placeholder for future optional parameters +} + +// WebTestsClientUpdateTagsOptions contains the optional parameters for the WebTestsClient.UpdateTags method. +type WebTestsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientCreateOptions contains the optional parameters for the WorkItemConfigurationsClient.Create +// method. +type WorkItemConfigurationsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientDeleteOptions contains the optional parameters for the WorkItemConfigurationsClient.Delete +// method. +type WorkItemConfigurationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientGetDefaultOptions contains the optional parameters for the WorkItemConfigurationsClient.GetDefault +// method. +type WorkItemConfigurationsClientGetDefaultOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientGetItemOptions contains the optional parameters for the WorkItemConfigurationsClient.GetItem +// method. +type WorkItemConfigurationsClientGetItemOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientListOptions contains the optional parameters for the WorkItemConfigurationsClient.NewListPager +// method. +type WorkItemConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + +// WorkItemConfigurationsClientUpdateItemOptions contains the optional parameters for the WorkItemConfigurationsClient.UpdateItem +// method. +type WorkItemConfigurationsClientUpdateItemOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientCreateOrUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.CreateOrUpdate +// method. +type WorkbookTemplatesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientDeleteOptions contains the optional parameters for the WorkbookTemplatesClient.Delete method. +type WorkbookTemplatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientGetOptions contains the optional parameters for the WorkbookTemplatesClient.Get method. +type WorkbookTemplatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientListByResourceGroupOptions contains the optional parameters for the WorkbookTemplatesClient.NewListByResourceGroupPager +// method. +type WorkbookTemplatesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WorkbookTemplatesClientUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.Update method. +type WorkbookTemplatesClientUpdateOptions struct { + // Properties that need to be specified to patch a workbook template. + WorkbookTemplateUpdateParameters *WorkbookTemplateUpdateParameters +} + +// WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate method. +type WorkbooksClientCreateOrUpdateOptions struct { + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string +} + +// WorkbooksClientDeleteOptions contains the optional parameters for the WorkbooksClient.Delete method. +type WorkbooksClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// WorkbooksClientGetOptions contains the optional parameters for the WorkbooksClient.Get method. +type WorkbooksClientGetOptions 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 +} + +// WorkbooksClientListByResourceGroupOptions contains the optional parameters for the WorkbooksClient.NewListByResourceGroupPager +// 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.NewListBySubscriptionPager +// method. +type WorkbooksClientListBySubscriptionOptions struct { + // Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content + // for workbooks. + CanFetchContent *bool + + // Tags presents on each workbook returned. + Tags []string +} + +// WorkbooksClientRevisionGetOptions contains the optional parameters for the WorkbooksClient.RevisionGet method. +type WorkbooksClientRevisionGetOptions struct { + // placeholder for future optional parameters +} + +// WorkbooksClientRevisionsListOptions contains the optional parameters for the WorkbooksClient.NewRevisionsListPager method. +type WorkbooksClientRevisionsListOptions struct { + // placeholder for future optional parameters +} + +// WorkbooksClientUpdateOptions contains the optional parameters for the WorkbooksClient.Update method. +type WorkbooksClientUpdateOptions struct { + // Azure Resource Id that will fetch all linked workbooks. + SourceID *string + + // Properties that need to be specified to create a new workbook. + WorkbookUpdateParameters *WorkbookUpdateParameters +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client.go index bd3b836cb07d..03ae31f2093a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -54,18 +53,21 @@ func NewProactiveDetectionConfigurationsClient(subscriptionID string, credential // - options - ProactiveDetectionConfigurationsClientGetOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Get // method. func (client *ProactiveDetectionConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, options *ProactiveDetectionConfigurationsClientGetOptions) (ProactiveDetectionConfigurationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, configurationID, options) if err != nil { return ProactiveDetectionConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProactiveDetectionConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProactiveDetectionConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProactiveDetectionConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -116,18 +118,21 @@ func (client *ProactiveDetectionConfigurationsClient) getHandleResponse(resp *ht // - options - ProactiveDetectionConfigurationsClientListOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.List // method. func (client *ProactiveDetectionConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *ProactiveDetectionConfigurationsClientListOptions) (ProactiveDetectionConfigurationsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ProactiveDetectionConfigurationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProactiveDetectionConfigurationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProactiveDetectionConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProactiveDetectionConfigurationsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -176,18 +181,21 @@ func (client *ProactiveDetectionConfigurationsClient) listHandleResponse(resp *h // - options - ProactiveDetectionConfigurationsClientUpdateOptions contains the optional parameters for the ProactiveDetectionConfigurationsClient.Update // method. func (client *ProactiveDetectionConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ComponentProactiveDetectionConfiguration, options *ProactiveDetectionConfigurationsClientUpdateOptions) (ProactiveDetectionConfigurationsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, configurationID, proactiveDetectionProperties, options) if err != nil { return ProactiveDetectionConfigurationsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ProactiveDetectionConfigurationsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProactiveDetectionConfigurationsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProactiveDetectionConfigurationsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -217,7 +225,10 @@ func (client *ProactiveDetectionConfigurationsClient) updateCreateRequest(ctx co reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, proactiveDetectionProperties) + if err := runtime.MarshalAsJSON(req, proactiveDetectionProperties); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go deleted file mode 100644 index 1d7943ba5211..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/proactivedetectionconfigurations_client_example_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationsList.json -func ExampleProactiveDetectionConfigurationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProactiveDetectionConfigurationsClient().List(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentProactiveDetectionConfigurationArray = []*armapplicationinsights.ComponentProactiveDetectionConfiguration{ - // { - // CustomEmails: []*string{ - // to.Ptr("foo@microsoft.com"), - // to.Ptr("foo2@microsoft.com")}, - // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), - // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ - // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), - // DisplayName: to.Ptr("Slow page load time"), - // HelpURL: to.Ptr("https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics"), - // IsEnabledByDefault: to.Ptr(true), - // IsHidden: to.Ptr(false), - // IsInPreview: to.Ptr(false), - // Name: to.Ptr("slowpageloadtime"), - // SupportsEmailNotifications: to.Ptr(true), - // }, - // SendEmailsToSubscriptionOwners: to.Ptr(true), - // }, - // { - // CustomEmails: []*string{ - // }, - // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), - // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ - // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), - // DisplayName: to.Ptr("Slow server response time"), - // HelpURL: to.Ptr("https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics"), - // IsEnabledByDefault: to.Ptr(true), - // IsHidden: to.Ptr(false), - // IsInPreview: to.Ptr(false), - // Name: to.Ptr("slowserverresponsetime"), - // SupportsEmailNotifications: to.Ptr(true), - // }, - // SendEmailsToSubscriptionOwners: to.Ptr(true), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationGet.json -func ExampleProactiveDetectionConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProactiveDetectionConfigurationsClient().Get(ctx, "my-resource-group", "my-component", "slowpageloadtime", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentProactiveDetectionConfiguration = armapplicationinsights.ComponentProactiveDetectionConfiguration{ - // CustomEmails: []*string{ - // to.Ptr("foo@microsoft.com"), - // to.Ptr("foo2@microsoft.com")}, - // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), - // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ - // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), - // DisplayName: to.Ptr("Slow page load time"), - // HelpURL: to.Ptr("https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics"), - // IsEnabledByDefault: to.Ptr(true), - // IsHidden: to.Ptr(false), - // IsInPreview: to.Ptr(false), - // Name: to.Ptr("slowpageloadtime"), - // SupportsEmailNotifications: to.Ptr(true), - // }, - // SendEmailsToSubscriptionOwners: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationUpdate.json -func ExampleProactiveDetectionConfigurationsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProactiveDetectionConfigurationsClient().Update(ctx, "my-resource-group", "my-component", "slowpageloadtime", armapplicationinsights.ComponentProactiveDetectionConfiguration{ - CustomEmails: []*string{ - to.Ptr("foo@microsoft.com"), - to.Ptr("foo2@microsoft.com")}, - Enabled: to.Ptr(true), - Name: to.Ptr("slowpageloadtime"), - RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ - Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), - DisplayName: to.Ptr("Slow page load time"), - HelpURL: to.Ptr("https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics"), - IsEnabledByDefault: to.Ptr(true), - IsHidden: to.Ptr(false), - IsInPreview: to.Ptr(false), - Name: to.Ptr("slowpageloadtime"), - SupportsEmailNotifications: to.Ptr(true), - }, - SendEmailsToSubscriptionOwners: to.Ptr(true), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ComponentProactiveDetectionConfiguration = armapplicationinsights.ComponentProactiveDetectionConfiguration{ - // CustomEmails: []*string{ - // to.Ptr("foo@microsoft.com"), - // to.Ptr("foo2@microsoft.com")}, - // Enabled: to.Ptr(true), - // Name: to.Ptr("slowpageloadtime"), - // RuleDefinitions: &armapplicationinsights.ComponentProactiveDetectionConfigurationRuleDefinitions{ - // Description: to.Ptr("Smart Detection rules notify you of performance anomaly issues."), - // DisplayName: to.Ptr("Slow page load time"), - // HelpURL: to.Ptr("https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics"), - // IsEnabledByDefault: to.Ptr(true), - // IsHidden: to.Ptr(false), - // IsInPreview: to.Ptr(false), - // Name: to.Ptr("slowpageloadtime"), - // SupportsEmailNotifications: to.Ptr(true), - // }, - // SendEmailsToSubscriptionOwners: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go index 432595700a64..3e18df83081a 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/response_types.go @@ -3,29 +3,32 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights // APIKeysClientCreateResponse contains the response from method APIKeysClient.Create. type APIKeysClientCreateResponse struct { + // Properties that define an API key of an Application Insights Component. ComponentAPIKey } // APIKeysClientDeleteResponse contains the response from method APIKeysClient.Delete. type APIKeysClientDeleteResponse struct { + // Properties that define an API key of an Application Insights Component. ComponentAPIKey } // APIKeysClientGetResponse contains the response from method APIKeysClient.Get. type APIKeysClientGetResponse struct { + // Properties that define an API key of an Application Insights Component. ComponentAPIKey } // APIKeysClientListResponse contains the response from method APIKeysClient.NewListPager. type APIKeysClientListResponse struct { + // Describes the list of API Keys of an Application Insights Component. ComponentAPIKeyListResult } @@ -36,6 +39,7 @@ type AnalyticsItemsClientDeleteResponse struct { // AnalyticsItemsClientGetResponse contains the response from method AnalyticsItemsClient.Get. type AnalyticsItemsClientGetResponse struct { + // Properties that define an Analytics item that is associated to an Application Insights component. ComponentAnalyticsItem } @@ -47,6 +51,7 @@ type AnalyticsItemsClientListResponse struct { // AnalyticsItemsClientPutResponse contains the response from method AnalyticsItemsClient.Put. type AnalyticsItemsClientPutResponse struct { + // Properties that define an Analytics item that is associated to an Application Insights component. ComponentAnalyticsItem } @@ -69,36 +74,66 @@ type AnnotationsClientGetResponse struct { // AnnotationsClientListResponse contains the response from method AnnotationsClient.NewListPager. type AnnotationsClientListResponse struct { + // Annotations list result. AnnotationsListResult } // ComponentAvailableFeaturesClientGetResponse contains the response from method ComponentAvailableFeaturesClient.Get. type ComponentAvailableFeaturesClientGetResponse struct { + // An Application Insights component available features. ComponentAvailableFeatures } // ComponentCurrentBillingFeaturesClientGetResponse contains the response from method ComponentCurrentBillingFeaturesClient.Get. type ComponentCurrentBillingFeaturesClientGetResponse struct { + // An Application Insights component billing features ComponentBillingFeatures } // ComponentCurrentBillingFeaturesClientUpdateResponse contains the response from method ComponentCurrentBillingFeaturesClient.Update. type ComponentCurrentBillingFeaturesClientUpdateResponse struct { + // An Application Insights component billing features ComponentBillingFeatures } // ComponentFeatureCapabilitiesClientGetResponse contains the response from method ComponentFeatureCapabilitiesClient.Get. type ComponentFeatureCapabilitiesClientGetResponse struct { + // An Application Insights component feature capabilities ComponentFeatureCapabilities } +// ComponentLinkedStorageAccountsClientCreateAndUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.CreateAndUpdate. +type ComponentLinkedStorageAccountsClientCreateAndUpdateResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + +// ComponentLinkedStorageAccountsClientDeleteResponse contains the response from method ComponentLinkedStorageAccountsClient.Delete. +type ComponentLinkedStorageAccountsClientDeleteResponse struct { + // placeholder for future response values +} + +// ComponentLinkedStorageAccountsClientGetResponse contains the response from method ComponentLinkedStorageAccountsClient.Get. +type ComponentLinkedStorageAccountsClientGetResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + +// ComponentLinkedStorageAccountsClientUpdateResponse contains the response from method ComponentLinkedStorageAccountsClient.Update. +type ComponentLinkedStorageAccountsClientUpdateResponse struct { + // An Application Insights component linked storage accounts + ComponentLinkedStorageAccounts +} + // ComponentQuotaStatusClientGetResponse contains the response from method ComponentQuotaStatusClient.Get. type ComponentQuotaStatusClientGetResponse struct { + // An Application Insights component daily data volume cap status ComponentQuotaStatus } // ComponentsClientCreateOrUpdateResponse contains the response from method ComponentsClient.CreateOrUpdate. type ComponentsClientCreateOrUpdateResponse struct { + // An Application Insights component definition. Component } @@ -109,31 +144,37 @@ type ComponentsClientDeleteResponse struct { // ComponentsClientGetPurgeStatusResponse contains the response from method ComponentsClient.GetPurgeStatus. type ComponentsClientGetPurgeStatusResponse struct { + // Response containing status for a specific purge operation. ComponentPurgeStatusResponse } // ComponentsClientGetResponse contains the response from method ComponentsClient.Get. type ComponentsClientGetResponse struct { + // An Application Insights component definition. Component } // ComponentsClientListByResourceGroupResponse contains the response from method ComponentsClient.NewListByResourceGroupPager. type ComponentsClientListByResourceGroupResponse struct { + // Describes the list of Application Insights Resources. ComponentListResult } // ComponentsClientListResponse contains the response from method ComponentsClient.NewListPager. type ComponentsClientListResponse struct { + // Describes the list of Application Insights Resources. ComponentListResult } // ComponentsClientPurgeResponse contains the response from method ComponentsClient.Purge. type ComponentsClientPurgeResponse struct { + // Response containing operationId for a specific purge action. ComponentPurgeResponse } // ComponentsClientUpdateTagsResponse contains the response from method ComponentsClient.UpdateTags. type ComponentsClientUpdateTagsResponse struct { + // An Application Insights component definition. Component } @@ -145,11 +186,13 @@ type ExportConfigurationsClientCreateResponse struct { // ExportConfigurationsClientDeleteResponse contains the response from method ExportConfigurationsClient.Delete. type ExportConfigurationsClientDeleteResponse struct { + // Properties that define a Continuous Export configuration. ComponentExportConfiguration } // ExportConfigurationsClientGetResponse contains the response from method ExportConfigurationsClient.Get. type ExportConfigurationsClientGetResponse struct { + // Properties that define a Continuous Export configuration. ComponentExportConfiguration } @@ -161,11 +204,13 @@ type ExportConfigurationsClientListResponse struct { // ExportConfigurationsClientUpdateResponse contains the response from method ExportConfigurationsClient.Update. type ExportConfigurationsClientUpdateResponse struct { + // Properties that define a Continuous Export configuration. ComponentExportConfiguration } // FavoritesClientAddResponse contains the response from method FavoritesClient.Add. type FavoritesClientAddResponse struct { + // Properties that define a favorite that is associated to an Application Insights component. ComponentFavorite } @@ -176,6 +221,7 @@ type FavoritesClientDeleteResponse struct { // FavoritesClientGetResponse contains the response from method FavoritesClient.Get. type FavoritesClientGetResponse struct { + // Properties that define a favorite that is associated to an Application Insights component. ComponentFavorite } @@ -187,11 +233,19 @@ type FavoritesClientListResponse struct { // FavoritesClientUpdateResponse contains the response from method FavoritesClient.Update. type FavoritesClientUpdateResponse struct { + // Properties that define a favorite that is associated to an Application Insights component. ComponentFavorite } +// LiveTokenClientGetResponse contains the response from method LiveTokenClient.Get. +type LiveTokenClientGetResponse struct { + // The response to a live token query. + LiveTokenResponse +} + // MyWorkbooksClientCreateOrUpdateResponse contains the response from method MyWorkbooksClient.CreateOrUpdate. type MyWorkbooksClientCreateOrUpdateResponse struct { + // An Application Insights private workbook definition. MyWorkbook } @@ -202,26 +256,38 @@ type MyWorkbooksClientDeleteResponse struct { // MyWorkbooksClientGetResponse contains the response from method MyWorkbooksClient.Get. type MyWorkbooksClientGetResponse struct { + // An Application Insights private workbook definition. MyWorkbook } // MyWorkbooksClientListByResourceGroupResponse contains the response from method MyWorkbooksClient.NewListByResourceGroupPager. type MyWorkbooksClientListByResourceGroupResponse struct { + // Workbook list result. MyWorkbooksListResult } // MyWorkbooksClientListBySubscriptionResponse contains the response from method MyWorkbooksClient.NewListBySubscriptionPager. type MyWorkbooksClientListBySubscriptionResponse struct { + // Workbook list result. MyWorkbooksListResult } // MyWorkbooksClientUpdateResponse contains the response from method MyWorkbooksClient.Update. type MyWorkbooksClientUpdateResponse struct { + // An Application Insights private workbook definition. MyWorkbook } +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // Result of the request to list Azure Workbooks operations. It contains a list of operations and a URL link to get the next + // set of results. + OperationListResult +} + // ProactiveDetectionConfigurationsClientGetResponse contains the response from method ProactiveDetectionConfigurationsClient.Get. type ProactiveDetectionConfigurationsClientGetResponse struct { + // Properties that define a ProactiveDetection configuration. ComponentProactiveDetectionConfiguration } @@ -233,16 +299,19 @@ type ProactiveDetectionConfigurationsClientListResponse struct { // ProactiveDetectionConfigurationsClientUpdateResponse contains the response from method ProactiveDetectionConfigurationsClient.Update. type ProactiveDetectionConfigurationsClientUpdateResponse struct { + // Properties that define a ProactiveDetection configuration. ComponentProactiveDetectionConfiguration } // WebTestLocationsClientListResponse contains the response from method WebTestLocationsClient.NewListPager. type WebTestLocationsClientListResponse struct { + // Describes the list of web test locations available to an Application Insights Component. WebTestLocationsListResult } // WebTestsClientCreateOrUpdateResponse contains the response from method WebTestsClient.CreateOrUpdate. type WebTestsClientCreateOrUpdateResponse struct { + // An Application Insights WebTest definition. WebTest } @@ -253,31 +322,37 @@ type WebTestsClientDeleteResponse struct { // WebTestsClientGetResponse contains the response from method WebTestsClient.Get. type WebTestsClientGetResponse struct { + // An Application Insights WebTest definition. WebTest } // WebTestsClientListByComponentResponse contains the response from method WebTestsClient.NewListByComponentPager. type WebTestsClientListByComponentResponse struct { + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientListByResourceGroupResponse contains the response from method WebTestsClient.NewListByResourceGroupPager. type WebTestsClientListByResourceGroupResponse struct { + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientListResponse contains the response from method WebTestsClient.NewListPager. type WebTestsClientListResponse struct { + // A list of 0 or more Application Insights WebTest definitions. WebTestListResult } // WebTestsClientUpdateTagsResponse contains the response from method WebTestsClient.UpdateTags. type WebTestsClientUpdateTagsResponse struct { + // An Application Insights WebTest definition. WebTest } // WorkItemConfigurationsClientCreateResponse contains the response from method WorkItemConfigurationsClient.Create. type WorkItemConfigurationsClientCreateResponse struct { + // Work item configuration associated with an application insights resource. WorkItemConfiguration } @@ -288,26 +363,60 @@ type WorkItemConfigurationsClientDeleteResponse struct { // WorkItemConfigurationsClientGetDefaultResponse contains the response from method WorkItemConfigurationsClient.GetDefault. type WorkItemConfigurationsClientGetDefaultResponse struct { + // Work item configuration associated with an application insights resource. WorkItemConfiguration } // WorkItemConfigurationsClientGetItemResponse contains the response from method WorkItemConfigurationsClient.GetItem. type WorkItemConfigurationsClientGetItemResponse struct { + // Work item configuration associated with an application insights resource. WorkItemConfiguration } // WorkItemConfigurationsClientListResponse contains the response from method WorkItemConfigurationsClient.NewListPager. type WorkItemConfigurationsClientListResponse struct { + // Work item configuration list result. WorkItemConfigurationsListResult } // WorkItemConfigurationsClientUpdateItemResponse contains the response from method WorkItemConfigurationsClient.UpdateItem. type WorkItemConfigurationsClientUpdateItemResponse struct { + // Work item configuration associated with an application insights resource. WorkItemConfiguration } +// WorkbookTemplatesClientCreateOrUpdateResponse contains the response from method WorkbookTemplatesClient.CreateOrUpdate. +type WorkbookTemplatesClientCreateOrUpdateResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + +// WorkbookTemplatesClientDeleteResponse contains the response from method WorkbookTemplatesClient.Delete. +type WorkbookTemplatesClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkbookTemplatesClientGetResponse contains the response from method WorkbookTemplatesClient.Get. +type WorkbookTemplatesClientGetResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + +// WorkbookTemplatesClientListByResourceGroupResponse contains the response from method WorkbookTemplatesClient.NewListByResourceGroupPager. +type WorkbookTemplatesClientListByResourceGroupResponse struct { + // WorkbookTemplate list result. + WorkbookTemplatesListResult +} + +// WorkbookTemplatesClientUpdateResponse contains the response from method WorkbookTemplatesClient.Update. +type WorkbookTemplatesClientUpdateResponse struct { + // An Application Insights workbook template definition. + WorkbookTemplate +} + // WorkbooksClientCreateOrUpdateResponse contains the response from method WorkbooksClient.CreateOrUpdate. type WorkbooksClientCreateOrUpdateResponse struct { + // A workbook definition. Workbook } @@ -318,15 +427,36 @@ type WorkbooksClientDeleteResponse struct { // WorkbooksClientGetResponse contains the response from method WorkbooksClient.Get. type WorkbooksClientGetResponse struct { + // A workbook definition. Workbook } // WorkbooksClientListByResourceGroupResponse contains the response from method WorkbooksClient.NewListByResourceGroupPager. type WorkbooksClientListByResourceGroupResponse struct { + // Workbook list result. + WorkbooksListResult +} + +// WorkbooksClientListBySubscriptionResponse contains the response from method WorkbooksClient.NewListBySubscriptionPager. +type WorkbooksClientListBySubscriptionResponse struct { + // Workbook list result. + WorkbooksListResult +} + +// WorkbooksClientRevisionGetResponse contains the response from method WorkbooksClient.RevisionGet. +type WorkbooksClientRevisionGetResponse struct { + // A workbook definition. + Workbook +} + +// WorkbooksClientRevisionsListResponse contains the response from method WorkbooksClient.NewRevisionsListPager. +type WorkbooksClientRevisionsListResponse struct { + // Workbook list result. WorkbooksListResult } // WorkbooksClientUpdateResponse contains the response from method WorkbooksClient.Update. type WorkbooksClientUpdateResponse struct { + // A workbook definition. Workbook } diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go index 0cb2617809fc..447072764c46 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client.go index 15b236e06122..d30fcc1d9d94 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go deleted file mode 100644 index 2c684fda1fe1..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtestlocations_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestLocationsList.json -func ExampleWebTestLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebTestLocationsClient().NewListPager("my-resource-group", "my-component", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebTestLocationsListResult = armapplicationinsights.WebTestLocationsListResult{ - // } - } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go index d26d5a30ae5c..b86adec56590 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -47,24 +46,27 @@ func NewWebTestsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates an Application Insights web test definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - webTestDefinition - Properties that need to be specified to create or update an Application Insights web test definition. // - options - WebTestsClientCreateOrUpdateOptions contains the optional parameters for the WebTestsClient.CreateOrUpdate method. func (client *WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest, options *WebTestsClientCreateOrUpdateOptions) (WebTestsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, webTestName, webTestDefinition, options) if err != nil { return WebTestsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WebTestsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WebTestsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebTestsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -87,10 +89,13 @@ func (client *WebTestsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, webTestDefinition) + if err := runtime.MarshalAsJSON(req, webTestDefinition); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -105,21 +110,23 @@ func (client *WebTestsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes an Application Insights web test. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - options - WebTestsClientDeleteOptions contains the optional parameters for the WebTestsClient.Delete method. func (client *WebTestsClient) Delete(ctx context.Context, resourceGroupName string, webTestName string, options *WebTestsClientDeleteOptions) (WebTestsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, webTestName, options) if err != nil { return WebTestsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WebTestsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return WebTestsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return WebTestsClientDeleteResponse{}, err } return WebTestsClientDeleteResponse{}, nil } @@ -144,7 +151,7 @@ func (client *WebTestsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -152,23 +159,26 @@ func (client *WebTestsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a specific Application Insights web test definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. +// - webTestName - The name of the Application Insights WebTest resource. // - options - WebTestsClientGetOptions contains the optional parameters for the WebTestsClient.Get method. func (client *WebTestsClient) Get(ctx context.Context, resourceGroupName string, webTestName string, options *WebTestsClientGetOptions) (WebTestsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, webTestName, options) if err != nil { return WebTestsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WebTestsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WebTestsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebTestsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -191,7 +201,7 @@ func (client *WebTestsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -206,9 +216,9 @@ func (client *WebTestsClient) getHandleResponse(resp *http.Response) (WebTestsCl return result, nil } -// NewListPager - Get all Application Insights web test alerts definitions within a subscription. +// NewListPager - Get all Application Insights web test definitions for the specified subscription. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - options - WebTestsClientListOptions contains the optional parameters for the WebTestsClient.NewListPager method. func (client *WebTestsClient) NewListPager(options *WebTestsClientListOptions) *runtime.Pager[WebTestsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[WebTestsClientListResponse]{ @@ -250,7 +260,7 @@ func (client *WebTestsClient) listCreateRequest(ctx context.Context, options *We return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +277,7 @@ func (client *WebTestsClient) listHandleResponse(resp *http.Response) (WebTestsC // NewListByComponentPager - Get all Application Insights web tests defined for the specified component. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - componentName - The name of the Application Insights component resource. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - WebTestsClientListByComponentOptions contains the optional parameters for the WebTestsClient.NewListByComponentPager @@ -320,7 +330,7 @@ func (client *WebTestsClient) listByComponentCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,9 +345,9 @@ func (client *WebTestsClient) listByComponentHandleResponse(resp *http.Response) return result, nil } -// NewListByResourceGroupPager - Get all Application Insights web tests defined within a specified resource group. +// NewListByResourceGroupPager - Get all Application Insights web tests defined for the specified resource group. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - WebTestsClientListByResourceGroupOptions contains the optional parameters for the WebTestsClient.NewListByResourceGroupPager // method. @@ -385,7 +395,7 @@ func (client *WebTestsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -400,27 +410,30 @@ func (client *WebTestsClient) listByResourceGroupHandleResponse(resp *http.Respo return result, nil } -// UpdateTags - Creates or updates an Application Insights web test definition. +// UpdateTags - Updates the tags associated with an Application Insights web test. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - webTestName - The name of the Application Insights webtest resource. -// - webTestTags - Updated tag information to set into the web test instance. +// - webTestName - The name of the Application Insights WebTest resource. +// - webTestTags - Updated tag information to associate with the web test resource. // - options - WebTestsClientUpdateTagsOptions contains the optional parameters for the WebTestsClient.UpdateTags method. func (client *WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource, options *WebTestsClientUpdateTagsOptions) (WebTestsClientUpdateTagsResponse, error) { + var err error req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, webTestName, webTestTags, options) if err != nil { return WebTestsClientUpdateTagsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WebTestsClientUpdateTagsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WebTestsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WebTestsClientUpdateTagsResponse{}, err } - return client.updateTagsHandleResponse(resp) + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err } // updateTagsCreateRequest creates the UpdateTags request. @@ -443,10 +456,13 @@ func (client *WebTestsClient) updateTagsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, webTestTags) + if err := runtime.MarshalAsJSON(req, webTestTags); err != nil { + return nil, err + } + return req, nil } // updateTagsHandleResponse handles the UpdateTags response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go deleted file mode 100644 index f1cb6c714595..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/webtests_client_example_test.go +++ /dev/null @@ -1,517 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByResourceGroup.json -func ExampleWebTestsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebTestsClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebTestListResult = armapplicationinsights.WebTestListResult{ - // Value: []*armapplicationinsights.WebTest{ - // { - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("apac-hk-hkn-azr"), - // }}, - // WebTestName: to.Ptr("my-webtest"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](120), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("my-webtest-my-other-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-other-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "Test": to.Ptr("You can delete this synthetic monitor anytime"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-other-component": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](300), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("us-fl-mia-edge"), - // }}, - // WebTestName: to.Ptr("342bccf4-722f-496d-b064-123456789abc"), - // RetryEnabled: to.Ptr(false), - // SyntheticMonitorID: to.Ptr("my-webtest-my-other-component"), - // Timeout: to.Ptr[int32](90), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestGet.json -func ExampleWebTestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebTestsClient().Get(ctx, "my-resource-group", "my-webtest-01-mywebservice", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebTest = armapplicationinsights.WebTest{ - // Name: to.Ptr("my-webtest-01-mywebservice"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-test-resources/providers/Microsoft.Insights/webtests/my-webtest-01-mywebservice"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-test-resources/providers/Microsoft.Insights/components/mytester": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-test-resources/providers/Microsoft.Web/sites/mytester": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("us-fl-mia-edge"), - // }, - // { - // Location: to.Ptr("apac-hk-hkn-azr"), - // }}, - // WebTestName: to.Ptr("mytest-webtest-01"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-01-mywebservice"), - // Timeout: to.Ptr[int32](30), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestCreate.json -func ExampleWebTestsClient_CreateOrUpdate_webTestCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebTestsClient().CreateOrUpdate(ctx, "my-resource-group", "my-webtest-my-component", armapplicationinsights.WebTest{ - Location: to.Ptr("South Central US"), - Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - Properties: &armapplicationinsights.WebTestProperties{ - Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - WebTest: to.Ptr(""), - }, - Description: to.Ptr("Ping web test alert for mytestwebapp"), - Enabled: to.Ptr(true), - Frequency: to.Ptr[int32](900), - WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - Locations: []*armapplicationinsights.WebTestGeolocation{ - { - Location: to.Ptr("us-fl-mia-edge"), - }}, - WebTestName: to.Ptr("my-webtest-my-component"), - RetryEnabled: to.Ptr(true), - SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - Timeout: to.Ptr[int32](120), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebTest = armapplicationinsights.WebTest{ - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr("Ping web test alert for mytestwebapp"), - // Enabled: to.Ptr(true), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("us-fl-mia-edge"), - // }}, - // WebTestName: to.Ptr("my-webtest-my-component"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](120), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdate.json -func ExampleWebTestsClient_CreateOrUpdate_webTestUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebTestsClient().CreateOrUpdate(ctx, "my-resource-group", "my-webtest-my-component", armapplicationinsights.WebTest{ - Location: to.Ptr("South Central US"), - Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - Properties: &armapplicationinsights.WebTestProperties{ - Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - WebTest: to.Ptr(""), - }, - Frequency: to.Ptr[int32](600), - WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - Locations: []*armapplicationinsights.WebTestGeolocation{ - { - Location: to.Ptr("us-fl-mia-edge"), - }, - { - Location: to.Ptr("apac-hk-hkn-azr"), - }}, - WebTestName: to.Ptr("my-webtest-my-component"), - SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - Timeout: to.Ptr[int32](30), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebTest = armapplicationinsights.WebTest{ - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr("Ping web test alert for mytestwebapp"), - // Enabled: to.Ptr(true), - // Frequency: to.Ptr[int32](600), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("us-fl-mia-edge"), - // }, - // { - // Location: to.Ptr("apac-hk-hkn-azr"), - // }}, - // WebTestName: to.Ptr("my-webtest-my-component"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](30), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdateTagsOnly.json -func ExampleWebTestsClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebTestsClient().UpdateTags(ctx, "my-resource-group", "my-webtest-my-component", armapplicationinsights.TagsResource{ - Tags: map[string]*string{ - "Color": to.Ptr("AzureBlue"), - "CustomField-01": to.Ptr("This is a random value"), - "SystemType": to.Ptr("A08"), - "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WebTest = armapplicationinsights.WebTest{ - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "Color": to.Ptr("AzureBlue"), - // "CustomField-01": to.Ptr("This is a random value"), - // "SystemType": to.Ptr("A08"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr("Ping web test alert for mytestwebapp"), - // Enabled: to.Ptr(true), - // Frequency: to.Ptr[int32](600), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("us-fl-mia-edge"), - // }, - // { - // Location: to.Ptr("apac-hk-hkn-azr"), - // }}, - // WebTestName: to.Ptr("my-webtest-my-component"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](30), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestDelete.json -func ExampleWebTestsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWebTestsClient().Delete(ctx, "my-resource-group", "my-webtest-01-mywebservice", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestList.json -func ExampleWebTestsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebTestsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebTestListResult = armapplicationinsights.WebTestListResult{ - // Value: []*armapplicationinsights.WebTest{ - // { - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // }, - // WebTestName: to.Ptr("my-webtest"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](120), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("my-webtest-my-other-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-other-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-other-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "Test": to.Ptr("You can delete this synthetic monitor anytime"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-other-resource-group/providers/Microsoft.Insights/components/my-other-component": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // }, - // WebTestName: to.Ptr("342bccf4-722f-496d-b064-123456789abc"), - // RetryEnabled: to.Ptr(false), - // SyntheticMonitorID: to.Ptr("my-webtest-my-other-component"), - // Timeout: to.Ptr[int32](120), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByComponent.json -func ExampleWebTestsClient_NewListByComponentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebTestsClient().NewListByComponentPager("my-component", "my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WebTestListResult = armapplicationinsights.WebTestListResult{ - // Value: []*armapplicationinsights.WebTest{ - // { - // Name: to.Ptr("my-webtest-my-component"), - // Type: to.Ptr("Microsoft.Insights/webtests"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/webtests/my-webtest-my-component"), - // Location: to.Ptr("southcentralus"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Insights/components/my-component": to.Ptr("Resource"), - // "hidden-link:/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.Web/sites/mytestwebapp": to.Ptr("Resource"), - // }, - // Kind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Properties: &armapplicationinsights.WebTestProperties{ - // Configuration: &armapplicationinsights.WebTestPropertiesConfiguration{ - // WebTest: to.Ptr(""), - // }, - // Description: to.Ptr(""), - // Enabled: to.Ptr(false), - // Frequency: to.Ptr[int32](900), - // WebTestKind: to.Ptr(armapplicationinsights.WebTestKindPing), - // Locations: []*armapplicationinsights.WebTestGeolocation{ - // { - // Location: to.Ptr("apac-hk-hkn-azr"), - // }}, - // WebTestName: to.Ptr("my-webtest"), - // RetryEnabled: to.Ptr(true), - // SyntheticMonitorID: to.Ptr("my-webtest-my-component"), - // Timeout: to.Ptr[int32](120), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go index b46ea0055de2..661133103d95 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -48,30 +47,33 @@ func NewWorkbooksClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Create a new workbook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - workbookProperties - Properties that need to be specified to create a new workbook. // - options - WorkbooksClientCreateOrUpdateOptions contains the optional parameters for the WorkbooksClient.CreateOrUpdate // method. func (client *WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientCreateOrUpdateOptions) (WorkbooksClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) if err != nil { return WorkbooksClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkbooksClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return WorkbooksClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // 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") } @@ -89,10 +91,16 @@ 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", "2023-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, workbookProperties) + if err := runtime.MarshalAsJSON(req, workbookProperties); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,28 +115,30 @@ func (client *WorkbooksClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete a workbook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientDeleteOptions contains the optional parameters for the WorkbooksClient.Delete method. func (client *WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientDeleteOptions) (WorkbooksClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkbooksClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkbooksClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusNoContent) { - return WorkbooksClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientDeleteResponse{}, err } return WorkbooksClientDeleteResponse{}, nil } // 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") } @@ -146,7 +156,7 @@ func (client *WorkbooksClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -155,28 +165,31 @@ func (client *WorkbooksClient) deleteCreateRequest(ctx context.Context, resource // Get - Get a single workbook by its resourceName. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientGetOptions contains the optional parameters for the WorkbooksClient.Get method. func (client *WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientGetOptions) (WorkbooksClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkbooksClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkbooksClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkbooksClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // 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") } @@ -194,7 +207,10 @@ func (client *WorkbooksClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-05-01") + reqQP.Set("api-version", "2023-06-01") + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +227,7 @@ func (client *WorkbooksClient) getHandleResponse(resp *http.Response) (Workbooks // NewListByResourceGroupPager - Get all Workbooks defined within a specified resource group and category. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - category - Category of workbook to return. // - options - WorkbooksClientListByResourceGroupOptions contains the optional parameters for the WorkbooksClient.NewListByResourceGroupPager @@ -219,10 +235,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 } @@ -240,7 +262,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") } @@ -258,10 +280,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", "2023-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -276,32 +301,237 @@ func (client *WorkbooksClient) listByResourceGroupHandleResponse(resp *http.Resp return result, nil } +// NewListBySubscriptionPager - Get all Workbooks defined within a specified subscription and category. +// +// Generated from API version 2023-06-01 +// - category - Category of workbook to return. +// - options - WorkbooksClientListBySubscriptionOptions contains the optional parameters for the WorkbooksClient.NewListBySubscriptionPager +// method. +func (client *WorkbooksClient) NewListBySubscriptionPager(category CategoryType, options *WorkbooksClientListBySubscriptionOptions) *runtime.Pager[WorkbooksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbooksClientListBySubscriptionResponse]{ + More: func(page WorkbooksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkbooksClientListBySubscriptionResponse) (WorkbooksClientListBySubscriptionResponse, error) { + 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("category", string(category)) + if options != nil && options.Tags != nil { + reqQP.Set("tags", strings.Join(options.Tags, ",")) + } + if options != nil && options.CanFetchContent != nil { + reqQP.Set("canFetchContent", strconv.FormatBool(*options.CanFetchContent)) + } + reqQP.Set("api-version", "2023-06-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 2023-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the workbook resource. The value must be an UUID. +// - revisionID - The id of the workbook's revision. +// - options - WorkbooksClientRevisionGetOptions contains the optional parameters for the WorkbooksClient.RevisionGet method. +func (client *WorkbooksClient) RevisionGet(ctx context.Context, resourceGroupName string, resourceName string, revisionID string, options *WorkbooksClientRevisionGetOptions) (WorkbooksClientRevisionGetResponse, error) { + var err error + req, err := client.revisionGetCreateRequest(ctx, resourceGroupName, resourceName, revisionID, options) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientRevisionGetResponse{}, err + } + resp, err := client.revisionGetHandleResponse(httpResp) + return resp, err +} + +// revisionGetCreateRequest creates the RevisionGet request. +func (client *WorkbooksClient) revisionGetCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, revisionID string, options *WorkbooksClientRevisionGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if revisionID == "" { + return nil, errors.New("parameter revisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{revisionId}", url.PathEscape(revisionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// revisionGetHandleResponse handles the RevisionGet response. +func (client *WorkbooksClient) revisionGetHandleResponse(resp *http.Response) (WorkbooksClientRevisionGetResponse, error) { + result := WorkbooksClientRevisionGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Workbook); err != nil { + return WorkbooksClientRevisionGetResponse{}, err + } + return result, nil +} + +// NewRevisionsListPager - Get the revisions for the workbook defined by its resourceName. +// +// Generated from API version 2023-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the workbook resource. The value must be an UUID. +// - options - WorkbooksClientRevisionsListOptions contains the optional parameters for the WorkbooksClient.NewRevisionsListPager +// method. +func (client *WorkbooksClient) NewRevisionsListPager(resourceGroupName string, resourceName string, options *WorkbooksClientRevisionsListOptions) *runtime.Pager[WorkbooksClientRevisionsListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbooksClientRevisionsListResponse]{ + More: func(page WorkbooksClientRevisionsListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkbooksClientRevisionsListResponse) (WorkbooksClientRevisionsListResponse, error) { + 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.internal.Pipeline().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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// revisionsListHandleResponse handles the RevisionsList response. +func (client *WorkbooksClient) revisionsListHandleResponse(resp *http.Response) (WorkbooksClientRevisionsListResponse, error) { + result := WorkbooksClientRevisionsListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbooksListResult); err != nil { + return WorkbooksClientRevisionsListResponse{}, err + } + return result, nil +} + // Update - Updates a workbook that has already been added. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2015-05-01 +// Generated from API version 2023-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - The name of the Application Insights component resource. -// - workbookProperties - Properties that need to be specified to create a new workbook. +// - resourceName - The name of the workbook resource. The value must be an UUID. // - options - WorkbooksClientUpdateOptions contains the optional parameters for the WorkbooksClient.Update method. -func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook, options *WorkbooksClientUpdateOptions) (WorkbooksClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, workbookProperties, options) +func (client *WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbooksClientUpdateOptions) (WorkbooksClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkbooksClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkbooksClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkbooksClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WorkbooksClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // 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") } @@ -319,10 +549,19 @@ 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", "2023-06-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 { + if err := runtime.MarshalAsJSON(req, *options.WorkbookUpdateParameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go deleted file mode 100644 index 3aa0f450ae01..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooks_client_example_test.go +++ /dev/null @@ -1,215 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbooksList.json -func ExampleWorkbooksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkbooksClient().NewListByResourceGroupPager("my-resource-group", armapplicationinsights.CategoryTypeWorkbook, &armapplicationinsights.WorkbooksClientListByResourceGroupOptions{Tags: []string{}, - CanFetchContent: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkbooksListResult = armapplicationinsights.WorkbooksListResult{ - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookGet.json -func ExampleWorkbooksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkbooksClient().Get(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "0": to.Ptr("TagSample01"), - // "1": to.Ptr("TagSample02"), - // }, - // Properties: &armapplicationinsights.WorkbookProperties{ - // Name: to.Ptr("My New Workbook"), - // Category: to.Ptr("workbook"), - // SharedTypeKind: to.Ptr(armapplicationinsights.SharedTypeKindShared), - // SerializedData: to.Ptr("{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"), - // UserID: to.Ptr("userId"), - // Version: to.Ptr("ME"), - // WorkbookID: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookDelete.json -func ExampleWorkbooksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkbooksClient().Delete(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/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() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkbooksClient().CreateOrUpdate(ctx, "my-resource-group", "deadb33f-8bee-4d3b-a059-9be8dac93960", armapplicationinsights.Workbook{ - Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - Location: to.Ptr("west us"), - 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}"), - 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"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // Location: to.Ptr("westus"), - // 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"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookUpdate.json -func ExampleWorkbooksClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkbooksClient().Update(ctx, "my-resource-group", "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", armapplicationinsights.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"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Workbook = armapplicationinsights.Workbook{ - // Name: to.Ptr("deadb33f-8bee-4d3b-a059-9be8dac93960"), - // Type: to.Ptr(""), - // ID: to.Ptr("c0deea5e-3344-40f2-96f8-6f8e1c3b5722"), - // Location: to.Ptr("westus"), - // 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"), - // }, - // } -} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go new file mode 100644 index 000000000000..91128193506c --- /dev/null +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workbooktemplates_client.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armapplicationinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkbookTemplatesClient contains the methods for the WorkbookTemplates group. +// Don't use this type directly, use NewWorkbookTemplatesClient() instead. +type WorkbookTemplatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkbookTemplatesClient creates a new instance of WorkbookTemplatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewWorkbookTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkbookTemplatesClient, error) { + cl, err := arm.NewClient(moduleName+".WorkbookTemplatesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkbookTemplatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a new workbook template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - workbookTemplateProperties - Properties that need to be specified to create a new workbook. +// - options - WorkbookTemplatesClientCreateOrUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.CreateOrUpdate +// method. +func (client *WorkbookTemplatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate, options *WorkbookTemplatesClientCreateOrUpdateOptions) (WorkbookTemplatesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, workbookTemplateProperties, options) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *WorkbookTemplatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, workbookTemplateProperties WorkbookTemplate, options *WorkbookTemplatesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, workbookTemplateProperties); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *WorkbookTemplatesClient) createOrUpdateHandleResponse(resp *http.Response) (WorkbookTemplatesClientCreateOrUpdateResponse, error) { + result := WorkbookTemplatesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a workbook template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientDeleteOptions contains the optional parameters for the WorkbookTemplatesClient.Delete +// method. +func (client *WorkbookTemplatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientDeleteOptions) (WorkbookTemplatesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientDeleteResponse{}, err + } + return WorkbookTemplatesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *WorkbookTemplatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a single workbook template by its resourceName. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientGetOptions contains the optional parameters for the WorkbookTemplatesClient.Get method. +func (client *WorkbookTemplatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientGetOptions) (WorkbookTemplatesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WorkbookTemplatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkbookTemplatesClient) getHandleResponse(resp *http.Response) (WorkbookTemplatesClientGetResponse, error) { + result := WorkbookTemplatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Get all Workbook templates defined within a specified resource group. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - WorkbookTemplatesClientListByResourceGroupOptions contains the optional parameters for the WorkbookTemplatesClient.NewListByResourceGroupPager +// method. +func (client *WorkbookTemplatesClient) NewListByResourceGroupPager(resourceGroupName string, options *WorkbookTemplatesClientListByResourceGroupOptions) *runtime.Pager[WorkbookTemplatesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbookTemplatesClientListByResourceGroupResponse]{ + More: func(page WorkbookTemplatesClientListByResourceGroupResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *WorkbookTemplatesClientListByResourceGroupResponse) (WorkbookTemplatesClientListByResourceGroupResponse, error) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return WorkbookTemplatesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *WorkbookTemplatesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *WorkbookTemplatesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *WorkbookTemplatesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkbookTemplatesClientListByResourceGroupResponse, error) { + result := WorkbookTemplatesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplatesListResult); err != nil { + return WorkbookTemplatesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// Update - Updates a workbook template that has already been added. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-11-20 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the Application Insights component resource. +// - options - WorkbookTemplatesClientUpdateOptions contains the optional parameters for the WorkbookTemplatesClient.Update +// method. +func (client *WorkbookTemplatesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientUpdateOptions) (WorkbookTemplatesClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbookTemplatesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *WorkbookTemplatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *WorkbookTemplatesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-11-20") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.WorkbookTemplateUpdateParameters != nil { + if err := runtime.MarshalAsJSON(req, *options.WorkbookTemplateUpdateParameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *WorkbookTemplatesClient) updateHandleResponse(resp *http.Response) (WorkbookTemplatesClientUpdateResponse, error) { + result := WorkbookTemplatesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbookTemplate); err != nil { + return WorkbookTemplatesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client.go index 6d2b1f442e3d..8236ebda29bb 100644 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client.go +++ b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armapplicationinsights @@ -55,18 +54,21 @@ func NewWorkItemConfigurationsClient(subscriptionID string, credential azcore.To // - options - WorkItemConfigurationsClientCreateOptions contains the optional parameters for the WorkItemConfigurationsClient.Create // method. func (client *WorkItemConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration, options *WorkItemConfigurationsClientCreateOptions) (WorkItemConfigurationsClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, resourceName, workItemConfigurationProperties, options) if err != nil { return WorkItemConfigurationsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkItemConfigurationsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkItemConfigurationsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkItemConfigurationsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -92,7 +94,10 @@ func (client *WorkItemConfigurationsClient) createCreateRequest(ctx context.Cont reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, workItemConfigurationProperties) + if err := runtime.MarshalAsJSON(req, workItemConfigurationProperties); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -115,16 +120,18 @@ func (client *WorkItemConfigurationsClient) createHandleResponse(resp *http.Resp // - options - WorkItemConfigurationsClientDeleteOptions contains the optional parameters for the WorkItemConfigurationsClient.Delete // method. func (client *WorkItemConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, options *WorkItemConfigurationsClientDeleteOptions) (WorkItemConfigurationsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, workItemConfigID, options) if err != nil { return WorkItemConfigurationsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkItemConfigurationsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkItemConfigurationsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkItemConfigurationsClientDeleteResponse{}, err } return WorkItemConfigurationsClientDeleteResponse{}, nil } @@ -167,18 +174,21 @@ func (client *WorkItemConfigurationsClient) deleteCreateRequest(ctx context.Cont // - options - WorkItemConfigurationsClientGetDefaultOptions contains the optional parameters for the WorkItemConfigurationsClient.GetDefault // method. func (client *WorkItemConfigurationsClient) GetDefault(ctx context.Context, resourceGroupName string, resourceName string, options *WorkItemConfigurationsClientGetDefaultOptions) (WorkItemConfigurationsClientGetDefaultResponse, error) { + var err error req, err := client.getDefaultCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return WorkItemConfigurationsClientGetDefaultResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkItemConfigurationsClientGetDefaultResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkItemConfigurationsClientGetDefaultResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkItemConfigurationsClientGetDefaultResponse{}, err } - return client.getDefaultHandleResponse(resp) + resp, err := client.getDefaultHandleResponse(httpResp) + return resp, err } // getDefaultCreateRequest creates the GetDefault request. @@ -227,18 +237,21 @@ func (client *WorkItemConfigurationsClient) getDefaultHandleResponse(resp *http. // - options - WorkItemConfigurationsClientGetItemOptions contains the optional parameters for the WorkItemConfigurationsClient.GetItem // method. func (client *WorkItemConfigurationsClient) GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, options *WorkItemConfigurationsClientGetItemOptions) (WorkItemConfigurationsClientGetItemResponse, error) { + var err error req, err := client.getItemCreateRequest(ctx, resourceGroupName, resourceName, workItemConfigID, options) if err != nil { return WorkItemConfigurationsClientGetItemResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkItemConfigurationsClientGetItemResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkItemConfigurationsClientGetItemResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkItemConfigurationsClientGetItemResponse{}, err } - return client.getItemHandleResponse(resp) + resp, err := client.getItemHandleResponse(httpResp) + return resp, err } // getItemCreateRequest creates the GetItem request. @@ -357,18 +370,21 @@ func (client *WorkItemConfigurationsClient) listHandleResponse(resp *http.Respon // - options - WorkItemConfigurationsClientUpdateItemOptions contains the optional parameters for the WorkItemConfigurationsClient.UpdateItem // method. func (client *WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration, options *WorkItemConfigurationsClientUpdateItemOptions) (WorkItemConfigurationsClientUpdateItemResponse, error) { + var err error req, err := client.updateItemCreateRequest(ctx, resourceGroupName, resourceName, workItemConfigID, workItemConfigurationProperties, options) if err != nil { return WorkItemConfigurationsClientUpdateItemResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkItemConfigurationsClientUpdateItemResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkItemConfigurationsClientUpdateItemResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkItemConfigurationsClientUpdateItemResponse{}, err } - return client.updateItemHandleResponse(resp) + resp, err := client.updateItemHandleResponse(httpResp) + return resp, err } // updateItemCreateRequest creates the UpdateItem request. @@ -398,7 +414,10 @@ func (client *WorkItemConfigurationsClient) updateItemCreateRequest(ctx context. reqQP.Set("api-version", "2015-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, workItemConfigurationProperties) + if err := runtime.MarshalAsJSON(req, workItemConfigurationProperties); err != nil { + return nil, err + } + return req, nil } // updateItemHandleResponse handles the UpdateItem response. diff --git a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go b/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go deleted file mode 100644 index e79152b8a29d..000000000000 --- a/sdk/resourcemanager/applicationinsights/armapplicationinsights/workitemconfigurations_client_example_test.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armapplicationinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigsGet.json -func ExampleWorkItemConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkItemConfigurationsClient().NewListPager("my-resource-group", "my-component", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkItemConfigurationsListResult = armapplicationinsights.WorkItemConfigurationsListResult{ - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigCreate.json -func ExampleWorkItemConfigurationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkItemConfigurationsClient().Create(ctx, "my-resource-group", "my-component", armapplicationinsights.WorkItemCreateConfiguration{ - ConnectorDataConfiguration: to.Ptr("{\"VSOAccountBaseUrl\":\"https://testtodelete.visualstudio.com\",\"ProjectCollection\":\"DefaultCollection\",\"Project\":\"todeletefirst\",\"ResourceId\":\"d0662b05-439a-4a1b-840b-33a7f8b42ebf\",\"Custom\":\"{\\\"/fields/System.WorkItemType\\\":\\\"Bug\\\",\\\"/fields/System.AreaPath\\\":\\\"todeletefirst\\\",\\\"/fields/System.AssignedTo\\\":\\\"\\\"}\"}"), - ConnectorID: to.Ptr("d334e2a4-6733-488e-8645-a9fdc1694f41"), - ValidateOnly: to.Ptr(true), - WorkItemProperties: map[string]*string{ - "0": to.Ptr("[object Object]"), - "1": to.Ptr("[object Object]"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkItemConfiguration = armapplicationinsights.WorkItemConfiguration{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDefaultGet.json -func ExampleWorkItemConfigurationsClient_GetDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkItemConfigurationsClient().GetDefault(ctx, "my-resource-group", "my-component", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkItemConfiguration = armapplicationinsights.WorkItemConfiguration{ - // ConfigDisplayName: to.Ptr("Visual Studio Team Services"), - // ConfigProperties: to.Ptr("{\"VSOAccountBaseUrl\":\"https://testtodelete.visualstudio.com\",\"ProjectCollection\":\"DefaultCollection\",\"Project\":\"todeletefirst\",\"ResourceId\":\"d0662b05-439a-4a1b-840b-33a7f8b42ebf\",\"ConfigurationType\":\"Standard\",\"WorkItemType\":\"Bug\",\"AreaPath\":\"todeletefirst\",\"AssignedTo\":\"\"}"), - // ConnectorID: to.Ptr("d334e2a4-6733-488e-8645-a9fdc1694f41"), - // ID: to.Ptr("Visual Studio Team Services"), - // IsDefault: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDelete.json -func ExampleWorkItemConfigurationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWorkItemConfigurationsClient().Delete(ctx, "my-resource-group", "my-component", "Visual Studio Team Services", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigGet.json -func ExampleWorkItemConfigurationsClient_GetItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkItemConfigurationsClient().GetItem(ctx, "my-resource-group", "my-component", "Visual Studio Team Services", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkItemConfiguration = armapplicationinsights.WorkItemConfiguration{ - // ConfigDisplayName: to.Ptr("Visual Studio Team Services"), - // ConfigProperties: to.Ptr("{\"VSOAccountBaseUrl\":\"https://testtodelete.visualstudio.com\",\"ProjectCollection\":\"DefaultCollection\",\"Project\":\"todeletefirst\",\"ResourceId\":\"d0662b05-439a-4a1b-840b-33a7f8b42ebf\",\"ConfigurationType\":\"Standard\",\"WorkItemType\":\"Bug\",\"AreaPath\":\"todeletefirst\",\"AssignedTo\":\"\"}"), - // ConnectorID: to.Ptr("d334e2a4-6733-488e-8645-a9fdc1694f41"), - // ID: to.Ptr("Visual Studio Team Services"), - // IsDefault: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigUpdate.json -func ExampleWorkItemConfigurationsClient_UpdateItem() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armapplicationinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkItemConfigurationsClient().UpdateItem(ctx, "my-resource-group", "my-component", "Visual Studio Team Services", armapplicationinsights.WorkItemCreateConfiguration{ - ConnectorDataConfiguration: to.Ptr("{\"VSOAccountBaseUrl\":\"https://testtodelete.visualstudio.com\",\"ProjectCollection\":\"DefaultCollection\",\"Project\":\"todeletefirst\",\"ResourceId\":\"d0662b05-439a-4a1b-840b-33a7f8b42ebf\",\"Custom\":\"{\\\"/fields/System.WorkItemType\\\":\\\"Bug\\\",\\\"/fields/System.AreaPath\\\":\\\"todeletefirst\\\",\\\"/fields/System.AssignedTo\\\":\\\"\\\"}\"}"), - ConnectorID: to.Ptr("d334e2a4-6733-488e-8645-a9fdc1694f41"), - ValidateOnly: to.Ptr(true), - WorkItemProperties: map[string]*string{ - "0": to.Ptr("[object Object]"), - "1": to.Ptr("[object Object]"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkItemConfiguration = armapplicationinsights.WorkItemConfiguration{ - // ConfigDisplayName: to.Ptr("Visual Studio Team Services"), - // ConfigProperties: to.Ptr("{\"VSOAccountBaseUrl\":\"https://testtodelete.visualstudio.com\",\"ProjectCollection\":\"DefaultCollection\",\"Project\":\"todeletefirst\",\"ResourceId\":\"d0662b05-439a-4a1b-840b-33a7f8b42ebf\",\"ConfigurationType\":\"Standard\",\"WorkItemType\":\"Bug\",\"AreaPath\":\"todeletefirst\",\"AssignedTo\":\"\"}"), - // ConnectorID: to.Ptr("d334e2a4-6733-488e-8645-a9fdc1694f41"), - // ID: to.Ptr("Visual Studio Team Services"), - // IsDefault: to.Ptr(true), - // } -}