Skip to content

Commit

Permalink
Updating based on 24300efe2
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Nov 26, 2024
1 parent 2c82270 commit d48e77c
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if model := read.Model; model != nil {
ctx := context.TODO()
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentName")

read, err := client.Get(ctx, id)
read, err := client.Get(ctx, id, policyassignments.DefaultGetOperationOptions())
if err != nil {
// handle the error
}
Expand All @@ -117,7 +117,7 @@ if model := read.Model; model != nil {
ctx := context.TODO()
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentId")

read, err := client.GetById(ctx, id)
read, err := client.GetById(ctx, id, policyassignments.DefaultGetByIdOperationOptions())
if err != nil {
// handle the error
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package policyassignments

import (
"context"
"fmt"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
Expand All @@ -17,15 +18,44 @@ type GetOperationResponse struct {
Model *PolicyAssignment
}

type GetOperationOptions struct {
Expand *string
}

func DefaultGetOperationOptions() GetOperationOptions {
return GetOperationOptions{}
}

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

return &out
}

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

return &out
}

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

// Get ...
func (c PolicyAssignmentsClient) Get(ctx context.Context, id ScopedPolicyAssignmentId) (result GetOperationResponse, err error) {
func (c PolicyAssignmentsClient) Get(ctx context.Context, id ScopedPolicyAssignmentId, options GetOperationOptions) (result GetOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
Path: id.ID(),
HttpMethod: http.MethodGet,
OptionsObject: options,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package policyassignments

import (
"context"
"fmt"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
Expand All @@ -17,15 +18,44 @@ type GetByIdOperationResponse struct {
Model *PolicyAssignment
}

type GetByIdOperationOptions struct {
Expand *string
}

func DefaultGetByIdOperationOptions() GetByIdOperationOptions {
return GetByIdOperationOptions{}
}

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

return &out
}

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

return &out
}

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

// GetById ...
func (c PolicyAssignmentsClient) GetById(ctx context.Context, id PolicyAssignmentIdId) (result GetByIdOperationResponse, err error) {
func (c PolicyAssignmentsClient) GetById(ctx context.Context, id PolicyAssignmentIdId, options GetByIdOperationOptions) (result GetByIdOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
Path: id.ID(),
HttpMethod: http.MethodGet,
OptionsObject: options,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ListCompleteResult struct {
}

type ListOperationOptions struct {
Expand *string
Filter *string
Top *int64
}
Expand All @@ -47,6 +48,9 @@ func (o ListOperationOptions) ToOData() *odata.Query {

func (o ListOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}
if o.Expand != nil {
out.Append("$expand", fmt.Sprintf("%v", *o.Expand))
}
if o.Filter != nil {
out.Append("$filter", fmt.Sprintf("%v", *o.Filter))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ListForManagementGroupCompleteResult struct {
}

type ListForManagementGroupOperationOptions struct {
Expand *string
Filter *string
Top *int64
}
Expand All @@ -47,6 +48,9 @@ func (o ListForManagementGroupOperationOptions) ToOData() *odata.Query {

func (o ListForManagementGroupOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}
if o.Expand != nil {
out.Append("$expand", fmt.Sprintf("%v", *o.Expand))
}
if o.Filter != nil {
out.Append("$filter", fmt.Sprintf("%v", *o.Filter))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ListForResourceCompleteResult struct {
}

type ListForResourceOperationOptions struct {
Expand *string
Filter *string
Top *int64
}
Expand All @@ -47,6 +48,9 @@ func (o ListForResourceOperationOptions) ToOData() *odata.Query {

func (o ListForResourceOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}
if o.Expand != nil {
out.Append("$expand", fmt.Sprintf("%v", *o.Expand))
}
if o.Filter != nil {
out.Append("$filter", fmt.Sprintf("%v", *o.Filter))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ListForResourceGroupCompleteResult struct {
}

type ListForResourceGroupOperationOptions struct {
Expand *string
Filter *string
Top *int64
}
Expand All @@ -47,6 +48,9 @@ func (o ListForResourceGroupOperationOptions) ToOData() *odata.Query {

func (o ListForResourceGroupOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}
if o.Expand != nil {
out.Append("$expand", fmt.Sprintf("%v", *o.Expand))
}
if o.Filter != nil {
out.Append("$filter", fmt.Sprintf("%v", *o.Filter))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ package policyassignments
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type PolicyAssignmentProperties struct {
AssignmentType *AssignmentType `json:"assignmentType,omitempty"`
DefinitionVersion *string `json:"definitionVersion,omitempty"`
Description *string `json:"description,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
EnforcementMode *EnforcementMode `json:"enforcementMode,omitempty"`
Metadata *interface{} `json:"metadata,omitempty"`
NonComplianceMessages *[]NonComplianceMessage `json:"nonComplianceMessages,omitempty"`
NotScopes *[]string `json:"notScopes,omitempty"`
Overrides *[]Override `json:"overrides,omitempty"`
Parameters *map[string]ParameterValuesValue `json:"parameters,omitempty"`
PolicyDefinitionId *string `json:"policyDefinitionId,omitempty"`
ResourceSelectors *[]ResourceSelector `json:"resourceSelectors,omitempty"`
Scope *string `json:"scope,omitempty"`
AssignmentType *AssignmentType `json:"assignmentType,omitempty"`
DefinitionVersion *string `json:"definitionVersion,omitempty"`
Description *string `json:"description,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
EffectiveDefinitionVersion *string `json:"effectiveDefinitionVersion,omitempty"`
EnforcementMode *EnforcementMode `json:"enforcementMode,omitempty"`
LatestDefinitionVersion *string `json:"latestDefinitionVersion,omitempty"`
Metadata *interface{} `json:"metadata,omitempty"`
NonComplianceMessages *[]NonComplianceMessage `json:"nonComplianceMessages,omitempty"`
NotScopes *[]string `json:"notScopes,omitempty"`
Overrides *[]Override `json:"overrides,omitempty"`
Parameters *map[string]ParameterValuesValue `json:"parameters,omitempty"`
PolicyDefinitionId *string `json:"policyDefinitionId,omitempty"`
ResourceSelectors *[]ResourceSelector `json:"resourceSelectors,omitempty"`
Scope *string `json:"scope,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ package registeredserverresource
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type RegisteredServerUpdateProperties struct {
Identity *bool `json:"identity,omitempty"`
ApplicationId *string `json:"applicationId,omitempty"`
Identity *bool `json:"identity,omitempty"`
}

0 comments on commit d48e77c

Please sign in to comment.