Skip to content

Commit

Permalink
Updating based on d1b507f76
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Oct 9, 2024
1 parent 4d383f2 commit ab54431
Show file tree
Hide file tree
Showing 13,730 changed files with 344,383 additions and 87,215 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion resource-manager/advisor/2023-01-01/advisorscore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ client.Client.Authorizer = authorizer

```go
ctx := context.TODO()
id := advisorscore.NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "name")
id := advisorscore.NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "advisorScoreName")

read, err := client.Get(ctx, id)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (id AdvisorScoreId) Segments() []resourceids.Segment {
resourceids.StaticSegment("staticProviders", "providers", "providers"),
resourceids.ResourceProviderSegment("staticMicrosoftAdvisor", "Microsoft.Advisor", "Microsoft.Advisor"),
resourceids.StaticSegment("staticAdvisorScore", "advisorScore", "advisorScore"),
resourceids.UserSpecifiedSegment("advisorScoreName", "name"),
resourceids.UserSpecifiedSegment("advisorScoreName", "advisorScoreName"),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import (
var _ resourceids.ResourceId = &AdvisorScoreId{}

func TestNewAdvisorScoreID(t *testing.T) {
id := NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "name")
id := NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "advisorScoreName")

if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" {
t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012")
}

if id.AdvisorScoreName != "name" {
t.Fatalf("Expected %q but got %q for Segment 'AdvisorScoreName'", id.AdvisorScoreName, "name")
if id.AdvisorScoreName != "advisorScoreName" {
t.Fatalf("Expected %q but got %q for Segment 'AdvisorScoreName'", id.AdvisorScoreName, "advisorScoreName")
}
}

func TestFormatAdvisorScoreID(t *testing.T) {
actual := NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "name").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/name"
actual := NewAdvisorScoreID("12345678-1234-9876-4563-123456789012", "advisorScoreName").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/advisorScoreName"
if actual != expected {
t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual)
}
Expand Down Expand Up @@ -69,15 +69,15 @@ func TestParseAdvisorScoreID(t *testing.T) {
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/name",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/advisorScoreName",
Expected: &AdvisorScoreId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
AdvisorScoreName: "name",
AdvisorScoreName: "advisorScoreName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/name/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/advisorScoreName/extra",
Error: true,
},
}
Expand Down Expand Up @@ -170,28 +170,28 @@ func TestParseAdvisorScoreIDInsensitively(t *testing.T) {
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/name",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/advisorScoreName",
Expected: &AdvisorScoreId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
AdvisorScoreName: "name",
AdvisorScoreName: "advisorScoreName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/name/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Advisor/advisorScore/advisorScoreName/extra",
Error: true,
},
{
// Valid URI (mIxEd CaSe since this is insensitive)
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aDvIsOr/aDvIsOrScOrE/nAmE",
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aDvIsOr/aDvIsOrScOrE/aDvIsOrScOrEnAmE",
Expected: &AdvisorScoreId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
AdvisorScoreName: "nAmE",
AdvisorScoreName: "aDvIsOrScOrEnAmE",
},
},
{
// Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive)
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aDvIsOr/aDvIsOrScOrE/nAmE/extra",
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.aDvIsOr/aDvIsOrScOrE/aDvIsOrScOrEnAmE/extra",
Error: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion resource-manager/advisor/2023-01-01/metadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer

```go
ctx := context.TODO()
id := metadata.NewMetadataID("name")
id := metadata.NewMetadataID("metadataName")

read, err := client.RecommendationMetadataGet(ctx, id)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (id MetadataId) Segments() []resourceids.Segment {
resourceids.StaticSegment("staticProviders", "providers", "providers"),
resourceids.ResourceProviderSegment("staticMicrosoftAdvisor", "Microsoft.Advisor", "Microsoft.Advisor"),
resourceids.StaticSegment("staticMetadata", "metadata", "metadata"),
resourceids.UserSpecifiedSegment("metadataName", "name"),
resourceids.UserSpecifiedSegment("metadataName", "metadataName"),
}
}

Expand Down
28 changes: 14 additions & 14 deletions resource-manager/advisor/2023-01-01/metadata/id_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
var _ resourceids.ResourceId = &MetadataId{}

func TestNewMetadataID(t *testing.T) {
id := NewMetadataID("name")
id := NewMetadataID("metadataName")

if id.MetadataName != "name" {
t.Fatalf("Expected %q but got %q for Segment 'MetadataName'", id.MetadataName, "name")
if id.MetadataName != "metadataName" {
t.Fatalf("Expected %q but got %q for Segment 'MetadataName'", id.MetadataName, "metadataName")
}
}

func TestFormatMetadataID(t *testing.T) {
actual := NewMetadataID("name").ID()
expected := "/providers/Microsoft.Advisor/metadata/name"
actual := NewMetadataID("metadataName").ID()
expected := "/providers/Microsoft.Advisor/metadata/metadataName"
if actual != expected {
t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual)
}
Expand Down Expand Up @@ -55,14 +55,14 @@ func TestParseMetadataID(t *testing.T) {
},
{
// Valid URI
Input: "/providers/Microsoft.Advisor/metadata/name",
Input: "/providers/Microsoft.Advisor/metadata/metadataName",
Expected: &MetadataId{
MetadataName: "name",
MetadataName: "metadataName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/providers/Microsoft.Advisor/metadata/name/extra",
Input: "/providers/Microsoft.Advisor/metadata/metadataName/extra",
Error: true,
},
}
Expand Down Expand Up @@ -131,26 +131,26 @@ func TestParseMetadataIDInsensitively(t *testing.T) {
},
{
// Valid URI
Input: "/providers/Microsoft.Advisor/metadata/name",
Input: "/providers/Microsoft.Advisor/metadata/metadataName",
Expected: &MetadataId{
MetadataName: "name",
MetadataName: "metadataName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/providers/Microsoft.Advisor/metadata/name/extra",
Input: "/providers/Microsoft.Advisor/metadata/metadataName/extra",
Error: true,
},
{
// Valid URI (mIxEd CaSe since this is insensitive)
Input: "/pRoViDeRs/mIcRoSoFt.aDvIsOr/mEtAdAtA/nAmE",
Input: "/pRoViDeRs/mIcRoSoFt.aDvIsOr/mEtAdAtA/mEtAdAtAnAmE",
Expected: &MetadataId{
MetadataName: "nAmE",
MetadataName: "mEtAdAtAnAmE",
},
},
{
// Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive)
Input: "/pRoViDeRs/mIcRoSoFt.aDvIsOr/mEtAdAtA/nAmE/extra",
Input: "/pRoViDeRs/mIcRoSoFt.aDvIsOr/mEtAdAtA/mEtAdAtAnAmE/extra",
Error: true,
},
}
Expand Down
6 changes: 3 additions & 3 deletions resource-manager/advisor/2023-01-01/suppressions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ client.Client.Authorizer = authorizer

```go
ctx := context.TODO()
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "name")
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "suppressionName")

payload := suppressions.SuppressionContract{
// ...
Expand All @@ -46,7 +46,7 @@ if model := read.Model; model != nil {

```go
ctx := context.TODO()
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "name")
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "suppressionName")

read, err := client.Delete(ctx, id)
if err != nil {
Expand All @@ -62,7 +62,7 @@ if model := read.Model; model != nil {

```go
ctx := context.TODO()
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "name")
id := suppressions.NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "suppressionName")

read, err := client.Get(ctx, id)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (id ScopedSuppressionId) Segments() []resourceids.Segment {
resourceids.StaticSegment("staticRecommendations", "recommendations", "recommendations"),
resourceids.UserSpecifiedSegment("recommendationId", "recommendationId"),
resourceids.StaticSegment("staticSuppressions", "suppressions", "suppressions"),
resourceids.UserSpecifiedSegment("suppressionName", "name"),
resourceids.UserSpecifiedSegment("suppressionName", "suppressionName"),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var _ resourceids.ResourceId = &ScopedSuppressionId{}

func TestNewScopedSuppressionID(t *testing.T) {
id := NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "name")
id := NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "suppressionName")

if id.ResourceUri != "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group" {
t.Fatalf("Expected %q but got %q for Segment 'ResourceUri'", id.ResourceUri, "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")
Expand All @@ -22,14 +22,14 @@ func TestNewScopedSuppressionID(t *testing.T) {
t.Fatalf("Expected %q but got %q for Segment 'RecommendationId'", id.RecommendationId, "recommendationId")
}

if id.SuppressionName != "name" {
t.Fatalf("Expected %q but got %q for Segment 'SuppressionName'", id.SuppressionName, "name")
if id.SuppressionName != "suppressionName" {
t.Fatalf("Expected %q but got %q for Segment 'SuppressionName'", id.SuppressionName, "suppressionName")
}
}

func TestFormatScopedSuppressionID(t *testing.T) {
actual := NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "name").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/name"
actual := NewScopedSuppressionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "recommendationId", "suppressionName").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName"
if actual != expected {
t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual)
}
Expand Down Expand Up @@ -78,16 +78,16 @@ func TestParseScopedSuppressionID(t *testing.T) {
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/name",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName",
Expected: &ScopedSuppressionId{
ResourceUri: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group",
RecommendationId: "recommendationId",
SuppressionName: "name",
SuppressionName: "suppressionName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/name/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName/extra",
Error: true,
},
}
Expand Down Expand Up @@ -194,30 +194,30 @@ func TestParseScopedSuppressionIDInsensitively(t *testing.T) {
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/name",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName",
Expected: &ScopedSuppressionId{
ResourceUri: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group",
RecommendationId: "recommendationId",
SuppressionName: "name",
SuppressionName: "suppressionName",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/name/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName/extra",
Error: true,
},
{
// Valid URI (mIxEd CaSe since this is insensitive)
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.aDvIsOr/rEcOmMeNdAtIoNs/rEcOmMeNdAtIoNiD/sUpPrEsSiOnS/nAmE",
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.aDvIsOr/rEcOmMeNdAtIoNs/rEcOmMeNdAtIoNiD/sUpPrEsSiOnS/sUpPrEsSiOnNaMe",
Expected: &ScopedSuppressionId{
ResourceUri: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp",
RecommendationId: "rEcOmMeNdAtIoNiD",
SuppressionName: "nAmE",
SuppressionName: "sUpPrEsSiOnNaMe",
},
},
{
// Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive)
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.aDvIsOr/rEcOmMeNdAtIoNs/rEcOmMeNdAtIoNiD/sUpPrEsSiOnS/nAmE/extra",
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.aDvIsOr/rEcOmMeNdAtIoNs/rEcOmMeNdAtIoNiD/sUpPrEsSiOnS/sUpPrEsSiOnNaMe/extra",
Error: true,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package alertsmanagements
import (
"encoding/json"
"fmt"
"strings"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -52,6 +53,14 @@ func UnmarshalAlertsMetaDataPropertiesImplementation(input []byte) (AlertsMetaDa
value = fmt.Sprintf("%v", v)
}

if strings.EqualFold(value, "MonitorServiceList") {
var out MonitorServiceList
if err := json.Unmarshal(input, &out); err != nil {
return nil, fmt.Errorf("unmarshaling into MonitorServiceList: %+v", err)
}
return out, nil
}

var parent BaseAlertsMetaDataPropertiesImpl
if err := json.Unmarshal(input, &parent); err != nil {
return nil, fmt.Errorf("unmarshaling into BaseAlertsMetaDataPropertiesImpl: %+v", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package alertsmanagements

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type MonitorServiceDetails struct {
DisplayName *string `json:"displayName,omitempty"`
Name *string `json:"name,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package alertsmanagements

import (
"encoding/json"
"fmt"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

var _ AlertsMetaDataProperties = MonitorServiceList{}

type MonitorServiceList struct {
Data []MonitorServiceDetails `json:"data"`

// Fields inherited from AlertsMetaDataProperties

MetadataIdentifier MetadataIdentifier `json:"metadataIdentifier"`
}

func (s MonitorServiceList) AlertsMetaDataProperties() BaseAlertsMetaDataPropertiesImpl {
return BaseAlertsMetaDataPropertiesImpl{
MetadataIdentifier: s.MetadataIdentifier,
}
}

var _ json.Marshaler = MonitorServiceList{}

func (s MonitorServiceList) MarshalJSON() ([]byte, error) {
type wrapper MonitorServiceList
wrapped := wrapper(s)
encoded, err := json.Marshal(wrapped)
if err != nil {
return nil, fmt.Errorf("marshaling MonitorServiceList: %+v", err)
}

var decoded map[string]interface{}
if err = json.Unmarshal(encoded, &decoded); err != nil {
return nil, fmt.Errorf("unmarshaling MonitorServiceList: %+v", err)
}

decoded["metadataIdentifier"] = "MonitorServiceList"

encoded, err = json.Marshal(decoded)
if err != nil {
return nil, fmt.Errorf("re-marshaling MonitorServiceList: %+v", err)
}

return encoded, nil
}
Loading

0 comments on commit ab54431

Please sign in to comment.