-
Notifications
You must be signed in to change notification settings - Fork 11
/
ComponentsUpdateTagsOnly.go
72 lines (69 loc) · 3.67 KB
/
ComponentsUpdateTagsOnly.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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/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("<subscription-id>", 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),
// },
// }
}