policies

package
v0.20240125.1115017 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MPL-2.0 Imports: 12 Imported by: 1

README

github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies Documentation

The policies SDK allows for interaction with the Azure Resource Manager Service devtestlab (API Version 2018-09-15).

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-sdk/resource-manager/devtestlab/2018-09-15/policies"

Client Initialization

client := policies.NewPoliciesClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer

Example Usage: PoliciesClient.CreateOrUpdate

ctx := context.TODO()
id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue")

payload := policies.Policy{
	// ...
}


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

Example Usage: PoliciesClient.Delete

ctx := context.TODO()
id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue")

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: PoliciesClient.Get

ctx := context.TODO()
id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue")

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

Example Usage: PoliciesClient.List

ctx := context.TODO()
id := policies.NewPolicySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue")

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

Example Usage: PoliciesClient.Update

ctx := context.TODO()
id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue")

payload := policies.UpdateResource{
	// ...
}


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
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PossibleValuesForPolicyEvaluatorType

func PossibleValuesForPolicyEvaluatorType() []string

func PossibleValuesForPolicyFactName

func PossibleValuesForPolicyFactName() []string

func PossibleValuesForPolicyStatus

func PossibleValuesForPolicyStatus() []string

func ValidatePolicyID

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

ValidatePolicyID checks that 'input' can be parsed as a Policy ID

func ValidatePolicySetID

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

ValidatePolicySetID checks that 'input' can be parsed as a Policy Set ID

Types

type CreateOrUpdateOperationResponse

type CreateOrUpdateOperationResponse struct {
	HttpResponse *http.Response
	OData        *odata.OData
	Model        *Policy
}

type DeleteOperationResponse

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

type GetOperationOptions

type GetOperationOptions struct {
	Expand *string
}

func DefaultGetOperationOptions

func DefaultGetOperationOptions() GetOperationOptions

func (GetOperationOptions) ToHeaders

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

func (GetOperationOptions) ToOData

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

func (GetOperationOptions) ToQuery

func (o GetOperationOptions) ToQuery() *client.QueryParams

type GetOperationResponse

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

type ListCompleteResult

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

type ListOperationOptions

type ListOperationOptions struct {
	Expand  *string
	Filter  *string
	Orderby *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        *[]Policy
}

type PoliciesClient

type PoliciesClient struct {
	Client *resourcemanager.Client
}

func NewPoliciesClientWithBaseURI

func NewPoliciesClientWithBaseURI(sdkApi sdkEnv.Api) (*PoliciesClient, error)

func (PoliciesClient) CreateOrUpdate

func (c PoliciesClient) CreateOrUpdate(ctx context.Context, id PolicyId, input Policy) (result CreateOrUpdateOperationResponse, err error)

CreateOrUpdate ...

func (PoliciesClient) Delete

func (c PoliciesClient) Delete(ctx context.Context, id PolicyId) (result DeleteOperationResponse, err error)

Delete ...

func (PoliciesClient) Get

Get ...

func (PoliciesClient) List

List ...

func (PoliciesClient) ListComplete

ListComplete retrieves all the results into a single object

func (PoliciesClient) ListCompleteMatchingPredicate

func (c PoliciesClient) ListCompleteMatchingPredicate(ctx context.Context, id PolicySetId, options ListOperationOptions, predicate PolicyOperationPredicate) (result ListCompleteResult, err error)

ListCompleteMatchingPredicate retrieves all the results and then applies the predicate

func (PoliciesClient) Update

func (c PoliciesClient) Update(ctx context.Context, id PolicyId, input UpdateResource) (result UpdateOperationResponse, err error)

Update ...

type Policy

type Policy struct {
	Id         *string            `json:"id,omitempty"`
	Location   *string            `json:"location,omitempty"`
	Name       *string            `json:"name,omitempty"`
	Properties PolicyProperties   `json:"properties"`
	Tags       *map[string]string `json:"tags,omitempty"`
	Type       *string            `json:"type,omitempty"`
}

type PolicyEvaluatorType

type PolicyEvaluatorType string
const (
	PolicyEvaluatorTypeAllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy"
	PolicyEvaluatorTypeMaxValuePolicy      PolicyEvaluatorType = "MaxValuePolicy"
)

func (*PolicyEvaluatorType) UnmarshalJSON

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

type PolicyFactName

type PolicyFactName string
const (
	PolicyFactNameEnvironmentTemplate         PolicyFactName = "EnvironmentTemplate"
	PolicyFactNameGalleryImage                PolicyFactName = "GalleryImage"
	PolicyFactNameLabPremiumVMCount           PolicyFactName = "LabPremiumVmCount"
	PolicyFactNameLabTargetCost               PolicyFactName = "LabTargetCost"
	PolicyFactNameLabVMCount                  PolicyFactName = "LabVmCount"
	PolicyFactNameLabVMSize                   PolicyFactName = "LabVmSize"
	PolicyFactNameScheduleEditPermission      PolicyFactName = "ScheduleEditPermission"
	PolicyFactNameUserOwnedLabPremiumVMCount  PolicyFactName = "UserOwnedLabPremiumVmCount"
	PolicyFactNameUserOwnedLabVMCount         PolicyFactName = "UserOwnedLabVmCount"
	PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet"
)

func (*PolicyFactName) UnmarshalJSON

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

type PolicyId

type PolicyId struct {
	SubscriptionId    string
	ResourceGroupName string
	LabName           string
	PolicySetName     string
	PolicyName        string
}

PolicyId is a struct representing the Resource ID for a Policy

func NewPolicyID

func NewPolicyID(subscriptionId string, resourceGroupName string, labName string, policySetName string, policyName string) PolicyId

NewPolicyID returns a new PolicyId struct

func ParsePolicyID

func ParsePolicyID(input string) (*PolicyId, error)

ParsePolicyID parses 'input' into a PolicyId

func ParsePolicyIDInsensitively

func ParsePolicyIDInsensitively(input string) (*PolicyId, error)

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

func (*PolicyId) FromParseResult

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

func (PolicyId) ID

func (id PolicyId) ID() string

ID returns the formatted Policy ID

func (PolicyId) Segments

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

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

func (PolicyId) String

func (id PolicyId) String() string

String returns a human-readable description of this Policy ID

type PolicyOperationPredicate

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

func (PolicyOperationPredicate) Matches

func (p PolicyOperationPredicate) Matches(input Policy) bool

type PolicyProperties

type PolicyProperties struct {
	CreatedDate       *string              `json:"createdDate,omitempty"`
	Description       *string              `json:"description,omitempty"`
	EvaluatorType     *PolicyEvaluatorType `json:"evaluatorType,omitempty"`
	FactData          *string              `json:"factData,omitempty"`
	FactName          *PolicyFactName      `json:"factName,omitempty"`
	ProvisioningState *string              `json:"provisioningState,omitempty"`
	Status            *PolicyStatus        `json:"status,omitempty"`
	Threshold         *string              `json:"threshold,omitempty"`
	UniqueIdentifier  *string              `json:"uniqueIdentifier,omitempty"`
}

func (*PolicyProperties) GetCreatedDateAsTime

func (o *PolicyProperties) GetCreatedDateAsTime() (*time.Time, error)

func (*PolicyProperties) SetCreatedDateAsTime

func (o *PolicyProperties) SetCreatedDateAsTime(input time.Time)

type PolicySetId

type PolicySetId struct {
	SubscriptionId    string
	ResourceGroupName string
	LabName           string
	PolicySetName     string
}

PolicySetId is a struct representing the Resource ID for a Policy Set

func NewPolicySetID

func NewPolicySetID(subscriptionId string, resourceGroupName string, labName string, policySetName string) PolicySetId

NewPolicySetID returns a new PolicySetId struct

func ParsePolicySetID

func ParsePolicySetID(input string) (*PolicySetId, error)

ParsePolicySetID parses 'input' into a PolicySetId

func ParsePolicySetIDInsensitively

func ParsePolicySetIDInsensitively(input string) (*PolicySetId, error)

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

func (*PolicySetId) FromParseResult

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

func (PolicySetId) ID

func (id PolicySetId) ID() string

ID returns the formatted Policy Set ID

func (PolicySetId) Segments

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

Segments returns a slice of Resource ID Segments which comprise this Policy Set ID

func (PolicySetId) String

func (id PolicySetId) String() string

String returns a human-readable description of this Policy Set ID

type PolicyStatus

type PolicyStatus string
const (
	PolicyStatusDisabled PolicyStatus = "Disabled"
	PolicyStatusEnabled  PolicyStatus = "Enabled"
)

func (*PolicyStatus) UnmarshalJSON

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

type UpdateOperationResponse

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

type UpdateResource

type UpdateResource struct {
	Tags *map[string]string `json:"tags,omitempty"`
}

Jump to

Keyboard shortcuts

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