Skip to content

Commit

Permalink
Updating based on 3d7c3159
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Mar 20, 2024
1 parent 1e3a56f commit b84de29
Show file tree
Hide file tree
Showing 910 changed files with 34,630 additions and 268 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package credentials

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

type ManagedIdentityTypeProperties struct {
ResourceId *string `json:"resourceId,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package credentials

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

type SystemAssignedManagedIdentityCredential struct {
Annotations *[]interface{} `json:"annotations,omitempty"`
Description *string `json:"description,omitempty"`
Type string `json:"type"`
TypeProperties *ManagedIdentityTypeProperties `json:"typeProperties,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package credentials

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

type UserAssignedManagedIdentityCredential struct {
Annotations *[]interface{} `json:"annotations,omitempty"`
Description *string `json:"description,omitempty"`
Type string `json:"type"`
TypeProperties ManagedIdentityTypeProperties `json:"typeProperties"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,44 @@ 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
124 changes: 124 additions & 0 deletions resource-manager/datafactory/2018-06-01/dataflows/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package dataflows

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 DataFlowReferenceType string

const (
DataFlowReferenceTypeDataFlowReference DataFlowReferenceType = "DataFlowReference"
)

func PossibleValuesForDataFlowReferenceType() []string {
return []string{
string(DataFlowReferenceTypeDataFlowReference),
}
}

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

func parseDataFlowReferenceType(input string) (*DataFlowReferenceType, error) {
vals := map[string]DataFlowReferenceType{
"dataflowreference": DataFlowReferenceTypeDataFlowReference,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type DatasetReferenceType string

const (
DatasetReferenceTypeDatasetReference DatasetReferenceType = "DatasetReference"
)

func PossibleValuesForDatasetReferenceType() []string {
return []string{
string(DatasetReferenceTypeDatasetReference),
}
}

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

func parseDatasetReferenceType(input string) (*DatasetReferenceType, error) {
vals := map[string]DatasetReferenceType{
"datasetreference": DatasetReferenceTypeDatasetReference,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

type Type string

const (
TypeLinkedServiceReference Type = "LinkedServiceReference"
)

func PossibleValuesForType() []string {
return []string{
string(TypeLinkedServiceReference),
}
}

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

func parseType(input string) (*Type, error) {
vals := map[string]Type{
"linkedservicereference": TypeLinkedServiceReference,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

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

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 DataFlow struct {
Annotations *[]interface{} `json:"annotations,omitempty"`
Description *string `json:"description,omitempty"`
Folder *DataFlowFolder `json:"folder,omitempty"`
Type string `json:"type"`
type DataFlow interface {
}

// RawDataFlowImpl 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 RawDataFlowImpl struct {
Type string
Values map[string]interface{}
}

func unmarshalDataFlowImplementation(input []byte) (DataFlow, 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 DataFlow into map[string]interface: %+v", err)
}

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

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

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

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

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package dataflows

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

type DataFlowReference struct {
DatasetParameters *interface{} `json:"datasetParameters,omitempty"`
Parameters *map[string]interface{} `json:"parameters,omitempty"`
ReferenceName string `json:"referenceName"`
Type DataFlowReferenceType `json:"type"`
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package dataflows

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.

Expand All @@ -10,3 +15,32 @@ type DataFlowResource struct {
Properties DataFlow `json:"properties"`
Type *string `json:"type,omitempty"`
}

var _ json.Unmarshaler = &DataFlowResource{}

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

s.Etag = decoded.Etag
s.Id = decoded.Id
s.Name = decoded.Name
s.Type = decoded.Type

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

if v, ok := temp["properties"]; ok {
impl, err := unmarshalDataFlowImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'Properties' for 'DataFlowResource': %+v", err)
}
s.Properties = impl
}
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dataflows

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

type DataFlowSink struct {
Dataset *DatasetReference `json:"dataset,omitempty"`
Description *string `json:"description,omitempty"`
Flowlet *DataFlowReference `json:"flowlet,omitempty"`
LinkedService *LinkedServiceReference `json:"linkedService,omitempty"`
Name string `json:"name"`
RejectedDataLinkedService *LinkedServiceReference `json:"rejectedDataLinkedService,omitempty"`
SchemaLinkedService *LinkedServiceReference `json:"schemaLinkedService,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dataflows

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

type DataFlowSource struct {
Dataset *DatasetReference `json:"dataset,omitempty"`
Description *string `json:"description,omitempty"`
Flowlet *DataFlowReference `json:"flowlet,omitempty"`
LinkedService *LinkedServiceReference `json:"linkedService,omitempty"`
Name string `json:"name"`
SchemaLinkedService *LinkedServiceReference `json:"schemaLinkedService,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package dataflows

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

type DatasetReference struct {
Parameters *map[string]interface{} `json:"parameters,omitempty"`
ReferenceName string `json:"referenceName"`
Type DatasetReferenceType `json:"type"`
}
Loading

0 comments on commit b84de29

Please sign in to comment.