const ( // DefaultBaseURI is the default URI used for the service Policy DefaultBaseURI = "https://management.azure.com" )
func UserAgent() string
UserAgent returns the UserAgent string to use when sending http.Requests.
func Version() string
Version returns the semantic version (see http://semver.org) of the client.
Assignment the policy assignment.
type Assignment struct { autorest.Response `json:"-"` // AssignmentProperties - Properties for the policy assignment. *AssignmentProperties `json:"properties,omitempty"` // ID - The ID of the policy assignment. ID *string `json:"id,omitempty"` // Type - The type of the policy assignment. Type *string `json:"type,omitempty"` // Name - The name of the policy assignment. Name *string `json:"name,omitempty"` }
func (a Assignment) MarshalJSON() ([]byte, error)
MarshalJSON is the custom marshaler for Assignment.
func (a *Assignment) UnmarshalJSON(body []byte) error
UnmarshalJSON is the custom unmarshaler for Assignment struct.
AssignmentListResult list of policy assignments.
type AssignmentListResult struct { autorest.Response `json:"-"` // Value - An array of policy assignments. Value *[]Assignment `json:"value,omitempty"` // NextLink - The URL to use for getting the next set of results. NextLink *string `json:"nextLink,omitempty"` }
func (alr AssignmentListResult) IsEmpty() bool
IsEmpty returns true if the ListResult contains no values.
AssignmentListResultIterator provides access to a complete listing of Assignment values.
type AssignmentListResultIterator struct {
// contains filtered or unexported fields
}
func NewAssignmentListResultIterator(page AssignmentListResultPage) AssignmentListResultIterator
Creates a new instance of the AssignmentListResultIterator type.
func (iter *AssignmentListResultIterator) Next() error
Next advances to the next value. If there was an error making the request the iterator does not advance and the error is returned. Deprecated: Use NextWithContext() instead.
func (iter *AssignmentListResultIterator) NextWithContext(ctx context.Context) (err error)
NextWithContext advances to the next value. If there was an error making the request the iterator does not advance and the error is returned.
func (iter AssignmentListResultIterator) NotDone() bool
NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AssignmentListResultIterator) Response() AssignmentListResult
Response returns the raw server response from the last page request.
func (iter AssignmentListResultIterator) Value() Assignment
Value returns the current value or a zero-initialized value if the iterator has advanced beyond the end of the collection.
AssignmentListResultPage contains a page of Assignment values.
type AssignmentListResultPage struct {
// contains filtered or unexported fields
}
func NewAssignmentListResultPage(cur AssignmentListResult, getNextPage func(context.Context, AssignmentListResult) (AssignmentListResult, error)) AssignmentListResultPage
Creates a new instance of the AssignmentListResultPage type.
func (page *AssignmentListResultPage) Next() error
Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned. Deprecated: Use NextWithContext() instead.
func (page *AssignmentListResultPage) NextWithContext(ctx context.Context) (err error)
NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.
func (page AssignmentListResultPage) NotDone() bool
NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AssignmentListResultPage) Response() AssignmentListResult
Response returns the raw server response from the last page request.
func (page AssignmentListResultPage) Values() []Assignment
Values returns the slice of values for the current page or nil if there are no values.
AssignmentProperties the policy assignment properties.
type AssignmentProperties struct { // DisplayName - The display name of the policy assignment. DisplayName *string `json:"displayName,omitempty"` // PolicyDefinitionID - The ID of the policy definition. PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` // Scope - The scope for the policy assignment. Scope *string `json:"scope,omitempty"` }
AssignmentsClient is the to manage and control access to your resources, you can define customized policies and assign them at a scope.
type AssignmentsClient struct { BaseClient }
func NewAssignmentsClient(subscriptionID string) AssignmentsClient
NewAssignmentsClient creates an instance of the AssignmentsClient client.
func NewAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsClient
NewAssignmentsClientWithBaseURI creates an instance of the AssignmentsClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func (client AssignmentsClient) Create(ctx context.Context, scope string, policyAssignmentName string, parameters Assignment) (result Assignment, err error)
Create policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. Parameters: scope - the scope of the policy assignment. policyAssignmentName - the name of the policy assignment. parameters - parameters for the policy assignment.
func (client AssignmentsClient) CreateByID(ctx context.Context, policyAssignmentID string, parameters Assignment) (result Assignment, err error)
CreateByID policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. Parameters: policyAssignmentID - the ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. parameters - parameters for policy assignment.
func (client AssignmentsClient) CreateByIDPreparer(ctx context.Context, policyAssignmentID string, parameters Assignment) (*http.Request, error)
CreateByIDPreparer prepares the CreateByID request.
func (client AssignmentsClient) CreateByIDResponder(resp *http.Response) (result Assignment, err error)
CreateByIDResponder handles the response to the CreateByID request. The method always closes the http.Response Body.
func (client AssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error)
CreateByIDSender sends the CreateByID request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) CreatePreparer(ctx context.Context, scope string, policyAssignmentName string, parameters Assignment) (*http.Request, error)
CreatePreparer prepares the Create request.
func (client AssignmentsClient) CreateResponder(resp *http.Response) (result Assignment, err error)
CreateResponder handles the response to the Create request. The method always closes the http.Response Body.
func (client AssignmentsClient) CreateSender(req *http.Request) (*http.Response, error)
CreateSender sends the Create request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) Delete(ctx context.Context, scope string, policyAssignmentName string) (result Assignment, err error)
Delete deletes a policy assignment. Parameters: scope - the scope of the policy assignment. policyAssignmentName - the name of the policy assignment to delete.
func (client AssignmentsClient) DeleteByID(ctx context.Context, policyAssignmentID string) (result Assignment, err error)
DeleteByID when providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. Parameters: policyAssignmentID - the ID of the policy assignment to delete. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.
func (client AssignmentsClient) DeleteByIDPreparer(ctx context.Context, policyAssignmentID string) (*http.Request, error)
DeleteByIDPreparer prepares the DeleteByID request.
func (client AssignmentsClient) DeleteByIDResponder(resp *http.Response) (result Assignment, err error)
DeleteByIDResponder handles the response to the DeleteByID request. The method always closes the http.Response Body.
func (client AssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error)
DeleteByIDSender sends the DeleteByID request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) DeletePreparer(ctx context.Context, scope string, policyAssignmentName string) (*http.Request, error)
DeletePreparer prepares the Delete request.
func (client AssignmentsClient) DeleteResponder(resp *http.Response) (result Assignment, err error)
DeleteResponder handles the response to the Delete request. The method always closes the http.Response Body.
func (client AssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error)
DeleteSender sends the Delete request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) Get(ctx context.Context, scope string, policyAssignmentName string) (result Assignment, err error)
Get gets a policy assignment. Parameters: scope - the scope of the policy assignment. policyAssignmentName - the name of the policy assignment to get.
func (client AssignmentsClient) GetByID(ctx context.Context, policyAssignmentID string) (result Assignment, err error)
GetByID when providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. Parameters: policyAssignmentID - the ID of the policy assignment to get. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'.
func (client AssignmentsClient) GetByIDPreparer(ctx context.Context, policyAssignmentID string) (*http.Request, error)
GetByIDPreparer prepares the GetByID request.
func (client AssignmentsClient) GetByIDResponder(resp *http.Response) (result Assignment, err error)
GetByIDResponder handles the response to the GetByID request. The method always closes the http.Response Body.
func (client AssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error)
GetByIDSender sends the GetByID request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) GetPreparer(ctx context.Context, scope string, policyAssignmentName string) (*http.Request, error)
GetPreparer prepares the Get request.
func (client AssignmentsClient) GetResponder(resp *http.Response) (result Assignment, err error)
GetResponder handles the response to the Get request. The method always closes the http.Response Body.
func (client AssignmentsClient) GetSender(req *http.Request) (*http.Response, error)
GetSender sends the Get request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) List(ctx context.Context, filter string) (result AssignmentListResultPage, err error)
List gets all the policy assignments for a subscription. Parameters: filter - the filter to apply on the operation.
func (client AssignmentsClient) ListComplete(ctx context.Context, filter string) (result AssignmentListResultIterator, err error)
ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client AssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result AssignmentListResultPage, err error)
ListForResource gets policy assignments for a resource. Parameters: resourceGroupName - the name of the resource group containing the resource. The name is case insensitive. resourceProviderNamespace - the namespace of the resource provider. parentResourcePath - the parent resource path. resourceType - the resource type. resourceName - the name of the resource with policy assignments. filter - the filter to apply on the operation.
func (client AssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result AssignmentListResultIterator, err error)
ListForResourceComplete enumerates all values, automatically crossing page boundaries as required.
func (client AssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result AssignmentListResultPage, err error)
ListForResourceGroup gets policy assignments for the resource group. Parameters: resourceGroupName - the name of the resource group that contains policy assignments. filter - the filter to apply on the operation.
func (client AssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result AssignmentListResultIterator, err error)
ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
func (client AssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error)
ListForResourceGroupPreparer prepares the ListForResourceGroup request.
func (client AssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result AssignmentListResult, err error)
ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always closes the http.Response Body.
func (client AssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error)
ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error)
ListForResourcePreparer prepares the ListForResource request.
func (client AssignmentsClient) ListForResourceResponder(resp *http.Response) (result AssignmentListResult, err error)
ListForResourceResponder handles the response to the ListForResource request. The method always closes the http.Response Body.
func (client AssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error)
ListForResourceSender sends the ListForResource request. The method will close the http.Response Body if it receives an error.
func (client AssignmentsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error)
ListPreparer prepares the List request.
func (client AssignmentsClient) ListResponder(resp *http.Response) (result AssignmentListResult, err error)
ListResponder handles the response to the List request. The method always closes the http.Response Body.
func (client AssignmentsClient) ListSender(req *http.Request) (*http.Response, error)
ListSender sends the List request. The method will close the http.Response Body if it receives an error.
BaseClient is the base client for Policy.
type BaseClient struct { autorest.Client BaseURI string SubscriptionID string }
func New(subscriptionID string) BaseClient
New creates an instance of the BaseClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient
NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
Definition the policy definition.
type Definition struct { autorest.Response `json:"-"` // DefinitionProperties - The policy definition properties. *DefinitionProperties `json:"properties,omitempty"` // ID - READ-ONLY; The ID of the policy definition. ID *string `json:"id,omitempty"` // Name - The name of the policy definition. If you do not specify a value for name, the value is inferred from the name value in the request URI. Name *string `json:"name,omitempty"` }
func (d Definition) MarshalJSON() ([]byte, error)
MarshalJSON is the custom marshaler for Definition.
func (d *Definition) UnmarshalJSON(body []byte) error
UnmarshalJSON is the custom unmarshaler for Definition struct.
DefinitionListResult list of policy definitions.
type DefinitionListResult struct { autorest.Response `json:"-"` // Value - An array of policy definitions. Value *[]Definition `json:"value,omitempty"` // NextLink - The URL to use for getting the next set of results. NextLink *string `json:"nextLink,omitempty"` }
func (dlr DefinitionListResult) IsEmpty() bool
IsEmpty returns true if the ListResult contains no values.
DefinitionListResultIterator provides access to a complete listing of Definition values.
type DefinitionListResultIterator struct {
// contains filtered or unexported fields
}
func NewDefinitionListResultIterator(page DefinitionListResultPage) DefinitionListResultIterator
Creates a new instance of the DefinitionListResultIterator type.
func (iter *DefinitionListResultIterator) Next() error
Next advances to the next value. If there was an error making the request the iterator does not advance and the error is returned. Deprecated: Use NextWithContext() instead.
func (iter *DefinitionListResultIterator) NextWithContext(ctx context.Context) (err error)
NextWithContext advances to the next value. If there was an error making the request the iterator does not advance and the error is returned.
func (iter DefinitionListResultIterator) NotDone() bool
NotDone returns true if the enumeration should be started or is not yet complete.
func (iter DefinitionListResultIterator) Response() DefinitionListResult
Response returns the raw server response from the last page request.
func (iter DefinitionListResultIterator) Value() Definition
Value returns the current value or a zero-initialized value if the iterator has advanced beyond the end of the collection.
DefinitionListResultPage contains a page of Definition values.
type DefinitionListResultPage struct {
// contains filtered or unexported fields
}
func NewDefinitionListResultPage(cur DefinitionListResult, getNextPage func(context.Context, DefinitionListResult) (DefinitionListResult, error)) DefinitionListResultPage
Creates a new instance of the DefinitionListResultPage type.
func (page *DefinitionListResultPage) Next() error
Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned. Deprecated: Use NextWithContext() instead.
func (page *DefinitionListResultPage) NextWithContext(ctx context.Context) (err error)
NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.
func (page DefinitionListResultPage) NotDone() bool
NotDone returns true if the page enumeration should be started or is not yet complete.
func (page DefinitionListResultPage) Response() DefinitionListResult
Response returns the raw server response from the last page request.
func (page DefinitionListResultPage) Values() []Definition
Values returns the slice of values for the current page or nil if there are no values.
DefinitionProperties the policy definition properties.
type DefinitionProperties struct { // PolicyType - The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' PolicyType Type `json:"policyType,omitempty"` // DisplayName - The display name of the policy definition. DisplayName *string `json:"displayName,omitempty"` // Description - The policy definition description. Description *string `json:"description,omitempty"` // PolicyRule - The policy rule. PolicyRule interface{} `json:"policyRule,omitempty"` }
DefinitionsClient is the to manage and control access to your resources, you can define customized policies and assign them at a scope.
type DefinitionsClient struct { BaseClient }
func NewDefinitionsClient(subscriptionID string) DefinitionsClient
NewDefinitionsClient creates an instance of the DefinitionsClient client.
func NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient
NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func (client DefinitionsClient) CreateOrUpdate(ctx context.Context, policyDefinitionName string, parameters Definition) (result Definition, err error)
CreateOrUpdate creates or updates a policy definition. Parameters: policyDefinitionName - the name of the policy definition to create. parameters - the policy definition properties.
func (client DefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, policyDefinitionName string, parameters Definition) (*http.Request, error)
CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client DefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result Definition, err error)
CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always closes the http.Response Body.
func (client DefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error)
CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the http.Response Body if it receives an error.
func (client DefinitionsClient) Delete(ctx context.Context, policyDefinitionName string) (result autorest.Response, err error)
Delete deletes a policy definition. Parameters: policyDefinitionName - the name of the policy definition to delete.
func (client DefinitionsClient) DeletePreparer(ctx context.Context, policyDefinitionName string) (*http.Request, error)
DeletePreparer prepares the Delete request.
func (client DefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error)
DeleteResponder handles the response to the Delete request. The method always closes the http.Response Body.
func (client DefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error)
DeleteSender sends the Delete request. The method will close the http.Response Body if it receives an error.
func (client DefinitionsClient) Get(ctx context.Context, policyDefinitionName string) (result Definition, err error)
Get gets the policy definition. Parameters: policyDefinitionName - the name of the policy definition to get.
func (client DefinitionsClient) GetPreparer(ctx context.Context, policyDefinitionName string) (*http.Request, error)
GetPreparer prepares the Get request.
func (client DefinitionsClient) GetResponder(resp *http.Response) (result Definition, err error)
GetResponder handles the response to the Get request. The method always closes the http.Response Body.
func (client DefinitionsClient) GetSender(req *http.Request) (*http.Response, error)
GetSender sends the Get request. The method will close the http.Response Body if it receives an error.
func (client DefinitionsClient) List(ctx context.Context, filter string) (result DefinitionListResultPage, err error)
List gets all the policy definitions for a subscription. Parameters: filter - the filter to apply on the operation.
func (client DefinitionsClient) ListComplete(ctx context.Context, filter string) (result DefinitionListResultIterator, err error)
ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client DefinitionsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error)
ListPreparer prepares the List request.
func (client DefinitionsClient) ListResponder(resp *http.Response) (result DefinitionListResult, err error)
ListResponder handles the response to the List request. The method always closes the http.Response Body.
func (client DefinitionsClient) ListSender(req *http.Request) (*http.Response, error)
ListSender sends the List request. The method will close the http.Response Body if it receives an error.
Type enumerates the values for type.
type Type string
const ( // BuiltIn ... BuiltIn Type = "BuiltIn" // Custom ... Custom Type = "Custom" // NotSpecified ... NotSpecified Type = "NotSpecified" )
func PossibleTypeValues() []Type
PossibleTypeValues returns an array of possible values for the Type const type.