Skip to content

Commit

Permalink
Merge branch 'main' of github.com:vermacodes/go-azure-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Oct 9, 2024
2 parents b386fa5 + e723a4f commit d1676a8
Show file tree
Hide file tree
Showing 13,734 changed files with 344,389 additions and 87,221 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 microsoft-graph/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/hashicorp/go-azure-sdk/microsoft-graph

go 1.21

require github.com/hashicorp/go-azure-sdk/sdk v0.20241004.1180715
require github.com/hashicorp/go-azure-sdk/sdk v0.20241009.1142232

require (
github.com/golang/protobuf v1.5.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions microsoft-graph/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hashicorp/go-azure-helpers v0.66.2 h1:+Pzuo7pdKl0hBXXr5ymmhs4Q40tHAo2nAvHq4WgSjx8=
github.com/hashicorp/go-azure-helpers v0.66.2/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4=
github.com/hashicorp/go-azure-sdk/sdk v0.20241004.1180715 h1:a3j77ru67R9mDCLdcO4buXEj0vidYNIa0DKuYq8xVMo=
github.com/hashicorp/go-azure-sdk/sdk v0.20241004.1180715/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE=
github.com/hashicorp/go-azure-sdk/sdk v0.20241009.1142232 h1:CxBWfnrsR/Vdyd+4N782xzYoqw5bczBSguwOpiF7VO8=
github.com/hashicorp/go-azure-sdk/sdk v0.20241009.1142232/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
Expand Down
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"`
}
Loading

0 comments on commit d1676a8

Please sign in to comment.