policies

package
v0.20230203.1144443 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MPL-2.0 Imports: 10 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
	Model        *Policy
}

type DeleteOperationResponse

type DeleteOperationResponse struct {
	HttpResponse *http.Response
}

type GetOperationOptions

type GetOperationOptions struct {
	Expand *string
}

func DefaultGetOperationOptions

func DefaultGetOperationOptions() GetOperationOptions

type GetOperationResponse

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

type ListCompleteResult

type ListCompleteResult struct {
	Items []Policy
}

type ListOperationOptions

type ListOperationOptions struct {
	Expand  *string
	Filter  *string
	Orderby *string
	Top     *int64
}

func DefaultListOperationOptions

func DefaultListOperationOptions() ListOperationOptions

type ListOperationResponse

type ListOperationResponse struct {
	HttpResponse *http.Response
	Model        *[]Policy
	// contains filtered or unexported fields
}

func (ListOperationResponse) HasMore

func (r ListOperationResponse) HasMore() bool

func (ListOperationResponse) LoadMore

func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error)

type PoliciesClient

type PoliciesClient struct {
	Client autorest.Client
	// contains filtered or unexported fields
}

func NewPoliciesClientWithBaseURI

func NewPoliciesClientWithBaseURI(endpoint string) PoliciesClient

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 of the results into a single object

func (PoliciesClient) ListCompleteMatchingPredicate

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

ListCompleteMatchingPredicate retrieves all of the results and then applied 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"
)

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"
)

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) 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) 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"
)

type UpdateOperationResponse

type UpdateOperationResponse struct {
	HttpResponse *http.Response
	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