Skip to content
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
4 changes: 2 additions & 2 deletions resource-manager/cognitive/2024-10-01/usages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ client.Client.Authorizer = authorizer
ctx := context.TODO()
id := usages.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName")

// alternatively `client.List(ctx, id, usages.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, usages.DefaultListOperationOptions())
// alternatively `client.List(ctx, id)` can be used to do batched pagination
items, err := client.ListComplete(ctx, id)
if err != nil {
// handle the error
}
Expand Down
45 changes: 8 additions & 37 deletions resource-manager/cognitive/2024-10-01/usages/method_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,6 @@ type ListCompleteResult struct {
Items []Usage
}

type ListOperationOptions struct {
Filter *string
}

func DefaultListOperationOptions() ListOperationOptions {
return ListOperationOptions{}
}

func (o ListOperationOptions) ToHeaders() *client.Headers {
out := client.Headers{}

return &out
}

func (o ListOperationOptions) ToOData() *odata.Query {
out := odata.Query{}

return &out
}

func (o ListOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}
if o.Filter != nil {
out.Append("$filter", fmt.Sprintf("%v", *o.Filter))
}
return &out
}

type ListCustomPager struct {
NextLink *odata.Link `json:"nextLink"`
}
Expand All @@ -64,16 +36,15 @@ func (p *ListCustomPager) NextPageLink() *odata.Link {
}

// List ...
func (c UsagesClient) List(ctx context.Context, id LocationId, options ListOperationOptions) (result ListOperationResponse, err error) {
func (c UsagesClient) List(ctx context.Context, id LocationId) (result ListOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
OptionsObject: options,
Pager: &ListCustomPager{},
Path: fmt.Sprintf("%s/usages", id.ID()),
HttpMethod: http.MethodGet,
Pager: &ListCustomPager{},
Path: fmt.Sprintf("%s/usages", id.ID()),
}

req, err := c.Client.NewRequest(ctx, opts)
Expand Down Expand Up @@ -104,15 +75,15 @@ func (c UsagesClient) List(ctx context.Context, id LocationId, options ListOpera
}

// ListComplete retrieves all the results into a single object
func (c UsagesClient) ListComplete(ctx context.Context, id LocationId, options ListOperationOptions) (ListCompleteResult, error) {
return c.ListCompleteMatchingPredicate(ctx, id, options, UsageOperationPredicate{})
func (c UsagesClient) ListComplete(ctx context.Context, id LocationId) (ListCompleteResult, error) {
return c.ListCompleteMatchingPredicate(ctx, id, UsageOperationPredicate{})
}

// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate
func (c UsagesClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListOperationOptions, predicate UsageOperationPredicate) (result ListCompleteResult, err error) {
func (c UsagesClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate UsageOperationPredicate) (result ListCompleteResult, err error) {
items := make([]Usage, 0)

resp, err := c.List(ctx, id, options)
resp, err := c.List(ctx, id)
if err != nil {
result.LatestHttpResponse = resp.HttpResponse
err = fmt.Errorf("loading results: %+v", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package dataflowdebugsession

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 @@ -16,57 +11,8 @@ type GreenplumLinkedServiceTypeProperties struct {
Database *interface{} `json:"database,omitempty"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Host *interface{} `json:"host,omitempty"`
Password SecretBase `json:"password"`
Port *int64 `json:"port,omitempty"`
Pwd *AzureKeyVaultSecretReference `json:"pwd,omitempty"`
SslMode *int64 `json:"sslMode,omitempty"`
Username *interface{} `json:"username,omitempty"`
}

var _ json.Unmarshaler = &GreenplumLinkedServiceTypeProperties{}

func (s *GreenplumLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error {
var decoded struct {
AuthenticationType *GreenplumAuthenticationType `json:"authenticationType,omitempty"`
CommandTimeout *int64 `json:"commandTimeout,omitempty"`
ConnectionString *interface{} `json:"connectionString,omitempty"`
ConnectionTimeout *int64 `json:"connectionTimeout,omitempty"`
Database *interface{} `json:"database,omitempty"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Host *interface{} `json:"host,omitempty"`
Port *int64 `json:"port,omitempty"`
Pwd *AzureKeyVaultSecretReference `json:"pwd,omitempty"`
SslMode *int64 `json:"sslMode,omitempty"`
Username *interface{} `json:"username,omitempty"`
}
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}

s.AuthenticationType = decoded.AuthenticationType
s.CommandTimeout = decoded.CommandTimeout
s.ConnectionString = decoded.ConnectionString
s.ConnectionTimeout = decoded.ConnectionTimeout
s.Database = decoded.Database
s.EncryptedCredential = decoded.EncryptedCredential
s.Host = decoded.Host
s.Port = decoded.Port
s.Pwd = decoded.Pwd
s.SslMode = decoded.SslMode
s.Username = decoded.Username

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

if v, ok := temp["password"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'Password' for 'GreenplumLinkedServiceTypeProperties': %+v", err)
}
s.Password = impl
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,33 @@ import (
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type Office365LinkedServiceTypeProperties struct {
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalKey SecretBase `json:"servicePrincipalKey"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalCredentialType *interface{} `json:"servicePrincipalCredentialType,omitempty"`
ServicePrincipalEmbeddedCert SecretBase `json:"servicePrincipalEmbeddedCert"`
ServicePrincipalEmbeddedCertPassword SecretBase `json:"servicePrincipalEmbeddedCertPassword"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalKey SecretBase `json:"servicePrincipalKey"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
}

var _ json.Unmarshaler = &Office365LinkedServiceTypeProperties{}

func (s *Office365LinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error {
var decoded struct {
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalCredentialType *interface{} `json:"servicePrincipalCredentialType,omitempty"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
}
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}

s.EncryptedCredential = decoded.EncryptedCredential
s.Office365TenantId = decoded.Office365TenantId
s.ServicePrincipalCredentialType = decoded.ServicePrincipalCredentialType
s.ServicePrincipalId = decoded.ServicePrincipalId
s.ServicePrincipalTenantId = decoded.ServicePrincipalTenantId

Expand All @@ -39,6 +44,22 @@ func (s *Office365LinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error
return fmt.Errorf("unmarshaling Office365LinkedServiceTypeProperties into map[string]json.RawMessage: %+v", err)
}

if v, ok := temp["servicePrincipalEmbeddedCert"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ServicePrincipalEmbeddedCert' for 'Office365LinkedServiceTypeProperties': %+v", err)
}
s.ServicePrincipalEmbeddedCert = impl
}

if v, ok := temp["servicePrincipalEmbeddedCertPassword"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ServicePrincipalEmbeddedCertPassword' for 'Office365LinkedServiceTypeProperties': %+v", err)
}
s.ServicePrincipalEmbeddedCertPassword = impl
}

if v, ok := temp["servicePrincipalKey"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type SnowflakeLinkedV2ServiceTypeProperties struct {
Password SecretBase `json:"password"`
PrivateKey SecretBase `json:"privateKey"`
PrivateKeyPassphrase SecretBase `json:"privateKeyPassphrase"`
Role *interface{} `json:"role,omitempty"`
Schema *interface{} `json:"schema,omitempty"`
Scope *interface{} `json:"scope,omitempty"`
TenantId *interface{} `json:"tenantId,omitempty"`
User *interface{} `json:"user,omitempty"`
Expand All @@ -35,6 +37,8 @@ func (s *SnowflakeLinkedV2ServiceTypeProperties) UnmarshalJSON(bytes []byte) err
Database interface{} `json:"database"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Host *interface{} `json:"host,omitempty"`
Role *interface{} `json:"role,omitempty"`
Schema *interface{} `json:"schema,omitempty"`
Scope *interface{} `json:"scope,omitempty"`
TenantId *interface{} `json:"tenantId,omitempty"`
User *interface{} `json:"user,omitempty"`
Expand All @@ -50,6 +54,8 @@ func (s *SnowflakeLinkedV2ServiceTypeProperties) UnmarshalJSON(bytes []byte) err
s.Database = decoded.Database
s.EncryptedCredential = decoded.EncryptedCredential
s.Host = decoded.Host
s.Role = decoded.Role
s.Schema = decoded.Schema
s.Scope = decoded.Scope
s.TenantId = decoded.TenantId
s.User = decoded.User
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package linkedservices

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 @@ -16,57 +11,8 @@ type GreenplumLinkedServiceTypeProperties struct {
Database *interface{} `json:"database,omitempty"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Host *interface{} `json:"host,omitempty"`
Password SecretBase `json:"password"`
Port *int64 `json:"port,omitempty"`
Pwd *AzureKeyVaultSecretReference `json:"pwd,omitempty"`
SslMode *int64 `json:"sslMode,omitempty"`
Username *interface{} `json:"username,omitempty"`
}

var _ json.Unmarshaler = &GreenplumLinkedServiceTypeProperties{}

func (s *GreenplumLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error {
var decoded struct {
AuthenticationType *GreenplumAuthenticationType `json:"authenticationType,omitempty"`
CommandTimeout *int64 `json:"commandTimeout,omitempty"`
ConnectionString *interface{} `json:"connectionString,omitempty"`
ConnectionTimeout *int64 `json:"connectionTimeout,omitempty"`
Database *interface{} `json:"database,omitempty"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Host *interface{} `json:"host,omitempty"`
Port *int64 `json:"port,omitempty"`
Pwd *AzureKeyVaultSecretReference `json:"pwd,omitempty"`
SslMode *int64 `json:"sslMode,omitempty"`
Username *interface{} `json:"username,omitempty"`
}
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}

s.AuthenticationType = decoded.AuthenticationType
s.CommandTimeout = decoded.CommandTimeout
s.ConnectionString = decoded.ConnectionString
s.ConnectionTimeout = decoded.ConnectionTimeout
s.Database = decoded.Database
s.EncryptedCredential = decoded.EncryptedCredential
s.Host = decoded.Host
s.Port = decoded.Port
s.Pwd = decoded.Pwd
s.SslMode = decoded.SslMode
s.Username = decoded.Username

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

if v, ok := temp["password"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'Password' for 'GreenplumLinkedServiceTypeProperties': %+v", err)
}
s.Password = impl
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,33 @@ import (
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type Office365LinkedServiceTypeProperties struct {
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalKey SecretBase `json:"servicePrincipalKey"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalCredentialType *interface{} `json:"servicePrincipalCredentialType,omitempty"`
ServicePrincipalEmbeddedCert SecretBase `json:"servicePrincipalEmbeddedCert"`
ServicePrincipalEmbeddedCertPassword SecretBase `json:"servicePrincipalEmbeddedCertPassword"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalKey SecretBase `json:"servicePrincipalKey"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
}

var _ json.Unmarshaler = &Office365LinkedServiceTypeProperties{}

func (s *Office365LinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error {
var decoded struct {
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
EncryptedCredential *string `json:"encryptedCredential,omitempty"`
Office365TenantId interface{} `json:"office365TenantId"`
ServicePrincipalCredentialType *interface{} `json:"servicePrincipalCredentialType,omitempty"`
ServicePrincipalId interface{} `json:"servicePrincipalId"`
ServicePrincipalTenantId interface{} `json:"servicePrincipalTenantId"`
}
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}

s.EncryptedCredential = decoded.EncryptedCredential
s.Office365TenantId = decoded.Office365TenantId
s.ServicePrincipalCredentialType = decoded.ServicePrincipalCredentialType
s.ServicePrincipalId = decoded.ServicePrincipalId
s.ServicePrincipalTenantId = decoded.ServicePrincipalTenantId

Expand All @@ -39,6 +44,22 @@ func (s *Office365LinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error
return fmt.Errorf("unmarshaling Office365LinkedServiceTypeProperties into map[string]json.RawMessage: %+v", err)
}

if v, ok := temp["servicePrincipalEmbeddedCert"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ServicePrincipalEmbeddedCert' for 'Office365LinkedServiceTypeProperties': %+v", err)
}
s.ServicePrincipalEmbeddedCert = impl
}

if v, ok := temp["servicePrincipalEmbeddedCertPassword"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ServicePrincipalEmbeddedCertPassword' for 'Office365LinkedServiceTypeProperties': %+v", err)
}
s.ServicePrincipalEmbeddedCertPassword = impl
}

if v, ok := temp["servicePrincipalKey"]; ok {
impl, err := UnmarshalSecretBaseImplementation(v)
if err != nil {
Expand Down
Loading
Loading