Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating the Go SDK (b04942597642d266d9e83718967cb510c6129222) #952

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,53 @@ func parseSeverity(input string) (*Severity, error) {
out := Severity(input)
return &out, nil
}

type SuppressionType string

const (
SuppressionTypeAlways SuppressionType = "Always"
SuppressionTypeDaily SuppressionType = "Daily"
SuppressionTypeMonthly SuppressionType = "Monthly"
SuppressionTypeOnce SuppressionType = "Once"
SuppressionTypeWeekly SuppressionType = "Weekly"
)

func PossibleValuesForSuppressionType() []string {
return []string{
string(SuppressionTypeAlways),
string(SuppressionTypeDaily),
string(SuppressionTypeMonthly),
string(SuppressionTypeOnce),
string(SuppressionTypeWeekly),
}
}

func (s *SuppressionType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseSuppressionType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseSuppressionType(input string) (*SuppressionType, error) {
vals := map[string]SuppressionType{
"always": SuppressionTypeAlways,
"daily": SuppressionTypeDaily,
"monthly": SuppressionTypeMonthly,
"once": SuppressionTypeOnce,
"weekly": SuppressionTypeWeekly,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := SuppressionType(input)
return &out, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package actionrules

import (
"encoding/json"
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/lang/dates"
)

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

var _ ActionRuleProperties = ActionGroup{}

type ActionGroup struct {
ActionGroupId *string `json:"actionGroupId,omitempty"`

// Fields inherited from ActionRuleProperties
Conditions *Conditions `json:"conditions,omitempty"`
CreatedAt *string `json:"createdAt,omitempty"`
CreatedBy *string `json:"createdBy,omitempty"`
Description *string `json:"description,omitempty"`
LastModifiedAt *string `json:"lastModifiedAt,omitempty"`
LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
Scope *Scope `json:"scope,omitempty"`
Status *ActionRuleStatus `json:"status,omitempty"`
}

func (o *ActionGroup) GetCreatedAtAsTime() (*time.Time, error) {
if o.CreatedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *ActionGroup) SetCreatedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAt = &formatted
}

func (o *ActionGroup) GetLastModifiedAtAsTime() (*time.Time, error) {
if o.LastModifiedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *ActionGroup) SetLastModifiedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastModifiedAt = &formatted
}

var _ json.Marshaler = ActionGroup{}

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

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

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

return encoded, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package actionrules
import (
"encoding/json"
"fmt"
"strings"
)

// Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -35,6 +36,30 @@ func unmarshalActionRulePropertiesImplementation(input []byte) (ActionRuleProper
return nil, nil
}

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

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

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

out := RawActionRulePropertiesImpl{
Type: value,
Values: temp,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package actionrules

import (
"encoding/json"
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/lang/dates"
)

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

var _ ActionRuleProperties = Diagnostics{}

type Diagnostics struct {

// Fields inherited from ActionRuleProperties
Conditions *Conditions `json:"conditions,omitempty"`
CreatedAt *string `json:"createdAt,omitempty"`
CreatedBy *string `json:"createdBy,omitempty"`
Description *string `json:"description,omitempty"`
LastModifiedAt *string `json:"lastModifiedAt,omitempty"`
LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
Scope *Scope `json:"scope,omitempty"`
Status *ActionRuleStatus `json:"status,omitempty"`
}

func (o *Diagnostics) GetCreatedAtAsTime() (*time.Time, error) {
if o.CreatedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *Diagnostics) SetCreatedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAt = &formatted
}

func (o *Diagnostics) GetLastModifiedAtAsTime() (*time.Time, error) {
if o.LastModifiedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *Diagnostics) SetLastModifiedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastModifiedAt = &formatted
}

var _ json.Marshaler = Diagnostics{}

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

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

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

return encoded, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package actionrules

import (
"encoding/json"
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/lang/dates"
)

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

var _ ActionRuleProperties = Suppression{}

type Suppression struct {
SuppressionConfig *SuppressionConfig `json:"suppressionConfig,omitempty"`

// Fields inherited from ActionRuleProperties
Conditions *Conditions `json:"conditions,omitempty"`
CreatedAt *string `json:"createdAt,omitempty"`
CreatedBy *string `json:"createdBy,omitempty"`
Description *string `json:"description,omitempty"`
LastModifiedAt *string `json:"lastModifiedAt,omitempty"`
LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
Scope *Scope `json:"scope,omitempty"`
Status *ActionRuleStatus `json:"status,omitempty"`
}

func (o *Suppression) GetCreatedAtAsTime() (*time.Time, error) {
if o.CreatedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *Suppression) SetCreatedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAt = &formatted
}

func (o *Suppression) GetLastModifiedAtAsTime() (*time.Time, error) {
if o.LastModifiedAt == nil {
return nil, nil
}
return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00")
}

func (o *Suppression) SetLastModifiedAtAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastModifiedAt = &formatted
}

var _ json.Marshaler = Suppression{}

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

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

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

return encoded, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package actionrules

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

type SuppressionConfig struct {
RecurrenceType SuppressionType `json:"recurrenceType"`
Schedule *SuppressionSchedule `json:"schedule,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package actionrules

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

type SuppressionSchedule struct {
EndDate *string `json:"endDate,omitempty"`
EndTime *string `json:"endTime,omitempty"`
RecurrenceValues *[]int64 `json:"recurrenceValues,omitempty"`
StartDate *string `json:"startDate,omitempty"`
StartTime *string `json:"startTime,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,44 +53,6 @@ func parseDataFlowDebugCommandType(input string) (*DataFlowDebugCommandType, err
return &out, nil
}

type IntegrationRuntimeReferenceType string

const (
IntegrationRuntimeReferenceTypeIntegrationRuntimeReference IntegrationRuntimeReferenceType = "IntegrationRuntimeReference"
)

func PossibleValuesForIntegrationRuntimeReferenceType() []string {
return []string{
string(IntegrationRuntimeReferenceTypeIntegrationRuntimeReference),
}
}

func (s *IntegrationRuntimeReferenceType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseIntegrationRuntimeReferenceType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseIntegrationRuntimeReferenceType(input string) (*IntegrationRuntimeReferenceType, error) {
vals := map[string]IntegrationRuntimeReferenceType{
"integrationruntimereference": IntegrationRuntimeReferenceTypeIntegrationRuntimeReference,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := IntegrationRuntimeReferenceType(input)
return &out, nil
}

type IntegrationRuntimeType string

const (
Expand Down
Loading
Loading