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 (724e2f1c151fafc46f35bb76a8640806be047900) #633

Merged
merged 1 commit into from
Aug 24, 2023
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 @@ -288,6 +288,44 @@ func parseRehydrationPriority(input string) (*RehydrationPriority, error) {
return &out, nil
}

type ResourcePropertiesObjectType string

const (
ResourcePropertiesObjectTypeDefaultResourceProperties ResourcePropertiesObjectType = "DefaultResourceProperties"
)

func PossibleValuesForResourcePropertiesObjectType() []string {
return []string{
string(ResourcePropertiesObjectTypeDefaultResourceProperties),
}
}

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

func parseResourcePropertiesObjectType(input string) (*ResourcePropertiesObjectType, error) {
vals := map[string]ResourcePropertiesObjectType{
"defaultresourceproperties": ResourcePropertiesObjectTypeDefaultResourceProperties,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type RestoreTargetLocationType string

const (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
package backupinstances

import (
"encoding/json"
"fmt"
"strings"
)

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

type BaseResourceProperties struct {
ObjectType string `json:"objectType"`
type BaseResourceProperties interface {
}

// RawModeOfTransitImpl is returned when the Discriminated Value
// doesn't match any of the defined types
// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround)
// and is used only for Deserialization (e.g. this cannot be used as a Request Payload).
type RawBaseResourcePropertiesImpl struct {
Type string
Values map[string]interface{}
}

func unmarshalBaseResourcePropertiesImplementation(input []byte) (BaseResourceProperties, error) {
if input == nil {
return nil, nil
}

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

value, ok := temp["objectType"].(string)
if !ok {
return nil, nil
}

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

out := RawBaseResourcePropertiesImpl{
Type: value,
Values: temp,
}
return out, nil

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
package backupinstances

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.

type Datasource struct {
DatasourceType *string `json:"datasourceType,omitempty"`
ObjectType *string `json:"objectType,omitempty"`
ResourceID string `json:"resourceID"`
ResourceLocation *string `json:"resourceLocation,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
ResourceProperties *BaseResourceProperties `json:"resourceProperties,omitempty"`
ResourceType *string `json:"resourceType,omitempty"`
ResourceUri *string `json:"resourceUri,omitempty"`
DatasourceType *string `json:"datasourceType,omitempty"`
ObjectType *string `json:"objectType,omitempty"`
ResourceID string `json:"resourceID"`
ResourceLocation *string `json:"resourceLocation,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
ResourceProperties BaseResourceProperties `json:"resourceProperties"`
ResourceType *string `json:"resourceType,omitempty"`
ResourceUri *string `json:"resourceUri,omitempty"`
}

var _ json.Unmarshaler = &Datasource{}

func (s *Datasource) UnmarshalJSON(bytes []byte) error {
type alias Datasource
var decoded alias
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling into Datasource: %+v", err)
}

s.DatasourceType = decoded.DatasourceType
s.ObjectType = decoded.ObjectType
s.ResourceID = decoded.ResourceID
s.ResourceLocation = decoded.ResourceLocation
s.ResourceName = decoded.ResourceName
s.ResourceType = decoded.ResourceType
s.ResourceUri = decoded.ResourceUri

var temp map[string]json.RawMessage
if err := json.Unmarshal(bytes, &temp); err != nil {
return fmt.Errorf("unmarshaling Datasource into map[string]json.RawMessage: %+v", err)
}

if v, ok := temp["resourceProperties"]; ok {
impl, err := unmarshalBaseResourcePropertiesImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ResourceProperties' for 'Datasource': %+v", err)
}
s.ResourceProperties = impl
}
return nil
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
package backupinstances

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.

type DatasourceSet struct {
DatasourceType *string `json:"datasourceType,omitempty"`
ObjectType *string `json:"objectType,omitempty"`
ResourceID string `json:"resourceID"`
ResourceLocation *string `json:"resourceLocation,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
ResourceProperties *BaseResourceProperties `json:"resourceProperties,omitempty"`
ResourceType *string `json:"resourceType,omitempty"`
ResourceUri *string `json:"resourceUri,omitempty"`
DatasourceType *string `json:"datasourceType,omitempty"`
ObjectType *string `json:"objectType,omitempty"`
ResourceID string `json:"resourceID"`
ResourceLocation *string `json:"resourceLocation,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
ResourceProperties BaseResourceProperties `json:"resourceProperties"`
ResourceType *string `json:"resourceType,omitempty"`
ResourceUri *string `json:"resourceUri,omitempty"`
}

var _ json.Unmarshaler = &DatasourceSet{}

func (s *DatasourceSet) UnmarshalJSON(bytes []byte) error {
type alias DatasourceSet
var decoded alias
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling into DatasourceSet: %+v", err)
}

s.DatasourceType = decoded.DatasourceType
s.ObjectType = decoded.ObjectType
s.ResourceID = decoded.ResourceID
s.ResourceLocation = decoded.ResourceLocation
s.ResourceName = decoded.ResourceName
s.ResourceType = decoded.ResourceType
s.ResourceUri = decoded.ResourceUri

var temp map[string]json.RawMessage
if err := json.Unmarshal(bytes, &temp); err != nil {
return fmt.Errorf("unmarshaling DatasourceSet into map[string]json.RawMessage: %+v", err)
}

if v, ok := temp["resourceProperties"]; ok {
impl, err := unmarshalBaseResourcePropertiesImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ResourceProperties' for 'DatasourceSet': %+v", err)
}
s.ResourceProperties = impl
}
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package backupinstances

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 _ BaseResourceProperties = DefaultResourceProperties{}

type DefaultResourceProperties struct {

// Fields inherited from BaseResourceProperties
}

var _ json.Marshaler = DefaultResourceProperties{}

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

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

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

return encoded, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,44 @@ func parseDataStoreTypes(input string) (*DataStoreTypes, error) {
return &out, nil
}

type ResourcePropertiesObjectType string

const (
ResourcePropertiesObjectTypeDefaultResourceProperties ResourcePropertiesObjectType = "DefaultResourceProperties"
)

func PossibleValuesForResourcePropertiesObjectType() []string {
return []string{
string(ResourcePropertiesObjectTypeDefaultResourceProperties),
}
}

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

func parseResourcePropertiesObjectType(input string) (*ResourcePropertiesObjectType, error) {
vals := map[string]ResourcePropertiesObjectType{
"defaultresourceproperties": ResourcePropertiesObjectTypeDefaultResourceProperties,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type SecretStoreType string

const (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
package deletedbackupinstances

import (
"encoding/json"
"fmt"
"strings"
)

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

type BaseResourceProperties struct {
ObjectType string `json:"objectType"`
type BaseResourceProperties interface {
}

// RawModeOfTransitImpl is returned when the Discriminated Value
// doesn't match any of the defined types
// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround)
// and is used only for Deserialization (e.g. this cannot be used as a Request Payload).
type RawBaseResourcePropertiesImpl struct {
Type string
Values map[string]interface{}
}

func unmarshalBaseResourcePropertiesImplementation(input []byte) (BaseResourceProperties, error) {
if input == nil {
return nil, nil
}

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

value, ok := temp["objectType"].(string)
if !ok {
return nil, nil
}

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

out := RawBaseResourcePropertiesImpl{
Type: value,
Values: temp,
}
return out, nil

}
Loading