policyassignments

package
v0.20240906.1232634 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: MPL-2.0 Imports: 14 Imported by: 1

README

github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-06-01/policyassignments Documentation

The policyassignments SDK allows for interaction with the Azure Resource Manager Service resources (API Version 2022-06-01).

This readme covers example usages, but further information on using this SDK can be found in the project root.

Import Path

import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-06-01/policyassignments"

Client Initialization

client := policyassignments.NewPolicyAssignmentsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: PolicyAssignmentsClient.Create

ctx := context.TODO()
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue")

payload := policyassignments.PolicyAssignment{
	// ...
}


read, err := client.Create(ctx, id, payload)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.CreateById

ctx := context.TODO()
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue")

payload := policyassignments.PolicyAssignment{
	// ...
}


read, err := client.CreateById(ctx, id, payload)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.Delete

ctx := context.TODO()
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue")

read, err := client.Delete(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.DeleteById

ctx := context.TODO()
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue")

read, err := client.DeleteById(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.Get

ctx := context.TODO()
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue")

read, err := client.Get(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.GetById

ctx := context.TODO()
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue")

read, err := client.GetById(ctx, id)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.List

ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

// alternatively `client.List(ctx, id, policyassignments.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, policyassignments.DefaultListOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: PolicyAssignmentsClient.ListForManagementGroup

ctx := context.TODO()
id := commonids.NewManagementGroupID("groupIdValue")

// alternatively `client.ListForManagementGroup(ctx, id, policyassignments.DefaultListForManagementGroupOperationOptions())` can be used to do batched pagination
items, err := client.ListForManagementGroupComplete(ctx, id, policyassignments.DefaultListForManagementGroupOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: PolicyAssignmentsClient.ListForResource

ctx := context.TODO()
id := commonids.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group")

// alternatively `client.ListForResource(ctx, id, policyassignments.DefaultListForResourceOperationOptions())` can be used to do batched pagination
items, err := client.ListForResourceComplete(ctx, id, policyassignments.DefaultListForResourceOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: PolicyAssignmentsClient.ListForResourceGroup

ctx := context.TODO()
id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group")

// alternatively `client.ListForResourceGroup(ctx, id, policyassignments.DefaultListForResourceGroupOperationOptions())` can be used to do batched pagination
items, err := client.ListForResourceGroupComplete(ctx, id, policyassignments.DefaultListForResourceGroupOperationOptions())
if err != nil {
	// handle the error
}
for _, item := range items {
	// do something
}

Example Usage: PolicyAssignmentsClient.Update

ctx := context.TODO()
id := policyassignments.NewScopedPolicyAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "policyAssignmentValue")

payload := policyassignments.PolicyAssignmentUpdate{
	// ...
}


read, err := client.Update(ctx, id, payload)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Example Usage: PolicyAssignmentsClient.UpdateById

ctx := context.TODO()
id := policyassignments.NewPolicyAssignmentIdID("policyAssignmentIdValue")

payload := policyassignments.PolicyAssignmentUpdate{
	// ...
}


read, err := client.UpdateById(ctx, id, payload)
if err != nil {
	// handle the error
}
if model := read.Model; model != nil {
	// do something with the model/response object
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PossibleValuesForEnforcementMode

func PossibleValuesForEnforcementMode() []string

func PossibleValuesForOverrideKind

func PossibleValuesForOverrideKind() []string

func PossibleValuesForSelectorKind

func PossibleValuesForSelectorKind() []string

func ValidatePolicyAssignmentIdID

func ValidatePolicyAssignmentIdID(input interface{}, key string) (warnings []string, errors []error)

ValidatePolicyAssignmentIdID checks that 'input' can be parsed as a Policy Assignment Id ID

func ValidateScopedPolicyAssignmentID

func ValidateScopedPolicyAssignmentID(input interface{}, key string) (warnings []string, errors []error)

ValidateScopedPolicyAssignmentID checks that 'input' can be parsed as a Scoped Policy Assignment ID

Types

type CreateByIdOperationResponse

type CreateByIdOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type CreateOperationResponse

type CreateOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type DeleteByIdOperationResponse

type DeleteByIdOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type DeleteOperationResponse

type DeleteOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type EnforcementMode

type EnforcementMode string
const (
	EnforcementModeDefault      EnforcementMode = "Default"
	EnforcementModeDoNotEnforce EnforcementMode = "DoNotEnforce"
)

func (*EnforcementMode) UnmarshalJSON

func (s *EnforcementMode) UnmarshalJSON(bytes []byte) error

type GetByIdOperationResponse

type GetByIdOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type GetOperationResponse

type GetOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type ListCompleteResult

type ListCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []PolicyAssignment
}

type ListCustomPager added in v0.20240628.1153531

type ListCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListCustomPager) NextPageLink() *odata.Link

type ListForManagementGroupCompleteResult

type ListForManagementGroupCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []PolicyAssignment
}

type ListForManagementGroupCustomPager added in v0.20240628.1153531

type ListForManagementGroupCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListForManagementGroupCustomPager) NextPageLink() *odata.Link

type ListForManagementGroupOperationOptions

type ListForManagementGroupOperationOptions struct {
	Filter *string
	Top    *int64
}

func DefaultListForManagementGroupOperationOptions

func DefaultListForManagementGroupOperationOptions() ListForManagementGroupOperationOptions

func (ListForManagementGroupOperationOptions) ToHeaders

func (ListForManagementGroupOperationOptions) ToOData

func (ListForManagementGroupOperationOptions) ToQuery

type ListForManagementGroupOperationResponse

type ListForManagementGroupOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]PolicyAssignment
}

type ListForResourceCompleteResult

type ListForResourceCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []PolicyAssignment
}

type ListForResourceCustomPager added in v0.20240628.1153531

type ListForResourceCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListForResourceCustomPager) NextPageLink() *odata.Link

type ListForResourceGroupCompleteResult

type ListForResourceGroupCompleteResult struct {
	LatestHttpResponse *http.Response
	Items              []PolicyAssignment
}

type ListForResourceGroupCustomPager added in v0.20240628.1153531

type ListForResourceGroupCustomPager struct {
	NextLink *odata.Link `json:"nextLink"`
}
func (p *ListForResourceGroupCustomPager) NextPageLink() *odata.Link

type ListForResourceGroupOperationOptions

type ListForResourceGroupOperationOptions struct {
	Filter *string
	Top    *int64
}

func DefaultListForResourceGroupOperationOptions

func DefaultListForResourceGroupOperationOptions() ListForResourceGroupOperationOptions

func (ListForResourceGroupOperationOptions) ToHeaders

func (ListForResourceGroupOperationOptions) ToOData

func (ListForResourceGroupOperationOptions) ToQuery

type ListForResourceGroupOperationResponse

type ListForResourceGroupOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]PolicyAssignment
}

type ListForResourceOperationOptions

type ListForResourceOperationOptions struct {
	Filter *string
	Top    *int64
}

func DefaultListForResourceOperationOptions

func DefaultListForResourceOperationOptions() ListForResourceOperationOptions

func (ListForResourceOperationOptions) ToHeaders

func (ListForResourceOperationOptions) ToOData

func (ListForResourceOperationOptions) ToQuery

type ListForResourceOperationResponse

type ListForResourceOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]PolicyAssignment
}

type ListOperationOptions

type ListOperationOptions struct {
	Filter *string
	Top    *int64
}

func DefaultListOperationOptions

func DefaultListOperationOptions() ListOperationOptions

func (ListOperationOptions) ToHeaders

func (o ListOperationOptions) ToHeaders() *client.Headers

func (ListOperationOptions) ToOData

func (o ListOperationOptions) ToOData() *odata.Query

func (ListOperationOptions) ToQuery

type ListOperationResponse

type ListOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *[]PolicyAssignment
}

type NonComplianceMessage

type NonComplianceMessage struct {
	Message                     string  `json:"message"`
	PolicyDefinitionReferenceId *string `json:"policyDefinitionReferenceId,omitempty"`
}

type Override

type Override struct {
	Kind      *OverrideKind `json:"kind,omitempty"`
	Selectors *[]Selector   `json:"selectors,omitempty"`
	Value     *string       `json:"value,omitempty"`
}

type OverrideKind

type OverrideKind string
const (
	OverrideKindPolicyEffect OverrideKind = "policyEffect"
)

func (*OverrideKind) UnmarshalJSON

func (s *OverrideKind) UnmarshalJSON(bytes []byte) error

type ParameterValuesValue

type ParameterValuesValue struct {
	Value *interface{} `json:"value,omitempty"`
}

type PolicyAssignment

type PolicyAssignment struct {
	Id         *string                           `json:"id,omitempty"`
	Identity   *identity.SystemOrUserAssignedMap `json:"identity,omitempty"`
	Location   *string                           `json:"location,omitempty"`
	Name       *string                           `json:"name,omitempty"`
	Properties *PolicyAssignmentProperties       `json:"properties,omitempty"`
	SystemData *systemdata.SystemData            `json:"systemData,omitempty"`
	Type       *string                           `json:"type,omitempty"`
}

type PolicyAssignmentIdId

type PolicyAssignmentIdId struct {
	PolicyAssignmentId string
}

PolicyAssignmentIdId is a struct representing the Resource ID for a Policy Assignment Id

func NewPolicyAssignmentIdID

func NewPolicyAssignmentIdID(policyAssignmentId string) PolicyAssignmentIdId

NewPolicyAssignmentIdID returns a new PolicyAssignmentIdId struct

func ParsePolicyAssignmentIdID

func ParsePolicyAssignmentIdID(input string) (*PolicyAssignmentIdId, error)

ParsePolicyAssignmentIdID parses 'input' into a PolicyAssignmentIdId

func ParsePolicyAssignmentIdIDInsensitively

func ParsePolicyAssignmentIdIDInsensitively(input string) (*PolicyAssignmentIdId, error)

ParsePolicyAssignmentIdIDInsensitively parses 'input' case-insensitively into a PolicyAssignmentIdId note: this method should only be used for API response data and not user input

func (*PolicyAssignmentIdId) FromParseResult

func (id *PolicyAssignmentIdId) FromParseResult(input resourceids.ParseResult) error

func (PolicyAssignmentIdId) ID

func (id PolicyAssignmentIdId) ID() string

ID returns the formatted Policy Assignment Id ID

func (PolicyAssignmentIdId) Segments

func (id PolicyAssignmentIdId) Segments() []resourceids.Segment

Segments returns a slice of Resource ID Segments which comprise this Policy Assignment Id ID

func (PolicyAssignmentIdId) String

func (id PolicyAssignmentIdId) String() string

String returns a human-readable description of this Policy Assignment Id ID

type PolicyAssignmentOperationPredicate

type PolicyAssignmentOperationPredicate struct {
	Id       *string
	Location *string
	Name     *string
	Type     *string
}

func (PolicyAssignmentOperationPredicate) Matches

type PolicyAssignmentProperties

type PolicyAssignmentProperties struct {
	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"`
}

type PolicyAssignmentUpdate

type PolicyAssignmentUpdate struct {
	Identity   *identity.SystemOrUserAssignedMap `json:"identity,omitempty"`
	Location   *string                           `json:"location,omitempty"`
	Properties *PolicyAssignmentUpdateProperties `json:"properties,omitempty"`
}

type PolicyAssignmentUpdateProperties

type PolicyAssignmentUpdateProperties struct {
	Overrides         *[]Override         `json:"overrides,omitempty"`
	ResourceSelectors *[]ResourceSelector `json:"resourceSelectors,omitempty"`
}

type PolicyAssignmentsClient

type PolicyAssignmentsClient struct {
	Client *resourcemanager.Client
}

func NewPolicyAssignmentsClientWithBaseURI

func NewPolicyAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*PolicyAssignmentsClient, error)

func (PolicyAssignmentsClient) Create

Create ...

func (PolicyAssignmentsClient) CreateById

CreateById ...

func (PolicyAssignmentsClient) Delete

Delete ...

func (PolicyAssignmentsClient) DeleteById

DeleteById ...

func (PolicyAssignmentsClient) Get

Get ...

func (PolicyAssignmentsClient) GetById

GetById ...

func (PolicyAssignmentsClient) List

List ...

func (PolicyAssignmentsClient) ListComplete

ListComplete retrieves all the results into a single object

func (PolicyAssignmentsClient) ListCompleteMatchingPredicate

func (c PolicyAssignmentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions, predicate PolicyAssignmentOperationPredicate) (result ListCompleteResult, err error)

ListCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (PolicyAssignmentsClient) ListForManagementGroup

ListForManagementGroup ...

func (PolicyAssignmentsClient) ListForManagementGroupComplete

ListForManagementGroupComplete retrieves all the results into a single object

func (PolicyAssignmentsClient) ListForManagementGroupCompleteMatchingPredicate

ListForManagementGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (PolicyAssignmentsClient) ListForResource

ListForResource ...

func (PolicyAssignmentsClient) ListForResourceComplete

ListForResourceComplete retrieves all the results into a single object

func (PolicyAssignmentsClient) ListForResourceCompleteMatchingPredicate

func (c PolicyAssignmentsClient) ListForResourceCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, options ListForResourceOperationOptions, predicate PolicyAssignmentOperationPredicate) (result ListForResourceCompleteResult, err error)

ListForResourceCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (PolicyAssignmentsClient) ListForResourceGroup

ListForResourceGroup ...

func (PolicyAssignmentsClient) ListForResourceGroupComplete

ListForResourceGroupComplete retrieves all the results into a single object

func (PolicyAssignmentsClient) ListForResourceGroupCompleteMatchingPredicate

ListForResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (PolicyAssignmentsClient) Update

Update ...

func (PolicyAssignmentsClient) UpdateById

UpdateById ...

type ResourceSelector

type ResourceSelector struct {
	Name      *string     `json:"name,omitempty"`
	Selectors *[]Selector `json:"selectors,omitempty"`
}

type ScopedPolicyAssignmentId

type ScopedPolicyAssignmentId struct {
	Scope                string
	PolicyAssignmentName string
}

ScopedPolicyAssignmentId is a struct representing the Resource ID for a Scoped Policy Assignment

func NewScopedPolicyAssignmentID

func NewScopedPolicyAssignmentID(scope string, policyAssignmentName string) ScopedPolicyAssignmentId

NewScopedPolicyAssignmentID returns a new ScopedPolicyAssignmentId struct

func ParseScopedPolicyAssignmentID

func ParseScopedPolicyAssignmentID(input string) (*ScopedPolicyAssignmentId, error)

ParseScopedPolicyAssignmentID parses 'input' into a ScopedPolicyAssignmentId

func ParseScopedPolicyAssignmentIDInsensitively

func ParseScopedPolicyAssignmentIDInsensitively(input string) (*ScopedPolicyAssignmentId, error)

ParseScopedPolicyAssignmentIDInsensitively parses 'input' case-insensitively into a ScopedPolicyAssignmentId note: this method should only be used for API response data and not user input

func (*ScopedPolicyAssignmentId) FromParseResult

func (id *ScopedPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error

func (ScopedPolicyAssignmentId) ID

ID returns the formatted Scoped Policy Assignment ID

func (ScopedPolicyAssignmentId) Segments

Segments returns a slice of Resource ID Segments which comprise this Scoped Policy Assignment ID

func (ScopedPolicyAssignmentId) String

func (id ScopedPolicyAssignmentId) String() string

String returns a human-readable description of this Scoped Policy Assignment ID

type Selector

type Selector struct {
	In    *[]string     `json:"in,omitempty"`
	Kind  *SelectorKind `json:"kind,omitempty"`
	NotIn *[]string     `json:"notIn,omitempty"`
}

type SelectorKind

type SelectorKind string
const (
	SelectorKindPolicyDefinitionReferenceId SelectorKind = "policyDefinitionReferenceId"
	SelectorKindResourceLocation            SelectorKind = "resourceLocation"
	SelectorKindResourceType                SelectorKind = "resourceType"
	SelectorKindResourceWithoutLocation     SelectorKind = "resourceWithoutLocation"
)

func (*SelectorKind) UnmarshalJSON

func (s *SelectorKind) UnmarshalJSON(bytes []byte) error

type UpdateByIdOperationResponse

type UpdateByIdOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

type UpdateOperationResponse

type UpdateOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *PolicyAssignment
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL