Skip to content

Commit

Permalink
Merge pull request #935 from hashicorp/auto-pr/373dbd6a
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (44a056f)
  • Loading branch information
tombuildsstuff authored Mar 20, 2024
2 parents 4faf3d5 + 44a056f commit 99c1aca
Show file tree
Hide file tree
Showing 572 changed files with 47,188 additions and 53 deletions.
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 := contentproducttemplates.NewContentproducttemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue")
id := contentproducttemplates.NewContentProductTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue")

read, err := client.ProductTemplateGet(ctx, id)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,60 @@ import (
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

var _ resourceids.ResourceId = &ContentproducttemplateId{}
var _ resourceids.ResourceId = &ContentProductTemplateId{}

// ContentproducttemplateId is a struct representing the Resource ID for a Contentproducttemplate
type ContentproducttemplateId struct {
// ContentProductTemplateId is a struct representing the Resource ID for a Content Product Template
type ContentProductTemplateId struct {
SubscriptionId string
ResourceGroupName string
WorkspaceName string
TemplateId string
}

// NewContentproducttemplateID returns a new ContentproducttemplateId struct
func NewContentproducttemplateID(subscriptionId string, resourceGroupName string, workspaceName string, templateId string) ContentproducttemplateId {
return ContentproducttemplateId{
// NewContentProductTemplateID returns a new ContentProductTemplateId struct
func NewContentProductTemplateID(subscriptionId string, resourceGroupName string, workspaceName string, templateId string) ContentProductTemplateId {
return ContentProductTemplateId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
WorkspaceName: workspaceName,
TemplateId: templateId,
}
}

// ParseContentproducttemplateID parses 'input' into a ContentproducttemplateId
func ParseContentproducttemplateID(input string) (*ContentproducttemplateId, error) {
parser := resourceids.NewParserFromResourceIdType(&ContentproducttemplateId{})
// ParseContentProductTemplateID parses 'input' into a ContentProductTemplateId
func ParseContentProductTemplateID(input string) (*ContentProductTemplateId, error) {
parser := resourceids.NewParserFromResourceIdType(&ContentProductTemplateId{})
parsed, err := parser.Parse(input, false)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := ContentproducttemplateId{}
id := ContentProductTemplateId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

// ParseContentproducttemplateIDInsensitively parses 'input' case-insensitively into a ContentproducttemplateId
// ParseContentProductTemplateIDInsensitively parses 'input' case-insensitively into a ContentProductTemplateId
// note: this method should only be used for API response data and not user input
func ParseContentproducttemplateIDInsensitively(input string) (*ContentproducttemplateId, error) {
parser := resourceids.NewParserFromResourceIdType(&ContentproducttemplateId{})
func ParseContentProductTemplateIDInsensitively(input string) (*ContentProductTemplateId, error) {
parser := resourceids.NewParserFromResourceIdType(&ContentProductTemplateId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := ContentproducttemplateId{}
id := ContentProductTemplateId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

func (id *ContentproducttemplateId) FromParseResult(input resourceids.ParseResult) error {
func (id *ContentProductTemplateId) FromParseResult(input resourceids.ParseResult) error {
var ok bool

if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
Expand All @@ -85,29 +85,29 @@ func (id *ContentproducttemplateId) FromParseResult(input resourceids.ParseResul
return nil
}

// ValidateContentproducttemplateID checks that 'input' can be parsed as a Contentproducttemplate ID
func ValidateContentproducttemplateID(input interface{}, key string) (warnings []string, errors []error) {
// ValidateContentProductTemplateID checks that 'input' can be parsed as a Content Product Template ID
func ValidateContentProductTemplateID(input interface{}, key string) (warnings []string, errors []error) {
v, ok := input.(string)
if !ok {
errors = append(errors, fmt.Errorf("expected %q to be a string", key))
return
}

if _, err := ParseContentproducttemplateID(v); err != nil {
if _, err := ParseContentProductTemplateID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Contentproducttemplate ID
func (id ContentproducttemplateId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/providers/Microsoft.SecurityInsights/contentproducttemplates/%s"
// ID returns the formatted Content Product Template ID
func (id ContentProductTemplateId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/providers/Microsoft.SecurityInsights/contentProductTemplates/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.TemplateId)
}

// Segments returns a slice of Resource ID Segments which comprise this Contentproducttemplate ID
func (id ContentproducttemplateId) Segments() []resourceids.Segment {
// Segments returns a slice of Resource ID Segments which comprise this Content Product Template ID
func (id ContentProductTemplateId) Segments() []resourceids.Segment {
return []resourceids.Segment{
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"),
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"),
Expand All @@ -119,18 +119,18 @@ func (id ContentproducttemplateId) Segments() []resourceids.Segment {
resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"),
resourceids.StaticSegment("staticProviders2", "providers", "providers"),
resourceids.ResourceProviderSegment("staticMicrosoftSecurityInsights", "Microsoft.SecurityInsights", "Microsoft.SecurityInsights"),
resourceids.StaticSegment("staticContentproducttemplates", "contentproducttemplates", "contentproducttemplates"),
resourceids.StaticSegment("staticContentProductTemplates", "contentProductTemplates", "contentProductTemplates"),
resourceids.UserSpecifiedSegment("templateId", "templateIdValue"),
}
}

// String returns a human-readable description of this Contentproducttemplate ID
func (id ContentproducttemplateId) String() string {
// String returns a human-readable description of this Content Product Template ID
func (id ContentProductTemplateId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Workspace Name: %q", id.WorkspaceName),
fmt.Sprintf("Template: %q", id.TemplateId),
}
return fmt.Sprintf("Contentproducttemplate (%s)", strings.Join(components, "\n"))
return fmt.Sprintf("Content Product Template (%s)", strings.Join(components, "\n"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

var _ resourceids.ResourceId = &ContentproducttemplateId{}
var _ resourceids.ResourceId = &ContentProductTemplateId{}

func TestNewContentproducttemplateID(t *testing.T) {
id := NewContentproducttemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue")
func TestNewContentProductTemplateID(t *testing.T) {
id := NewContentProductTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue")

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")
Expand All @@ -31,19 +31,19 @@ func TestNewContentproducttemplateID(t *testing.T) {
}
}

func TestFormatContentproducttemplateID(t *testing.T) {
actual := NewContentproducttemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates/templateIdValue"
func TestFormatContentProductTemplateID(t *testing.T) {
actual := NewContentProductTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "templateIdValue").ID()
expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates/templateIdValue"
if actual != expected {
t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual)
}
}

func TestParseContentproducttemplateID(t *testing.T) {
func TestParseContentProductTemplateID(t *testing.T) {
testData := []struct {
Input string
Error bool
Expected *ContentproducttemplateId
Expected *ContentProductTemplateId
}{
{
// Incomplete URI
Expand Down Expand Up @@ -102,13 +102,13 @@ func TestParseContentproducttemplateID(t *testing.T) {
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates",
Error: true,
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates/templateIdValue",
Expected: &ContentproducttemplateId{
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates/templateIdValue",
Expected: &ContentProductTemplateId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
ResourceGroupName: "example-resource-group",
WorkspaceName: "workspaceValue",
Expand All @@ -117,14 +117,14 @@ func TestParseContentproducttemplateID(t *testing.T) {
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates/templateIdValue/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates/templateIdValue/extra",
Error: true,
},
}
for _, v := range testData {
t.Logf("[DEBUG] Testing %q", v.Input)

actual, err := ParseContentproducttemplateID(v.Input)
actual, err := ParseContentProductTemplateID(v.Input)
if err != nil {
if v.Error {
continue
Expand Down Expand Up @@ -155,11 +155,11 @@ func TestParseContentproducttemplateID(t *testing.T) {
}
}

func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
func TestParseContentProductTemplateIDInsensitively(t *testing.T) {
testData := []struct {
Input string
Error bool
Expected *ContentproducttemplateId
Expected *ContentProductTemplateId
}{
{
// Incomplete URI
Expand Down Expand Up @@ -268,7 +268,7 @@ func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates",
Error: true,
},
{
Expand All @@ -278,8 +278,8 @@ func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates/templateIdValue",
Expected: &ContentproducttemplateId{
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates/templateIdValue",
Expected: &ContentProductTemplateId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
ResourceGroupName: "example-resource-group",
WorkspaceName: "workspaceValue",
Expand All @@ -288,13 +288,13 @@ func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentproducttemplates/templateIdValue/extra",
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.OperationalInsights/workspaces/workspaceValue/providers/Microsoft.SecurityInsights/contentProductTemplates/templateIdValue/extra",
Error: true,
},
{
// Valid URI (mIxEd CaSe since this is insensitive)
Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.oPeRaTiOnAlInSiGhTs/wOrKsPaCeS/wOrKsPaCeVaLuE/pRoViDeRs/mIcRoSoFt.sEcUrItYiNsIgHtS/cOnTeNtPrOdUcTtEmPlAtEs/tEmPlAtEiDvAlUe",
Expected: &ContentproducttemplateId{
Expected: &ContentProductTemplateId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP",
WorkspaceName: "wOrKsPaCeVaLuE",
Expand All @@ -310,7 +310,7 @@ func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
for _, v := range testData {
t.Logf("[DEBUG] Testing %q", v.Input)

actual, err := ParseContentproducttemplateIDInsensitively(v.Input)
actual, err := ParseContentProductTemplateIDInsensitively(v.Input)
if err != nil {
if v.Error {
continue
Expand Down Expand Up @@ -341,10 +341,10 @@ func TestParseContentproducttemplateIDInsensitively(t *testing.T) {
}
}

func TestSegmentsForContentproducttemplateId(t *testing.T) {
segments := ContentproducttemplateId{}.Segments()
func TestSegmentsForContentProductTemplateId(t *testing.T) {
segments := ContentProductTemplateId{}.Segments()
if len(segments) == 0 {
t.Fatalf("ContentproducttemplateId has no segments")
t.Fatalf("ContentProductTemplateId has no segments")
}

uniqueNames := make(map[string]struct{}, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ProductTemplateGetOperationResponse struct {
}

// ProductTemplateGet ...
func (c ContentProductTemplatesClient) ProductTemplateGet(ctx context.Context, id ContentproducttemplateId) (result ProductTemplateGetOperationResponse, err error) {
func (c ContentProductTemplatesClient) ProductTemplateGet(ctx context.Context, id ContentProductTemplateId) (result ProductTemplateGetOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
Expand Down
90 changes: 90 additions & 0 deletions resource-manager/securityinsights/2024-03-01/actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2024-03-01/actions` Documentation

The `actions` SDK allows for interaction with the Azure Resource Manager Service `securityinsights` (API Version `2024-03-01`).

This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs).

### Import Path

```go
import "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2024-03-01/actions"
```


### Client Initialization

```go
client := actions.NewActionsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
```


### Example Usage: `ActionsClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := actions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "ruleIdValue", "actionIdValue")

payload := actions.ActionRequest{
// ...
}


read, err := client.CreateOrUpdate(ctx, id, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `ActionsClient.Delete`

```go
ctx := context.TODO()
id := actions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "ruleIdValue", "actionIdValue")

read, err := client.Delete(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `ActionsClient.Get`

```go
ctx := context.TODO()
id := actions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "ruleIdValue", "actionIdValue")

read, err := client.Get(ctx, id)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `ActionsClient.ListByAlertRule`

```go
ctx := context.TODO()
id := actions.NewAlertRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "ruleIdValue")

// alternatively `client.ListByAlertRule(ctx, id)` can be used to do batched pagination
items, err := client.ListByAlertRuleComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```
Loading

0 comments on commit 99c1aca

Please sign in to comment.