armpolicyinsights

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 17 Imported by: 7

README

Azure Policy Insight Module for Go

PkgGoDev

The armpolicyinsights module provides operations for working with Azure Policy Insight.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Policy Insight module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Policy Insight. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Clients

Azure Policy Insight modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential.

client, err := armpolicyinsights.NewRemediationsClient(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
client, err := armpolicyinsights.NewRemediationsClient(<subscription ID>, cred, &options)

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Policy Insight label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attestation

type Attestation struct {
	// REQUIRED; Properties for the attestation.
	Properties *AttestationProperties `json:"properties,omitempty"`

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty" azure:"ro"`
}

Attestation - An attestation resource.

func (Attestation) MarshalJSON added in v0.6.0

func (a Attestation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Attestation.

func (*Attestation) UnmarshalJSON added in v0.6.0

func (a *Attestation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Attestation.

type AttestationEvidence

type AttestationEvidence struct {
	// The description for this piece of evidence.
	Description *string `json:"description,omitempty"`

	// The URI location of the evidence.
	SourceURI *string `json:"sourceUri,omitempty"`
}

AttestationEvidence - A piece of evidence supporting the compliance state set in the attestation.

func (AttestationEvidence) MarshalJSON added in v0.6.0

func (a AttestationEvidence) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AttestationEvidence.

func (*AttestationEvidence) UnmarshalJSON added in v0.6.0

func (a *AttestationEvidence) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AttestationEvidence.

type AttestationListResult

type AttestationListResult struct {
	// READ-ONLY; The URL to get the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; Array of attestation definitions.
	Value []*Attestation `json:"value,omitempty" azure:"ro"`
}

AttestationListResult - List of attestations.

func (AttestationListResult) MarshalJSON

func (a AttestationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AttestationListResult.

func (*AttestationListResult) UnmarshalJSON added in v0.6.0

func (a *AttestationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AttestationListResult.

type AttestationProperties

type AttestationProperties struct {
	// REQUIRED; The resource ID of the policy assignment that the attestation is setting the state for.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`

	// The time the evidence was assessed
	AssessmentDate *time.Time `json:"assessmentDate,omitempty"`

	// Comments describing why this attestation was created.
	Comments *string `json:"comments,omitempty"`

	// The compliance state that should be set on the resource.
	ComplianceState *ComplianceState `json:"complianceState,omitempty"`

	// The evidence supporting the compliance state set in this attestation.
	Evidence []*AttestationEvidence `json:"evidence,omitempty"`

	// The time the compliance state should expire.
	ExpiresOn *time.Time `json:"expiresOn,omitempty"`

	// Additional metadata for this attestation
	Metadata interface{} `json:"metadata,omitempty"`

	// The person responsible for setting the state of the resource. This value is typically an Azure Active Directory object
	// ID.
	Owner *string `json:"owner,omitempty"`

	// The policy definition reference ID from a policy set definition that the attestation is setting the state for. If the policy
	// assignment assigns a policy set definition the attestation can choose a
	// definition within the set definition with this property or omit this and set the state for the entire set definition.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`

	// READ-ONLY; The time the compliance state was last changed in this attestation.
	LastComplianceStateChangeAt *time.Time `json:"lastComplianceStateChangeAt,omitempty" azure:"ro"`

	// READ-ONLY; The status of the attestation.
	ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"`
}

AttestationProperties - The properties of an attestation resource.

func (AttestationProperties) MarshalJSON

func (a AttestationProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AttestationProperties.

func (*AttestationProperties) UnmarshalJSON

func (a *AttestationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AttestationProperties.

type AttestationsClient

type AttestationsClient struct {
	// contains filtered or unexported fields
}

AttestationsClient contains the methods for the Attestations group. Don't use this type directly, use NewAttestationsClient() instead.

func NewAttestationsClient

func NewAttestationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AttestationsClient, error)

NewAttestationsClient creates a new instance of AttestationsClient with the specified values. subscriptionID - Microsoft Azure subscription ID. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*AttestationsClient) BeginCreateOrUpdateAtResource

func (client *AttestationsClient) BeginCreateOrUpdateAtResource(ctx context.Context, resourceID string, attestationName string, parameters Attestation, options *AttestationsClientBeginCreateOrUpdateAtResourceOptions) (*runtime.Poller[AttestationsClientCreateOrUpdateAtResourceResponse], error)

BeginCreateOrUpdateAtResource - Creates or updates an attestation at resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceID - Resource ID. attestationName - The name of the attestation. parameters - The attestation parameters. options - AttestationsClientBeginCreateOrUpdateAtResourceOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_CreateResourceScope.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdateAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", armpolicyinsights.Attestation{
		Properties: &armpolicyinsights.AttestationProperties{
			AssessmentDate:  to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T00:00:00Z"); return t }()),
			Comments:        to.Ptr("This subscription has passed a security audit."),
			ComplianceState: to.Ptr(armpolicyinsights.ComplianceStateCompliant),
			Evidence: []*armpolicyinsights.AttestationEvidence{
				{
					Description: to.Ptr("The results of the security audit."),
					SourceURI:   to.Ptr("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"),
				}},
			ExpiresOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T00:00:00Z"); return t }()),
			Metadata: map[string]interface{}{
				"departmentId": "NYC-MARKETING-1",
			},
			Owner:                       to.Ptr("55a32e28-3aa5-4eea-9b5a-4cd85153b966"),
			PolicyAssignmentID:          to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
			PolicyDefinitionReferenceID: to.Ptr("0b158b46-ff42-4799-8e39-08a5c23b4551"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) BeginCreateOrUpdateAtResourceGroup

func (client *AttestationsClient) BeginCreateOrUpdateAtResourceGroup(ctx context.Context, resourceGroupName string, attestationName string, parameters Attestation, options *AttestationsClientBeginCreateOrUpdateAtResourceGroupOptions) (*runtime.Poller[AttestationsClientCreateOrUpdateAtResourceGroupResponse], error)

BeginCreateOrUpdateAtResourceGroup - Creates or updates an attestation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceGroupName - The name of the resource group. The name is case insensitive. attestationName - The name of the attestation. parameters - The attestation parameters. options - AttestationsClientBeginCreateOrUpdateAtResourceGroupOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_CreateResourceGroupScope.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdateAtResourceGroup(ctx, "myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", armpolicyinsights.Attestation{
		Properties: &armpolicyinsights.AttestationProperties{
			AssessmentDate:  to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T00:00:00Z"); return t }()),
			Comments:        to.Ptr("This subscription has passed a security audit."),
			ComplianceState: to.Ptr(armpolicyinsights.ComplianceStateCompliant),
			Evidence: []*armpolicyinsights.AttestationEvidence{
				{
					Description: to.Ptr("The results of the security audit."),
					SourceURI:   to.Ptr("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"),
				}},
			ExpiresOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T00:00:00Z"); return t }()),
			Metadata: map[string]interface{}{
				"departmentId": "NYC-MARKETING-1",
			},
			Owner:                       to.Ptr("55a32e28-3aa5-4eea-9b5a-4cd85153b966"),
			PolicyAssignmentID:          to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
			PolicyDefinitionReferenceID: to.Ptr("0b158b46-ff42-4799-8e39-08a5c23b4551"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) BeginCreateOrUpdateAtSubscription

BeginCreateOrUpdateAtSubscription - Creates or updates an attestation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 attestationName - The name of the attestation. parameters - The attestation parameters. options - AttestationsClientBeginCreateOrUpdateAtSubscriptionOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtSubscription method.

Example (CreateAttestationAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_CreateSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdateAtSubscription(ctx, "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", armpolicyinsights.Attestation{
		Properties: &armpolicyinsights.AttestationProperties{
			ComplianceState:    to.Ptr(armpolicyinsights.ComplianceStateCompliant),
			PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

Example (CreateAttestationAtSubscriptionScopeWithAllProperties)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_CreateSubscriptionScope_AllProperties.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginCreateOrUpdateAtSubscription(ctx, "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", armpolicyinsights.Attestation{
		Properties: &armpolicyinsights.AttestationProperties{
			AssessmentDate:  to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T00:00:00Z"); return t }()),
			Comments:        to.Ptr("This subscription has passed a security audit."),
			ComplianceState: to.Ptr(armpolicyinsights.ComplianceStateCompliant),
			Evidence: []*armpolicyinsights.AttestationEvidence{
				{
					Description: to.Ptr("The results of the security audit."),
					SourceURI:   to.Ptr("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"),
				}},
			ExpiresOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T00:00:00Z"); return t }()),
			Metadata: map[string]interface{}{
				"departmentId": "NYC-MARKETING-1",
			},
			Owner:                       to.Ptr("55a32e28-3aa5-4eea-9b5a-4cd85153b966"),
			PolicyAssignmentID:          to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
			PolicyDefinitionReferenceID: to.Ptr("0b158b46-ff42-4799-8e39-08a5c23b4551"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) DeleteAtResource

func (client *AttestationsClient) DeleteAtResource(ctx context.Context, resourceID string, attestationName string, options *AttestationsClientDeleteAtResourceOptions) (AttestationsClientDeleteAtResourceResponse, error)

DeleteAtResource - Deletes an existing attestation at individual resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceID - Resource ID. attestationName - The name of the attestation. options - AttestationsClientDeleteAtResourceOptions contains the optional parameters for the AttestationsClient.DeleteAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_DeleteResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.DeleteAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*AttestationsClient) DeleteAtResourceGroup

func (client *AttestationsClient) DeleteAtResourceGroup(ctx context.Context, resourceGroupName string, attestationName string, options *AttestationsClientDeleteAtResourceGroupOptions) (AttestationsClientDeleteAtResourceGroupResponse, error)

DeleteAtResourceGroup - Deletes an existing attestation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceGroupName - The name of the resource group. The name is case insensitive. attestationName - The name of the attestation. options - AttestationsClientDeleteAtResourceGroupOptions contains the optional parameters for the AttestationsClient.DeleteAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_DeleteResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.DeleteAtResourceGroup(ctx, "myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*AttestationsClient) DeleteAtSubscription

DeleteAtSubscription - Deletes an existing attestation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 attestationName - The name of the attestation. options - AttestationsClientDeleteAtSubscriptionOptions contains the optional parameters for the AttestationsClient.DeleteAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_DeleteSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.DeleteAtSubscription(ctx, "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*AttestationsClient) GetAtResource

func (client *AttestationsClient) GetAtResource(ctx context.Context, resourceID string, attestationName string, options *AttestationsClientGetAtResourceOptions) (AttestationsClientGetAtResourceResponse, error)

GetAtResource - Gets an existing attestation at resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceID - Resource ID. attestationName - The name of the attestation. options - AttestationsClientGetAtResourceOptions contains the optional parameters for the AttestationsClient.GetAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_GetResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) GetAtResourceGroup

func (client *AttestationsClient) GetAtResourceGroup(ctx context.Context, resourceGroupName string, attestationName string, options *AttestationsClientGetAtResourceGroupOptions) (AttestationsClientGetAtResourceGroupResponse, error)

GetAtResourceGroup - Gets an existing attestation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 resourceGroupName - The name of the resource group. The name is case insensitive. attestationName - The name of the attestation. options - AttestationsClientGetAtResourceGroupOptions contains the optional parameters for the AttestationsClient.GetAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_GetResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtResourceGroup(ctx, "myRg", "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) GetAtSubscription

GetAtSubscription - Gets an existing attestation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-09-01 attestationName - The name of the attestation. options - AttestationsClientGetAtSubscriptionOptions contains the optional parameters for the AttestationsClient.GetAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_GetSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtSubscription(ctx, "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*AttestationsClient) NewListForResourceGroupPager added in v0.4.0

func (client *AttestationsClient) NewListForResourceGroupPager(resourceGroupName string, queryOptions *QueryOptions, options *AttestationsClientListForResourceGroupOptions) *runtime.Pager[AttestationsClientListForResourceGroupResponse]

NewListForResourceGroupPager - Gets all attestations for the resource group. Generated from API version 2022-09-01 resourceGroupName - The name of the resource group. The name is case insensitive. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - AttestationsClientListForResourceGroupOptions contains the optional parameters for the AttestationsClient.ListForResourceGroup method.

Example (ListAttestationsAtResourceGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourceGroupPager("myRg", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListAttestationsAtResourceGroupScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListResourceGroupScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourceGroupPager("myRg", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*AttestationsClient) NewListForResourcePager added in v0.4.0

func (client *AttestationsClient) NewListForResourcePager(resourceID string, queryOptions *QueryOptions, options *AttestationsClientListForResourceOptions) *runtime.Pager[AttestationsClientListForResourceResponse]

NewListForResourcePager - Gets all attestations for a resource. Generated from API version 2022-09-01 resourceID - Resource ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - AttestationsClientListForResourceOptions contains the optional parameters for the AttestationsClient.ListForResource method.

Example (ListAttestationsAtIndividualResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourcePager("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListAttestationsAtIndividualResourceScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListResourceScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourcePager("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myrg/providers/microsoft.compute/virtualMachines/devVM", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*AttestationsClient) NewListForSubscriptionPager added in v0.4.0

NewListForSubscriptionPager - Gets all attestations for the subscription. Generated from API version 2022-09-01 QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - AttestationsClientListForSubscriptionOptions contains the optional parameters for the AttestationsClient.ListForSubscription method.

Example (ListAttestationsAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListAttestationsAtSubscriptionScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_ListSubscriptionScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewAttestationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq '0b158b46-ff42-4799-8e39-08a5c23b4551'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type AttestationsClientBeginCreateOrUpdateAtResourceGroupOptions

type AttestationsClientBeginCreateOrUpdateAtResourceGroupOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

AttestationsClientBeginCreateOrUpdateAtResourceGroupOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtResourceGroup method.

type AttestationsClientBeginCreateOrUpdateAtResourceOptions

type AttestationsClientBeginCreateOrUpdateAtResourceOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

AttestationsClientBeginCreateOrUpdateAtResourceOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtResource method.

type AttestationsClientBeginCreateOrUpdateAtSubscriptionOptions

type AttestationsClientBeginCreateOrUpdateAtSubscriptionOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

AttestationsClientBeginCreateOrUpdateAtSubscriptionOptions contains the optional parameters for the AttestationsClient.BeginCreateOrUpdateAtSubscription method.

type AttestationsClientCreateOrUpdateAtResourceGroupResponse

type AttestationsClientCreateOrUpdateAtResourceGroupResponse struct {
	Attestation
}

AttestationsClientCreateOrUpdateAtResourceGroupResponse contains the response from method AttestationsClient.CreateOrUpdateAtResourceGroup.

type AttestationsClientCreateOrUpdateAtResourceResponse

type AttestationsClientCreateOrUpdateAtResourceResponse struct {
	Attestation
}

AttestationsClientCreateOrUpdateAtResourceResponse contains the response from method AttestationsClient.CreateOrUpdateAtResource.

type AttestationsClientCreateOrUpdateAtSubscriptionResponse

type AttestationsClientCreateOrUpdateAtSubscriptionResponse struct {
	Attestation
}

AttestationsClientCreateOrUpdateAtSubscriptionResponse contains the response from method AttestationsClient.CreateOrUpdateAtSubscription.

type AttestationsClientDeleteAtResourceGroupOptions

type AttestationsClientDeleteAtResourceGroupOptions struct {
}

AttestationsClientDeleteAtResourceGroupOptions contains the optional parameters for the AttestationsClient.DeleteAtResourceGroup method.

type AttestationsClientDeleteAtResourceGroupResponse

type AttestationsClientDeleteAtResourceGroupResponse struct {
}

AttestationsClientDeleteAtResourceGroupResponse contains the response from method AttestationsClient.DeleteAtResourceGroup.

type AttestationsClientDeleteAtResourceOptions

type AttestationsClientDeleteAtResourceOptions struct {
}

AttestationsClientDeleteAtResourceOptions contains the optional parameters for the AttestationsClient.DeleteAtResource method.

type AttestationsClientDeleteAtResourceResponse

type AttestationsClientDeleteAtResourceResponse struct {
}

AttestationsClientDeleteAtResourceResponse contains the response from method AttestationsClient.DeleteAtResource.

type AttestationsClientDeleteAtSubscriptionOptions

type AttestationsClientDeleteAtSubscriptionOptions struct {
}

AttestationsClientDeleteAtSubscriptionOptions contains the optional parameters for the AttestationsClient.DeleteAtSubscription method.

type AttestationsClientDeleteAtSubscriptionResponse

type AttestationsClientDeleteAtSubscriptionResponse struct {
}

AttestationsClientDeleteAtSubscriptionResponse contains the response from method AttestationsClient.DeleteAtSubscription.

type AttestationsClientGetAtResourceGroupOptions

type AttestationsClientGetAtResourceGroupOptions struct {
}

AttestationsClientGetAtResourceGroupOptions contains the optional parameters for the AttestationsClient.GetAtResourceGroup method.

type AttestationsClientGetAtResourceGroupResponse

type AttestationsClientGetAtResourceGroupResponse struct {
	Attestation
}

AttestationsClientGetAtResourceGroupResponse contains the response from method AttestationsClient.GetAtResourceGroup.

type AttestationsClientGetAtResourceOptions

type AttestationsClientGetAtResourceOptions struct {
}

AttestationsClientGetAtResourceOptions contains the optional parameters for the AttestationsClient.GetAtResource method.

type AttestationsClientGetAtResourceResponse

type AttestationsClientGetAtResourceResponse struct {
	Attestation
}

AttestationsClientGetAtResourceResponse contains the response from method AttestationsClient.GetAtResource.

type AttestationsClientGetAtSubscriptionOptions

type AttestationsClientGetAtSubscriptionOptions struct {
}

AttestationsClientGetAtSubscriptionOptions contains the optional parameters for the AttestationsClient.GetAtSubscription method.

type AttestationsClientGetAtSubscriptionResponse

type AttestationsClientGetAtSubscriptionResponse struct {
	Attestation
}

AttestationsClientGetAtSubscriptionResponse contains the response from method AttestationsClient.GetAtSubscription.

type AttestationsClientListForResourceGroupOptions

type AttestationsClientListForResourceGroupOptions struct {
}

AttestationsClientListForResourceGroupOptions contains the optional parameters for the AttestationsClient.ListForResourceGroup method.

type AttestationsClientListForResourceGroupResponse

type AttestationsClientListForResourceGroupResponse struct {
	AttestationListResult
}

AttestationsClientListForResourceGroupResponse contains the response from method AttestationsClient.ListForResourceGroup.

type AttestationsClientListForResourceOptions

type AttestationsClientListForResourceOptions struct {
}

AttestationsClientListForResourceOptions contains the optional parameters for the AttestationsClient.ListForResource method.

type AttestationsClientListForResourceResponse

type AttestationsClientListForResourceResponse struct {
	AttestationListResult
}

AttestationsClientListForResourceResponse contains the response from method AttestationsClient.ListForResource.

type AttestationsClientListForSubscriptionOptions

type AttestationsClientListForSubscriptionOptions struct {
}

AttestationsClientListForSubscriptionOptions contains the optional parameters for the AttestationsClient.ListForSubscription method.

type AttestationsClientListForSubscriptionResponse

type AttestationsClientListForSubscriptionResponse struct {
	AttestationListResult
}

AttestationsClientListForSubscriptionResponse contains the response from method AttestationsClient.ListForSubscription.

type CheckManagementGroupRestrictionsRequest added in v0.3.0

type CheckManagementGroupRestrictionsRequest struct {
	// The list of fields and values that should be evaluated for potential restrictions.
	PendingFields []*PendingField `json:"pendingFields,omitempty"`

	// The information about the resource that will be evaluated.
	ResourceDetails *CheckRestrictionsResourceDetails `json:"resourceDetails,omitempty"`
}

CheckManagementGroupRestrictionsRequest - The check policy restrictions parameters describing the resource that is being evaluated.

func (CheckManagementGroupRestrictionsRequest) MarshalJSON added in v0.3.0

func (c CheckManagementGroupRestrictionsRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CheckManagementGroupRestrictionsRequest.

func (*CheckManagementGroupRestrictionsRequest) UnmarshalJSON added in v0.6.0

func (c *CheckManagementGroupRestrictionsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CheckManagementGroupRestrictionsRequest.

type CheckRestrictionsRequest

type CheckRestrictionsRequest struct {
	// REQUIRED; The information about the resource that will be evaluated.
	ResourceDetails *CheckRestrictionsResourceDetails `json:"resourceDetails,omitempty"`

	// The list of fields and values that should be evaluated for potential restrictions.
	PendingFields []*PendingField `json:"pendingFields,omitempty"`
}

CheckRestrictionsRequest - The check policy restrictions parameters describing the resource that is being evaluated.

func (CheckRestrictionsRequest) MarshalJSON

func (c CheckRestrictionsRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CheckRestrictionsRequest.

func (*CheckRestrictionsRequest) UnmarshalJSON added in v0.6.0

func (c *CheckRestrictionsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CheckRestrictionsRequest.

type CheckRestrictionsResourceDetails

type CheckRestrictionsResourceDetails struct {
	// REQUIRED; The resource content. This should include whatever properties are already known and can be a partial set of all
	// resource properties.
	ResourceContent interface{} `json:"resourceContent,omitempty"`

	// The api-version of the resource content.
	APIVersion *string `json:"apiVersion,omitempty"`

	// The scope where the resource is being created. For example, if the resource is a child resource this would be the parent
	// resource's resource ID.
	Scope *string `json:"scope,omitempty"`
}

CheckRestrictionsResourceDetails - The information about the resource that will be evaluated.

func (CheckRestrictionsResourceDetails) MarshalJSON added in v0.6.0

func (c CheckRestrictionsResourceDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CheckRestrictionsResourceDetails.

func (*CheckRestrictionsResourceDetails) UnmarshalJSON added in v0.6.0

func (c *CheckRestrictionsResourceDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CheckRestrictionsResourceDetails.

type CheckRestrictionsResult

type CheckRestrictionsResult struct {
	// READ-ONLY; Evaluation results for the provided partial resource content.
	ContentEvaluationResult *CheckRestrictionsResultContentEvaluationResult `json:"contentEvaluationResult,omitempty" azure:"ro"`

	// READ-ONLY; The restrictions that will be placed on various fields in the resource by policy.
	FieldRestrictions []*FieldRestrictions `json:"fieldRestrictions,omitempty" azure:"ro"`
}

CheckRestrictionsResult - The result of a check policy restrictions evaluation on a resource.

func (CheckRestrictionsResult) MarshalJSON

func (c CheckRestrictionsResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type CheckRestrictionsResult.

func (*CheckRestrictionsResult) UnmarshalJSON added in v0.6.0

func (c *CheckRestrictionsResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type CheckRestrictionsResult.

type CheckRestrictionsResultContentEvaluationResult

type CheckRestrictionsResultContentEvaluationResult struct {
	// Policy evaluation results against the given resource content. This will indicate if the partial content that was provided
	// will be denied as-is.
	PolicyEvaluations []*PolicyEvaluationResult `json:"policyEvaluations,omitempty"`
}

CheckRestrictionsResultContentEvaluationResult - Evaluation results for the provided partial resource content.

func (CheckRestrictionsResultContentEvaluationResult) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type CheckRestrictionsResultContentEvaluationResult.

func (*CheckRestrictionsResultContentEvaluationResult) UnmarshalJSON added in v0.6.0

UnmarshalJSON implements the json.Unmarshaller interface for type CheckRestrictionsResultContentEvaluationResult.

type ComplianceDetail

type ComplianceDetail struct {
	// The compliance state.
	ComplianceState *string `json:"complianceState,omitempty"`

	// Summarized count value for this compliance state.
	Count *int32 `json:"count,omitempty"`
}

ComplianceDetail - The compliance state rollup.

func (ComplianceDetail) MarshalJSON added in v0.6.0

func (c ComplianceDetail) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ComplianceDetail.

func (*ComplianceDetail) UnmarshalJSON added in v0.6.0

func (c *ComplianceDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceDetail.

type ComplianceState

type ComplianceState string

ComplianceState - The compliance state that should be set on the resource.

const (
	// ComplianceStateCompliant - The resource is in compliance with the policy.
	ComplianceStateCompliant ComplianceState = "Compliant"
	// ComplianceStateNonCompliant - The resource is not in compliance with the policy.
	ComplianceStateNonCompliant ComplianceState = "NonCompliant"
	// ComplianceStateUnknown - The compliance state of the resource is not known.
	ComplianceStateUnknown ComplianceState = "Unknown"
)

func PossibleComplianceStateValues

func PossibleComplianceStateValues() []ComplianceState

PossibleComplianceStateValues returns the possible values for the ComplianceState const type.

type ComponentEventDetails

type ComponentEventDetails struct {
	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]interface{}

	// Component Id.
	ID *string `json:"id,omitempty"`

	// Component name.
	Name *string `json:"name,omitempty"`

	// Policy definition action, i.e. effect.
	PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"`

	// Principal object ID for the user who initiated the resource component operation that triggered the policy event.
	PrincipalOid *string `json:"principalOid,omitempty"`

	// Tenant ID for the policy event record.
	TenantID *string `json:"tenantId,omitempty"`

	// Timestamp for component policy event record.
	Timestamp *time.Time `json:"timestamp,omitempty"`

	// Component type.
	Type *string `json:"type,omitempty"`
}

ComponentEventDetails - Component event details.

func (ComponentEventDetails) MarshalJSON

func (c ComponentEventDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ComponentEventDetails.

func (*ComponentEventDetails) UnmarshalJSON

func (c *ComponentEventDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ComponentEventDetails.

type ComponentStateDetails

type ComponentStateDetails struct {
	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]interface{}

	// Component compliance state.
	ComplianceState *string `json:"complianceState,omitempty"`

	// Component Id.
	ID *string `json:"id,omitempty"`

	// Component name.
	Name *string `json:"name,omitempty"`

	// Component compliance evaluation timestamp.
	Timestamp *time.Time `json:"timestamp,omitempty"`

	// Component type.
	Type *string `json:"type,omitempty"`
}

ComponentStateDetails - Component state details.

func (ComponentStateDetails) MarshalJSON

func (c ComponentStateDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ComponentStateDetails.

func (*ComponentStateDetails) UnmarshalJSON

func (c *ComponentStateDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ComponentStateDetails.

type CreatedByType

type CreatedByType string

CreatedByType - The type of identity that created the resource.

const (
	CreatedByTypeApplication     CreatedByType = "Application"
	CreatedByTypeKey             CreatedByType = "Key"
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	CreatedByTypeUser            CreatedByType = "User"
)

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type ErrorDefinition

type ErrorDefinition struct {
	// READ-ONLY; Additional scenario specific error details.
	AdditionalInfo []*TypedErrorInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; Internal error details.
	Details []*ErrorDefinition `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; Description of the error.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The target of the error.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorDefinition - Error definition.

func (ErrorDefinition) MarshalJSON

func (e ErrorDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDefinition.

func (*ErrorDefinition) UnmarshalJSON added in v0.6.0

func (e *ErrorDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition.

type ErrorDefinitionAutoGenerated

type ErrorDefinitionAutoGenerated struct {
	// READ-ONLY; Additional scenario specific error details.
	AdditionalInfo []*TypedErrorInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; Internal error details.
	Details []*ErrorDefinitionAutoGenerated `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; Description of the error.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The target of the error.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorDefinitionAutoGenerated - Error definition.

func (ErrorDefinitionAutoGenerated) MarshalJSON

func (e ErrorDefinitionAutoGenerated) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDefinitionAutoGenerated.

func (*ErrorDefinitionAutoGenerated) UnmarshalJSON added in v0.6.0

func (e *ErrorDefinitionAutoGenerated) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinitionAutoGenerated.

type ErrorDefinitionAutoGenerated2

type ErrorDefinitionAutoGenerated2 struct {
	// READ-ONLY; Additional scenario specific error details.
	AdditionalInfo []*TypedErrorInfo `json:"additionalInfo,omitempty" azure:"ro"`

	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; Internal error details.
	Details []*ErrorDefinitionAutoGenerated2 `json:"details,omitempty" azure:"ro"`

	// READ-ONLY; Description of the error.
	Message *string `json:"message,omitempty" azure:"ro"`

	// READ-ONLY; The target of the error.
	Target *string `json:"target,omitempty" azure:"ro"`
}

ErrorDefinitionAutoGenerated2 - Error definition.

func (ErrorDefinitionAutoGenerated2) MarshalJSON

func (e ErrorDefinitionAutoGenerated2) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorDefinitionAutoGenerated2.

func (*ErrorDefinitionAutoGenerated2) UnmarshalJSON added in v0.6.0

func (e *ErrorDefinitionAutoGenerated2) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinitionAutoGenerated2.

type ErrorResponse

type ErrorResponse struct {
	// The error details.
	Error *ErrorDefinition `json:"error,omitempty"`
}

ErrorResponse - Error response.

func (ErrorResponse) MarshalJSON added in v0.6.0

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v0.6.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type ErrorResponseAutoGenerated

type ErrorResponseAutoGenerated struct {
	// The error details.
	Error *ErrorDefinitionAutoGenerated `json:"error,omitempty"`
}

ErrorResponseAutoGenerated - Error response.

func (ErrorResponseAutoGenerated) MarshalJSON added in v0.6.0

func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated.

func (*ErrorResponseAutoGenerated) UnmarshalJSON added in v0.6.0

func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated.

type ErrorResponseAutoGenerated2

type ErrorResponseAutoGenerated2 struct {
	// The error details.
	Error *ErrorDefinitionAutoGenerated2 `json:"error,omitempty"`
}

ErrorResponseAutoGenerated2 - Error response.

func (ErrorResponseAutoGenerated2) MarshalJSON added in v0.6.0

func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2.

func (*ErrorResponseAutoGenerated2) UnmarshalJSON added in v0.6.0

func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2.

type ExpressionEvaluationDetails

type ExpressionEvaluationDetails struct {
	// Expression evaluated.
	Expression *string `json:"expression,omitempty"`

	// Value of the expression.
	ExpressionValue interface{} `json:"expressionValue,omitempty"`

	// Operator to compare the expression value and the target value.
	Operator *string `json:"operator,omitempty"`

	// Property path if the expression is a field or an alias.
	Path *string `json:"path,omitempty"`

	// Evaluation result.
	Result *string `json:"result,omitempty"`

	// Target value to be compared with the expression value.
	TargetValue interface{} `json:"targetValue,omitempty"`

	// READ-ONLY; The kind of expression that was evaluated.
	ExpressionKind *string `json:"expressionKind,omitempty" azure:"ro"`
}

ExpressionEvaluationDetails - Evaluation details of policy language expressions.

func (ExpressionEvaluationDetails) MarshalJSON added in v0.6.0

func (e ExpressionEvaluationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ExpressionEvaluationDetails.

func (*ExpressionEvaluationDetails) UnmarshalJSON added in v0.6.0

func (e *ExpressionEvaluationDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ExpressionEvaluationDetails.

type FieldRestriction

type FieldRestriction struct {
	// READ-ONLY; The value that policy will set for the field if the user does not provide a value.
	DefaultValue *string `json:"defaultValue,omitempty" azure:"ro"`

	// READ-ONLY; The details of the policy that is causing the field restriction.
	Policy *PolicyReference `json:"policy,omitempty" azure:"ro"`

	// READ-ONLY; The type of restriction that is imposed on the field.
	Result *FieldRestrictionResult `json:"result,omitempty" azure:"ro"`

	// READ-ONLY; The values that policy either requires or denies for the field.
	Values []*string `json:"values,omitempty" azure:"ro"`
}

FieldRestriction - The restrictions on a field imposed by a specific policy.

func (FieldRestriction) MarshalJSON

func (f FieldRestriction) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FieldRestriction.

func (*FieldRestriction) UnmarshalJSON added in v0.6.0

func (f *FieldRestriction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FieldRestriction.

type FieldRestrictionResult

type FieldRestrictionResult string

FieldRestrictionResult - The type of restriction that is imposed on the field.

const (
	// FieldRestrictionResultDeny - The field and/or values will be denied by policy.
	FieldRestrictionResultDeny FieldRestrictionResult = "Deny"
	// FieldRestrictionResultRemoved - The field will be removed by policy.
	FieldRestrictionResultRemoved FieldRestrictionResult = "Removed"
	// FieldRestrictionResultRequired - The field and/or values are required by policy.
	FieldRestrictionResultRequired FieldRestrictionResult = "Required"
)

func PossibleFieldRestrictionResultValues

func PossibleFieldRestrictionResultValues() []FieldRestrictionResult

PossibleFieldRestrictionResultValues returns the possible values for the FieldRestrictionResult const type.

type FieldRestrictions

type FieldRestrictions struct {
	// The restrictions placed on that field by policy.
	Restrictions []*FieldRestriction `json:"restrictions,omitempty"`

	// READ-ONLY; The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.
	Field *string `json:"field,omitempty" azure:"ro"`
}

FieldRestrictions - The restrictions that will be placed on a field in the resource by policy.

func (FieldRestrictions) MarshalJSON

func (f FieldRestrictions) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type FieldRestrictions.

func (*FieldRestrictions) UnmarshalJSON added in v0.6.0

func (f *FieldRestrictions) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type FieldRestrictions.

type IfNotExistsEvaluationDetails

type IfNotExistsEvaluationDetails struct {
	// ID of the last evaluated resource for IfNotExists effect.
	ResourceID *string `json:"resourceId,omitempty"`

	// Total number of resources to which the existence condition is applicable.
	TotalResources *int32 `json:"totalResources,omitempty"`
}

IfNotExistsEvaluationDetails - Evaluation details of IfNotExists effect.

func (IfNotExistsEvaluationDetails) MarshalJSON added in v0.6.0

func (i IfNotExistsEvaluationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type IfNotExistsEvaluationDetails.

func (*IfNotExistsEvaluationDetails) UnmarshalJSON added in v0.6.0

func (i *IfNotExistsEvaluationDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type IfNotExistsEvaluationDetails.

type Operation

type Operation struct {
	// Display metadata associated with the operation.
	Display *OperationDisplay `json:"display,omitempty"`

	// Operation name.
	Name *string `json:"name,omitempty"`
}

Operation definition.

func (Operation) MarshalJSON added in v0.6.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.6.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// Operation description.
	Description *string `json:"description,omitempty"`

	// Operation name.
	Operation *string `json:"operation,omitempty"`

	// Resource provider name.
	Provider *string `json:"provider,omitempty"`

	// Resource name on which the operation is performed.
	Resource *string `json:"resource,omitempty"`
}

OperationDisplay - Display metadata associated with the operation.

func (OperationDisplay) MarshalJSON added in v0.6.0

func (o OperationDisplay) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v0.6.0

func (o *OperationDisplay) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationsClient

type OperationsClient struct {
	// contains filtered or unexported fields
}

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*OperationsClient) List

List - Lists available operations. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_ListOperations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewOperationsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.List(ctx, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type OperationsClientListOptions

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.

type OperationsClientListResponse

type OperationsClientListResponse struct {
	OperationsListResults
}

OperationsClientListResponse contains the response from method OperationsClient.List.

type OperationsListResults

type OperationsListResults struct {
	// OData entity count; represents the number of operations returned.
	ODataCount *int32 `json:"@odata.count,omitempty"`

	// List of available operations.
	Value []*Operation `json:"value,omitempty"`
}

OperationsListResults - List of available operations.

func (OperationsListResults) MarshalJSON

func (o OperationsListResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationsListResults.

func (*OperationsListResults) UnmarshalJSON added in v0.6.0

func (o *OperationsListResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResults.

type PendingField

type PendingField struct {
	// REQUIRED; The name of the field. This can be a top-level property like 'name' or 'type' or an Azure Policy field alias.
	Field *string `json:"field,omitempty"`

	// The list of potential values for the field that should be evaluated against Azure Policy.
	Values []*string `json:"values,omitempty"`
}

PendingField - A field that should be evaluated against Azure Policy to determine restrictions.

func (PendingField) MarshalJSON

func (p PendingField) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PendingField.

func (*PendingField) UnmarshalJSON added in v0.6.0

func (p *PendingField) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PendingField.

type PolicyAssignmentSummary

type PolicyAssignmentSummary struct {
	// Policy assignment ID.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`

	// Policy definitions summary.
	PolicyDefinitions []*PolicyDefinitionSummary `json:"policyDefinitions,omitempty"`

	// Policy definition group summary.
	PolicyGroups []*PolicyGroupSummary `json:"policyGroups,omitempty"`

	// Policy set definition ID, if the policy assignment is for a policy set.
	PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`

	// Compliance summary for the policy assignment.
	Results *SummaryResults `json:"results,omitempty"`
}

PolicyAssignmentSummary - Policy assignment summary.

func (PolicyAssignmentSummary) MarshalJSON

func (p PolicyAssignmentSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentSummary.

func (*PolicyAssignmentSummary) UnmarshalJSON added in v0.6.0

func (p *PolicyAssignmentSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentSummary.

type PolicyDefinitionSummary

type PolicyDefinitionSummary struct {
	// Policy effect, i.e. policy definition action.
	Effect *string `json:"effect,omitempty"`

	// Policy definition group names.
	PolicyDefinitionGroupNames []*string `json:"policyDefinitionGroupNames,omitempty"`

	// Policy definition ID.
	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`

	// Policy definition reference ID.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`

	// Compliance summary for the policy definition.
	Results *SummaryResults `json:"results,omitempty"`
}

PolicyDefinitionSummary - Policy definition summary.

func (PolicyDefinitionSummary) MarshalJSON

func (p PolicyDefinitionSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyDefinitionSummary.

func (*PolicyDefinitionSummary) UnmarshalJSON added in v0.6.0

func (p *PolicyDefinitionSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDefinitionSummary.

type PolicyDetails

type PolicyDetails struct {
	// READ-ONLY; The display name of the policy assignment.
	PolicyAssignmentDisplayName *string `json:"policyAssignmentDisplayName,omitempty" azure:"ro"`

	// READ-ONLY; The ID of the policy assignment.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty" azure:"ro"`

	// READ-ONLY; The scope of the policy assignment.
	PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty" azure:"ro"`

	// READ-ONLY; The ID of the policy definition.
	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty" azure:"ro"`

	// READ-ONLY; The policy definition reference ID within the policy set definition.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty" azure:"ro"`

	// READ-ONLY; The ID of the policy set definition.
	PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty" azure:"ro"`
}

PolicyDetails - The policy details.

func (PolicyDetails) MarshalJSON added in v0.6.0

func (p PolicyDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyDetails.

func (*PolicyDetails) UnmarshalJSON added in v0.6.0

func (p *PolicyDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyDetails.

type PolicyEvaluationDetails

type PolicyEvaluationDetails struct {
	// Details of the evaluated expressions.
	EvaluatedExpressions []*ExpressionEvaluationDetails `json:"evaluatedExpressions,omitempty"`

	// Evaluation details of IfNotExists effect.
	IfNotExistsDetails *IfNotExistsEvaluationDetails `json:"ifNotExistsDetails,omitempty"`
}

PolicyEvaluationDetails - Policy evaluation details.

func (PolicyEvaluationDetails) MarshalJSON

func (p PolicyEvaluationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyEvaluationDetails.

func (*PolicyEvaluationDetails) UnmarshalJSON added in v0.6.0

func (p *PolicyEvaluationDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyEvaluationDetails.

type PolicyEvaluationResult

type PolicyEvaluationResult struct {
	// READ-ONLY; The detailed results of the policy expressions and values that were evaluated.
	EvaluationDetails *PolicyEvaluationDetails `json:"evaluationDetails,omitempty" azure:"ro"`

	// READ-ONLY; The result of the policy evaluation against the resource. This will typically be 'NonCompliant' but may contain
	// other values if errors were encountered.
	EvaluationResult *string `json:"evaluationResult,omitempty" azure:"ro"`

	// READ-ONLY; The details of the policy that was evaluated.
	PolicyInfo *PolicyReference `json:"policyInfo,omitempty" azure:"ro"`
}

PolicyEvaluationResult - The result of a non-compliant policy evaluation against the given resource content.

func (PolicyEvaluationResult) MarshalJSON added in v0.6.0

func (p PolicyEvaluationResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyEvaluationResult.

func (*PolicyEvaluationResult) UnmarshalJSON added in v0.6.0

func (p *PolicyEvaluationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyEvaluationResult.

type PolicyEvent

type PolicyEvent struct {
	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]interface{}

	// Compliance state of the resource.
	ComplianceState *string `json:"complianceState,omitempty"`

	// Components events records populated only when URL contains $expand=components clause.
	Components []*ComponentEventDetails `json:"components,omitempty"`

	// Effective parameters for the policy assignment.
	EffectiveParameters *string `json:"effectiveParameters,omitempty"`

	// Flag which states whether the resource is compliant against the policy assignment it was evaluated against.
	IsCompliant *bool `json:"isCompliant,omitempty"`

	// Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under.
	ManagementGroupIDs *string `json:"managementGroupIds,omitempty"`

	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity ID; always set to null since policy event records do not have an entity ID.
	ODataID *string `json:"@odata.id,omitempty"`

	// Policy assignment ID.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`

	// Policy assignment name.
	PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"`

	// Policy assignment owner.
	PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"`

	// Policy assignment parameters.
	PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"`

	// Policy assignment scope.
	PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"`

	// Policy definition action, i.e. effect.
	PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"`

	// Policy definition category.
	PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"`

	// Policy definition ID.
	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`

	// Policy definition name.
	PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"`

	// Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`

	// Policy set definition category, if the policy assignment is for a policy set.
	PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"`

	// Policy set definition ID, if the policy assignment is for a policy set.
	PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`

	// Policy set definition name, if the policy assignment is for a policy set.
	PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"`

	// Policy set definition owner, if the policy assignment is for a policy set.
	PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"`

	// Policy set definition parameters, if the policy assignment is for a policy set.
	PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"`

	// Principal object ID for the user who initiated the resource operation that triggered the policy event.
	PrincipalOid *string `json:"principalOid,omitempty"`

	// Resource group name.
	ResourceGroup *string `json:"resourceGroup,omitempty"`

	// Resource ID.
	ResourceID *string `json:"resourceId,omitempty"`

	// Resource location.
	ResourceLocation *string `json:"resourceLocation,omitempty"`

	// List of resource tags.
	ResourceTags *string `json:"resourceTags,omitempty"`

	// Resource type.
	ResourceType *string `json:"resourceType,omitempty"`

	// Subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty"`

	// Tenant ID for the policy event record.
	TenantID *string `json:"tenantId,omitempty"`

	// Timestamp for the policy event record.
	Timestamp *time.Time `json:"timestamp,omitempty"`
}

PolicyEvent - Policy event record.

func (PolicyEvent) MarshalJSON

func (p PolicyEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyEvent.

func (*PolicyEvent) UnmarshalJSON

func (p *PolicyEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyEvent.

type PolicyEventsClient

type PolicyEventsClient struct {
	// contains filtered or unexported fields
}

PolicyEventsClient contains the methods for the PolicyEvents group. Don't use this type directly, use NewPolicyEventsClient() instead.

func NewPolicyEventsClient

func NewPolicyEventsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyEventsClient, error)

NewPolicyEventsClient creates a new instance of PolicyEventsClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PolicyEventsClient) NewListQueryResultsForManagementGroupPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForManagementGroupPager(policyEventsResource PolicyEventsResourceType, managementGroupName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForManagementGroupOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForManagementGroupResponse]

NewListQueryResultsForManagementGroupPager - Queries policy events for the resources under the management group. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. managementGroupName - Management group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForManagementGroup method.

Example (QueryAtManagementGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForManagementGroupPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "myManagementGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForPolicyDefinitionPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForPolicyDefinitionPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, policyDefinitionName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForPolicyDefinitionOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForPolicyDefinitionResponse]

NewListQueryResultsForPolicyDefinitionPager - Queries policy events for the subscription level policy definition. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. policyDefinitionName - Policy definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForPolicyDefinitionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForPolicyDefinition method.

Example (QueryAtSubscriptionLevelPolicyDefinitionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyDefinitionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForPolicyDefinitionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "24813039-7534-408a-9842-eb99f45721b1", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForPolicySetDefinitionPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForPolicySetDefinitionPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, policySetDefinitionName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForPolicySetDefinitionOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForPolicySetDefinitionResponse]

NewListQueryResultsForPolicySetDefinitionPager - Queries policy events for the subscription level policy set definition. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. policySetDefinitionName - Policy set definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForPolicySetDefinitionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForPolicySetDefinition method.

Example (QueryAtSubscriptionLevelPolicySetDefinitionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicySetDefinitionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForPolicySetDefinitionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "3e3807c1-65c9-49e0-a406-82d8ae3e338c", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, resourceGroupName string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse]

NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager - Queries policy events for the resource group level policy assignment. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResourceGroupLevelPolicyAssignment method.

Example (QueryAtResourceGroupLevelPolicyAssignmentScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", "myPolicyAssignment", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForResourceGroupPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForResourceGroupPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, resourceGroupName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForResourceGroupOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForResourceGroupResponse]

NewListQueryResultsForResourceGroupPager - Queries policy events for the resources under the resource group. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResourceGroup method.

Example (QueryAtResourceGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForResourcePager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForResourcePager(policyEventsResource PolicyEventsResourceType, resourceID string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForResourceOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForResourceResponse]

NewListQueryResultsForResourcePager - Queries policy events for the resource. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. resourceID - Resource ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResource method.

Example (QueryAtNestedResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryNestedResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtSubscriptionLevelNestedResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelNestedResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtSubscriptionLevelResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryComponentsPolicyEventsCountGroupedByUserAndActionTypeForResourceScopeFilteredByGivenAssignment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponentsGroupByWithAggregate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("policyAssignmentId eq '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    to.Ptr("components($apply=groupby((tenantId, principalOid, policyDefinitionAction), aggregate($count as totalActions)))"),
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryComponentsPolicyEventsForResourceScopeFilteredByGivenAssignment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QueryResourceScopeExpandComponents.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyEventsResourceTypeDefault, "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("policyAssignmentId eq '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    to.Ptr("components"),
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse]

NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager - Queries policy events for the subscription level policy assignment. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForSubscriptionLevelPolicyAssignment method.

Example (QueryAtSubscriptionLevelPolicyAssignmentScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyEventsClient) NewListQueryResultsForSubscriptionPager added in v0.4.0

func (client *PolicyEventsClient) NewListQueryResultsForSubscriptionPager(policyEventsResource PolicyEventsResourceType, subscriptionID string, queryOptions *QueryOptions, options *PolicyEventsClientListQueryResultsForSubscriptionOptions) *runtime.Pager[PolicyEventsClientListQueryResultsForSubscriptionResponse]

NewListQueryResultsForSubscriptionPager - Queries policy events for the resources under the subscription. Generated from API version 2019-10-01 policyEventsResource - The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. subscriptionID - Microsoft Azure subscription ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyEventsClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForSubscription method.

Example (FilterAndAggregateOnly)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndAggregateOnly.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("PolicyDefinitionAction eq 'deny'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("aggregate($count as NumDenyEvents)"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndGroupWithAggregate)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithAggregate.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    to.Ptr("PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId), aggregate($count as NumEvents))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndGroupWithoutAggregate)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndGroupByWithoutAggregate.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    to.Ptr("PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndMultipleGroups)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_FilterAndMultipleGroups.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](10),
		Filter:    to.Ptr("PolicyDefinitionAction eq 'deny'"),
		OrderBy:   to.Ptr("NumDeniedResources desc"),
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicyDefinitionId, ResourceId))/groupby((PolicyAssignmentId, PolicyDefinitionId), aggregate($count as NumDeniedResources))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_QuerySubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (TimeRangeSortSelectAndLimit)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyEvents_TimeRangeSortSelectTop.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyEventsClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyEventsResourceTypeDefault, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    nil,
		OrderBy:   to.Ptr("Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId"),
		Select:    to.Ptr("Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId"),
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-05T18:00:00Z"); return t }()),
		To:        to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-06T18:00:00Z"); return t }()),
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type PolicyEventsClientListQueryResultsForManagementGroupOptions

type PolicyEventsClientListQueryResultsForManagementGroupOptions struct {
}

PolicyEventsClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForManagementGroup method.

type PolicyEventsClientListQueryResultsForManagementGroupResponse

type PolicyEventsClientListQueryResultsForManagementGroupResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForManagementGroupResponse contains the response from method PolicyEventsClient.ListQueryResultsForManagementGroup.

type PolicyEventsClientListQueryResultsForPolicyDefinitionOptions

type PolicyEventsClientListQueryResultsForPolicyDefinitionOptions struct {
}

PolicyEventsClientListQueryResultsForPolicyDefinitionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForPolicyDefinition method.

type PolicyEventsClientListQueryResultsForPolicyDefinitionResponse

type PolicyEventsClientListQueryResultsForPolicyDefinitionResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForPolicyDefinitionResponse contains the response from method PolicyEventsClient.ListQueryResultsForPolicyDefinition.

type PolicyEventsClientListQueryResultsForPolicySetDefinitionOptions

type PolicyEventsClientListQueryResultsForPolicySetDefinitionOptions struct {
}

PolicyEventsClientListQueryResultsForPolicySetDefinitionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForPolicySetDefinition method.

type PolicyEventsClientListQueryResultsForPolicySetDefinitionResponse

type PolicyEventsClientListQueryResultsForPolicySetDefinitionResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForPolicySetDefinitionResponse contains the response from method PolicyEventsClient.ListQueryResultsForPolicySetDefinition.

type PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions

type PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions struct {
}

PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResourceGroupLevelPolicyAssignment method.

type PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse

type PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse contains the response from method PolicyEventsClient.ListQueryResultsForResourceGroupLevelPolicyAssignment.

type PolicyEventsClientListQueryResultsForResourceGroupOptions

type PolicyEventsClientListQueryResultsForResourceGroupOptions struct {
}

PolicyEventsClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResourceGroup method.

type PolicyEventsClientListQueryResultsForResourceGroupResponse

type PolicyEventsClientListQueryResultsForResourceGroupResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForResourceGroupResponse contains the response from method PolicyEventsClient.ListQueryResultsForResourceGroup.

type PolicyEventsClientListQueryResultsForResourceOptions

type PolicyEventsClientListQueryResultsForResourceOptions struct {
}

PolicyEventsClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForResource method.

type PolicyEventsClientListQueryResultsForResourceResponse

type PolicyEventsClientListQueryResultsForResourceResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForResourceResponse contains the response from method PolicyEventsClient.ListQueryResultsForResource.

type PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions

type PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions struct {
}

PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForSubscriptionLevelPolicyAssignment method.

type PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse

type PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse contains the response from method PolicyEventsClient.ListQueryResultsForSubscriptionLevelPolicyAssignment.

type PolicyEventsClientListQueryResultsForSubscriptionOptions

type PolicyEventsClientListQueryResultsForSubscriptionOptions struct {
}

PolicyEventsClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyEventsClient.ListQueryResultsForSubscription method.

type PolicyEventsClientListQueryResultsForSubscriptionResponse

type PolicyEventsClientListQueryResultsForSubscriptionResponse struct {
	PolicyEventsQueryResults
}

PolicyEventsClientListQueryResultsForSubscriptionResponse contains the response from method PolicyEventsClient.ListQueryResultsForSubscription.

type PolicyEventsQueryResults

type PolicyEventsQueryResults struct {
	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity count; represents the number of policy event records returned.
	ODataCount *int32 `json:"@odata.count,omitempty"`

	// Odata next link; URL to get the next set of results.
	ODataNextLink *string `json:"@odata.nextLink,omitempty"`

	// Query results.
	Value []*PolicyEvent `json:"value,omitempty"`
}

PolicyEventsQueryResults - Query results.

func (PolicyEventsQueryResults) MarshalJSON

func (p PolicyEventsQueryResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyEventsQueryResults.

func (*PolicyEventsQueryResults) UnmarshalJSON added in v0.6.0

func (p *PolicyEventsQueryResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyEventsQueryResults.

type PolicyEventsResourceType added in v0.2.0

type PolicyEventsResourceType string
const (
	PolicyEventsResourceTypeDefault PolicyEventsResourceType = "default"
)

func PossiblePolicyEventsResourceTypeValues added in v0.2.0

func PossiblePolicyEventsResourceTypeValues() []PolicyEventsResourceType

PossiblePolicyEventsResourceTypeValues returns the possible values for the PolicyEventsResourceType const type.

type PolicyGroupSummary

type PolicyGroupSummary struct {
	// Policy group name.
	PolicyGroupName *string `json:"policyGroupName,omitempty"`

	// Compliance summary for the policy definition group.
	Results *SummaryResults `json:"results,omitempty"`
}

PolicyGroupSummary - Policy definition group summary.

func (PolicyGroupSummary) MarshalJSON added in v0.6.0

func (p PolicyGroupSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyGroupSummary.

func (*PolicyGroupSummary) UnmarshalJSON added in v0.6.0

func (p *PolicyGroupSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyGroupSummary.

type PolicyMetadata

type PolicyMetadata struct {
	// Properties of the policy metadata.
	Properties *PolicyMetadataProperties `json:"properties,omitempty"`

	// READ-ONLY; The ID of the policy metadata.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the policy metadata.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the policy metadata.
	Type *string `json:"type,omitempty" azure:"ro"`
}

PolicyMetadata - Policy metadata resource definition.

func (PolicyMetadata) MarshalJSON added in v0.6.0

func (p PolicyMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyMetadata.

func (*PolicyMetadata) UnmarshalJSON added in v0.6.0

func (p *PolicyMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyMetadata.

type PolicyMetadataClient

type PolicyMetadataClient struct {
	// contains filtered or unexported fields
}

PolicyMetadataClient contains the methods for the PolicyMetadata group. Don't use this type directly, use NewPolicyMetadataClient() instead.

func NewPolicyMetadataClient

func NewPolicyMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyMetadataClient, error)

NewPolicyMetadataClient creates a new instance of PolicyMetadataClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PolicyMetadataClient) GetResource

GetResource - Get policy metadata resource. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 resourceName - The name of the policy metadata resource. options - PolicyMetadataClientGetResourceOptions contains the optional parameters for the PolicyMetadataClient.GetResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_GetResource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyMetadataClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetResource(ctx, "NIST_SP_800-53_R4_AC-2", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyMetadataClient) NewListPager added in v0.4.0

NewListPager - Get a list of the policy metadata resources. Generated from API version 2019-10-01 QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyMetadataClientListOptions contains the optional parameters for the PolicyMetadataClient.List method.

Example (GetCollectionOfPolicyMetadataResources)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyMetadataClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(&armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (GetCollectionOfPolicyMetadataResourcesUsingTopQueryParameter)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyMetadata_List_WithTop.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyMetadataClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(&armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type PolicyMetadataClientGetResourceOptions

type PolicyMetadataClientGetResourceOptions struct {
}

PolicyMetadataClientGetResourceOptions contains the optional parameters for the PolicyMetadataClient.GetResource method.

type PolicyMetadataClientGetResourceResponse

type PolicyMetadataClientGetResourceResponse struct {
	PolicyMetadata
}

PolicyMetadataClientGetResourceResponse contains the response from method PolicyMetadataClient.GetResource.

type PolicyMetadataClientListOptions

type PolicyMetadataClientListOptions struct {
}

PolicyMetadataClientListOptions contains the optional parameters for the PolicyMetadataClient.List method.

type PolicyMetadataClientListResponse

type PolicyMetadataClientListResponse struct {
	PolicyMetadataCollection
}

PolicyMetadataClientListResponse contains the response from method PolicyMetadataClient.List.

type PolicyMetadataCollection

type PolicyMetadataCollection struct {
	// READ-ONLY; The URL to get the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; Array of policy metadata definitions.
	Value []*SlimPolicyMetadata `json:"value,omitempty" azure:"ro"`
}

PolicyMetadataCollection - Collection of policy metadata resources.

func (PolicyMetadataCollection) MarshalJSON

func (p PolicyMetadataCollection) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyMetadataCollection.

func (*PolicyMetadataCollection) UnmarshalJSON added in v0.6.0

func (p *PolicyMetadataCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyMetadataCollection.

type PolicyMetadataProperties

type PolicyMetadataProperties struct {
	// READ-ONLY; Url for getting additional content about the resource metadata.
	AdditionalContentURL *string `json:"additionalContentUrl,omitempty" azure:"ro"`

	// READ-ONLY; The category of the policy metadata.
	Category *string `json:"category,omitempty" azure:"ro"`

	// READ-ONLY; The description of the policy metadata.
	Description *string `json:"description,omitempty" azure:"ro"`

	// READ-ONLY; Additional metadata.
	Metadata interface{} `json:"metadata,omitempty" azure:"ro"`

	// READ-ONLY; The policy metadata identifier.
	MetadataID *string `json:"metadataId,omitempty" azure:"ro"`

	// READ-ONLY; The owner of the policy metadata.
	Owner *string `json:"owner,omitempty" azure:"ro"`

	// READ-ONLY; The requirements of the policy metadata.
	Requirements *string `json:"requirements,omitempty" azure:"ro"`

	// READ-ONLY; The title of the policy metadata.
	Title *string `json:"title,omitempty" azure:"ro"`
}

PolicyMetadataProperties - The properties of the policy metadata.

func (PolicyMetadataProperties) MarshalJSON added in v0.6.0

func (p PolicyMetadataProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyMetadataProperties.

func (*PolicyMetadataProperties) UnmarshalJSON added in v0.6.0

func (p *PolicyMetadataProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyMetadataProperties.

type PolicyMetadataSlimProperties

type PolicyMetadataSlimProperties struct {
	// READ-ONLY; Url for getting additional content about the resource metadata.
	AdditionalContentURL *string `json:"additionalContentUrl,omitempty" azure:"ro"`

	// READ-ONLY; The category of the policy metadata.
	Category *string `json:"category,omitempty" azure:"ro"`

	// READ-ONLY; Additional metadata.
	Metadata interface{} `json:"metadata,omitempty" azure:"ro"`

	// READ-ONLY; The policy metadata identifier.
	MetadataID *string `json:"metadataId,omitempty" azure:"ro"`

	// READ-ONLY; The owner of the policy metadata.
	Owner *string `json:"owner,omitempty" azure:"ro"`

	// READ-ONLY; The title of the policy metadata.
	Title *string `json:"title,omitempty" azure:"ro"`
}

PolicyMetadataSlimProperties - The properties of the policy metadata, excluding properties containing large strings

func (PolicyMetadataSlimProperties) MarshalJSON added in v0.6.0

func (p PolicyMetadataSlimProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyMetadataSlimProperties.

func (*PolicyMetadataSlimProperties) UnmarshalJSON added in v0.6.0

func (p *PolicyMetadataSlimProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyMetadataSlimProperties.

type PolicyReference

type PolicyReference struct {
	// READ-ONLY; The resource identifier of the policy assignment.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty" azure:"ro"`

	// READ-ONLY; The resource identifier of the policy definition.
	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty" azure:"ro"`

	// READ-ONLY; The reference identifier of a specific policy definition within a policy set definition.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty" azure:"ro"`

	// READ-ONLY; The resource identifier of the policy set definition.
	PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty" azure:"ro"`
}

PolicyReference - Resource identifiers for a policy.

func (PolicyReference) MarshalJSON added in v0.6.0

func (p PolicyReference) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyReference.

func (*PolicyReference) UnmarshalJSON added in v0.6.0

func (p *PolicyReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyReference.

type PolicyRestrictionsClient

type PolicyRestrictionsClient struct {
	// contains filtered or unexported fields
}

PolicyRestrictionsClient contains the methods for the PolicyRestrictions group. Don't use this type directly, use NewPolicyRestrictionsClient() instead.

func NewPolicyRestrictionsClient

func NewPolicyRestrictionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyRestrictionsClient, error)

NewPolicyRestrictionsClient creates a new instance of PolicyRestrictionsClient with the specified values. subscriptionID - Microsoft Azure subscription ID. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PolicyRestrictionsClient) CheckAtManagementGroupScope added in v0.3.0

CheckAtManagementGroupScope - Checks what restrictions Azure Policy will place on resources within a management group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-03-01 managementGroupID - Management group ID. parameters - The check policy restrictions parameters. options - PolicyRestrictionsClientCheckAtManagementGroupScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtManagementGroupScope method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-03-01/examples/PolicyRestrictions_CheckAtManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyRestrictionsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckAtManagementGroupScope(ctx, "financeMg", armpolicyinsights.CheckManagementGroupRestrictionsRequest{
		PendingFields: []*armpolicyinsights.PendingField{
			{
				Field: to.Ptr("type"),
			}},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyRestrictionsClient) CheckAtResourceGroupScope

CheckAtResourceGroupScope - Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-03-01 resourceGroupName - The name of the resource group. The name is case insensitive. parameters - The check policy restrictions parameters. options - PolicyRestrictionsClientCheckAtResourceGroupScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtResourceGroupScope method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-03-01/examples/PolicyRestrictions_CheckAtResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyRestrictionsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckAtResourceGroupScope(ctx, "vmRg", armpolicyinsights.CheckRestrictionsRequest{
		PendingFields: []*armpolicyinsights.PendingField{
			{
				Field: to.Ptr("name"),
				Values: []*string{
					to.Ptr("myVMName")},
			},
			{
				Field: to.Ptr("location"),
				Values: []*string{
					to.Ptr("eastus"),
					to.Ptr("westus"),
					to.Ptr("westus2"),
					to.Ptr("westeurope")},
			},
			{
				Field: to.Ptr("tags"),
			}},
		ResourceDetails: &armpolicyinsights.CheckRestrictionsResourceDetails{
			APIVersion: to.Ptr("2019-12-01"),
			ResourceContent: map[string]interface{}{
				"type": "Microsoft.Compute/virtualMachines",
				"properties": map[string]interface{}{
					"priority": "Spot",
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyRestrictionsClient) CheckAtSubscriptionScope

CheckAtSubscriptionScope - Checks what restrictions Azure Policy will place on a resource within a subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2022-03-01 parameters - The check policy restrictions parameters. options - PolicyRestrictionsClientCheckAtSubscriptionScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtSubscriptionScope method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-03-01/examples/PolicyRestrictions_CheckAtSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyRestrictionsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CheckAtSubscriptionScope(ctx, armpolicyinsights.CheckRestrictionsRequest{
		PendingFields: []*armpolicyinsights.PendingField{
			{
				Field: to.Ptr("name"),
				Values: []*string{
					to.Ptr("myVMName")},
			},
			{
				Field: to.Ptr("location"),
				Values: []*string{
					to.Ptr("eastus"),
					to.Ptr("westus"),
					to.Ptr("westus2"),
					to.Ptr("westeurope")},
			},
			{
				Field: to.Ptr("tags"),
			}},
		ResourceDetails: &armpolicyinsights.CheckRestrictionsResourceDetails{
			APIVersion: to.Ptr("2019-12-01"),
			ResourceContent: map[string]interface{}{
				"type": "Microsoft.Compute/virtualMachines",
				"properties": map[string]interface{}{
					"priority": "Spot",
				},
			},
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type PolicyRestrictionsClientCheckAtManagementGroupScopeOptions added in v0.3.0

type PolicyRestrictionsClientCheckAtManagementGroupScopeOptions struct {
}

PolicyRestrictionsClientCheckAtManagementGroupScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtManagementGroupScope method.

type PolicyRestrictionsClientCheckAtManagementGroupScopeResponse added in v0.3.0

type PolicyRestrictionsClientCheckAtManagementGroupScopeResponse struct {
	CheckRestrictionsResult
}

PolicyRestrictionsClientCheckAtManagementGroupScopeResponse contains the response from method PolicyRestrictionsClient.CheckAtManagementGroupScope.

type PolicyRestrictionsClientCheckAtResourceGroupScopeOptions

type PolicyRestrictionsClientCheckAtResourceGroupScopeOptions struct {
}

PolicyRestrictionsClientCheckAtResourceGroupScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtResourceGroupScope method.

type PolicyRestrictionsClientCheckAtResourceGroupScopeResponse

type PolicyRestrictionsClientCheckAtResourceGroupScopeResponse struct {
	CheckRestrictionsResult
}

PolicyRestrictionsClientCheckAtResourceGroupScopeResponse contains the response from method PolicyRestrictionsClient.CheckAtResourceGroupScope.

type PolicyRestrictionsClientCheckAtSubscriptionScopeOptions

type PolicyRestrictionsClientCheckAtSubscriptionScopeOptions struct {
}

PolicyRestrictionsClientCheckAtSubscriptionScopeOptions contains the optional parameters for the PolicyRestrictionsClient.CheckAtSubscriptionScope method.

type PolicyRestrictionsClientCheckAtSubscriptionScopeResponse

type PolicyRestrictionsClientCheckAtSubscriptionScopeResponse struct {
	CheckRestrictionsResult
}

PolicyRestrictionsClientCheckAtSubscriptionScopeResponse contains the response from method PolicyRestrictionsClient.CheckAtSubscriptionScope.

type PolicyState

type PolicyState struct {
	// OPTIONAL; Contains additional key/value pairs not defined in the schema.
	AdditionalProperties map[string]interface{}

	// Compliance state of the resource.
	ComplianceState *string `json:"complianceState,omitempty"`

	// Components state compliance records populated only when URL contains $expand=components clause.
	Components []*ComponentStateDetails `json:"components,omitempty"`

	// Effective parameters for the policy assignment.
	EffectiveParameters *string `json:"effectiveParameters,omitempty"`

	// Flag which states whether the resource is compliant against the policy assignment it was evaluated against. This property
	// is deprecated; please use ComplianceState instead.
	IsCompliant *bool `json:"isCompliant,omitempty"`

	// Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under.
	ManagementGroupIDs *string `json:"managementGroupIds,omitempty"`

	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity ID; always set to null since policy state records do not have an entity ID.
	ODataID *string `json:"@odata.id,omitempty"`

	// Policy assignment ID.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`

	// Policy assignment name.
	PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"`

	// Policy assignment owner.
	PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"`

	// Policy assignment parameters.
	PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"`

	// Policy assignment scope.
	PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"`

	// Policy definition action, i.e. effect.
	PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"`

	// Policy definition category.
	PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"`

	// Policy definition group names.
	PolicyDefinitionGroupNames []*string `json:"policyDefinitionGroupNames,omitempty"`

	// Policy definition ID.
	PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"`

	// Policy definition name.
	PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"`

	// Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`

	// Policy evaluation details.
	PolicyEvaluationDetails *PolicyEvaluationDetails `json:"policyEvaluationDetails,omitempty"`

	// Policy set definition category, if the policy assignment is for a policy set.
	PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"`

	// Policy set definition ID, if the policy assignment is for a policy set.
	PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"`

	// Policy set definition name, if the policy assignment is for a policy set.
	PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"`

	// Policy set definition owner, if the policy assignment is for a policy set.
	PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"`

	// Policy set definition parameters, if the policy assignment is for a policy set.
	PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"`

	// Resource group name.
	ResourceGroup *string `json:"resourceGroup,omitempty"`

	// Resource ID.
	ResourceID *string `json:"resourceId,omitempty"`

	// Resource location.
	ResourceLocation *string `json:"resourceLocation,omitempty"`

	// List of resource tags.
	ResourceTags *string `json:"resourceTags,omitempty"`

	// Resource type.
	ResourceType *string `json:"resourceType,omitempty"`

	// Subscription ID.
	SubscriptionID *string `json:"subscriptionId,omitempty"`

	// Timestamp for the policy state record.
	Timestamp *time.Time `json:"timestamp,omitempty"`

	// READ-ONLY; Evaluated policy assignment version.
	PolicyAssignmentVersion *string `json:"policyAssignmentVersion,omitempty" azure:"ro"`

	// READ-ONLY; Evaluated policy definition version.
	PolicyDefinitionVersion *string `json:"policyDefinitionVersion,omitempty" azure:"ro"`

	// READ-ONLY; Evaluated policy set definition version.
	PolicySetDefinitionVersion *string `json:"policySetDefinitionVersion,omitempty" azure:"ro"`
}

PolicyState - Policy state record.

func (PolicyState) MarshalJSON

func (p PolicyState) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyState.

func (*PolicyState) UnmarshalJSON

func (p *PolicyState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyState.

type PolicyStatesClient

type PolicyStatesClient struct {
	// contains filtered or unexported fields
}

PolicyStatesClient contains the methods for the PolicyStates group. Don't use this type directly, use NewPolicyStatesClient() instead.

func NewPolicyStatesClient

func NewPolicyStatesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyStatesClient, error)

NewPolicyStatesClient creates a new instance of PolicyStatesClient with the specified values. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PolicyStatesClient) BeginTriggerResourceGroupEvaluation

BeginTriggerResourceGroupEvaluation - Triggers a policy evaluation scan for all the resources under the resource group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. options - PolicyStatesClientBeginTriggerResourceGroupEvaluationOptions contains the optional parameters for the PolicyStatesClient.BeginTriggerResourceGroupEvaluation method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerResourceGroupEvaluation.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginTriggerResourceGroupEvaluation(ctx, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*PolicyStatesClient) BeginTriggerSubscriptionEvaluation

BeginTriggerSubscriptionEvaluation - Triggers a policy evaluation scan for all the resources under the subscription If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 subscriptionID - Microsoft Azure subscription ID. options - PolicyStatesClientBeginTriggerSubscriptionEvaluationOptions contains the optional parameters for the PolicyStatesClient.BeginTriggerSubscriptionEvaluation method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TriggerSubscriptionEvaluation.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := client.BeginTriggerSubscriptionEvaluation(ctx, "fffedd8f-ffff-fffd-fffd-fffed2f84852", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	_, err = poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForManagementGroupPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForManagementGroupPager(policyStatesResource PolicyStatesResource, managementGroupName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForManagementGroupOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForManagementGroupResponse]

NewListQueryResultsForManagementGroupPager - Queries policy states for the resources under the management group. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). managementGroupName - Management group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForManagementGroup method.

Example (QueryLatestAtManagementGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForManagementGroupPager(armpolicyinsights.PolicyStatesResourceLatest, "myManagementGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForPolicyDefinitionPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForPolicyDefinitionPager(policyStatesResource PolicyStatesResource, subscriptionID string, policyDefinitionName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForPolicyDefinitionOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForPolicyDefinitionResponse]

NewListQueryResultsForPolicyDefinitionPager - Queries policy states for the subscription level policy definition. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. policyDefinitionName - Policy definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForPolicyDefinitionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForPolicyDefinition method.

Example (QueryLatestAtSubscriptionLevelPolicyDefinitionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyDefinitionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForPolicyDefinitionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "24813039-7534-408a-9842-eb99f45721b1", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForPolicySetDefinitionPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForPolicySetDefinitionPager(policyStatesResource PolicyStatesResource, subscriptionID string, policySetDefinitionName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForPolicySetDefinitionOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForPolicySetDefinitionResponse]

NewListQueryResultsForPolicySetDefinitionPager - Queries policy states for the subscription level policy set definition. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. policySetDefinitionName - Policy set definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForPolicySetDefinitionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForPolicySetDefinition method.

Example (QueryLatestAtSubscriptionLevelPolicySetDefinitionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicySetDefinitionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForPolicySetDefinitionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "3e3807c1-65c9-49e0-a406-82d8ae3e338c", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager(policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse]

NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager - Queries policy states for the resource group level policy assignment. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResourceGroupLevelPolicyAssignment method.

Example (QueryLatestAtResourceGroupLevelPolicyAssignmentScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupLevelPolicyAssignmentPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", "myPolicyAssignment", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForResourceGroupPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForResourceGroupPager(policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForResourceGroupOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForResourceGroupResponse]

NewListQueryResultsForResourceGroupPager - Queries policy states for the resources under the resource group. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResourceGroup method.

Example (QueryLatestAtResourceGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForResourcePager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForResourcePager(policyStatesResource PolicyStatesResource, resourceID string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForResourceOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForResourceResponse]

NewListQueryResultsForResourcePager - Queries policy states for the resource. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). resourceID - Resource ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResource method.

Example (QueryAllPolicyStatesAtNestedResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryNestedResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApplication", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAllPolicyStatesAtResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAllPolicyStatesAtResourceScopeAndExpandPolicyEvaluationDetails)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandPolicyEvaluationDetails.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceLatest, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/myDomainName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    to.Ptr("PolicyEvaluationDetails"),
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAllPolicyStatesAtSubscriptionLevelNestedResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelNestedResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResource/someNestedResourceType/someNestedResource", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAllPolicyStatesAtSubscriptionLevelResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceDefault, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNamespace/someResourceType/someResourceName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryComponentPolicyComplianceStateAtResourceScopeFilteredByGivenAssignment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponents.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceLatest, "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("policyAssignmentId eq '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    to.Ptr("components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq 'Compliant')"),
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryComponentPolicyComplianceStateCountGroupedByStateTypeAtResourceScopeFilteredByGivenAssignment)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QueryResourceScopeExpandComponentsGroupByWithAggregate.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager(armpolicyinsights.PolicyStatesResourceLatest, "subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/Vaults/myKVName", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("policyAssignmentId eq '/subscriptions/e78961ba-36fe-4739-9212-e3031b4c8db7/providers/microsoft.authorization/policyassignments/560050f83dbb4a24974323f8'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    to.Ptr("components($filter=ComplianceState eq 'NonCompliant' or ComplianceState eq 'Compliant';$apply=groupby((complianceState),aggregate($count as count)))"),
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager(policyStatesResource PolicyStatesResource, subscriptionID string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse]

NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager - Queries policy states for the subscription level policy assignment. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForSubscriptionLevelPolicyAssignment method.

Example (QueryLatestAtSubscriptionLevelPolicyAssignmentScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionLevelPolicyAssignmentPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) NewListQueryResultsForSubscriptionPager added in v0.4.0

func (client *PolicyStatesClient) NewListQueryResultsForSubscriptionPager(policyStatesResource PolicyStatesResource, subscriptionID string, queryOptions *QueryOptions, options *PolicyStatesClientListQueryResultsForSubscriptionOptions) *runtime.Pager[PolicyStatesClientListQueryResultsForSubscriptionResponse]

NewListQueryResultsForSubscriptionPager - Queries policy states for the resources under the subscription. Generated from API version 2019-10-01 policyStatesResource - The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). subscriptionID - Microsoft Azure subscription ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForSubscription method.

Example (FilterAndAggregateOnly)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndAggregateOnly.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    to.Ptr("PolicyDefinitionAction eq 'deny'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("aggregate($count as NumDenyStates)"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndGroupWithAggregate)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithAggregate.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    to.Ptr("IsCompliant eq false and (PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny')"),
		OrderBy:   to.Ptr("NumAuditDenyNonComplianceRecords desc"),
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId), aggregate($count as NumAuditDenyNonComplianceRecords))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndGroupWithoutAggregate)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndGroupByWithoutAggregate.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    to.Ptr("IsCompliant eq false and (PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append')"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (FilterAndMultipleGroups)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_FilterAndMultipleGroups.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](10),
		Filter:    to.Ptr("IsCompliant eq false"),
		OrderBy:   to.Ptr("NumNonCompliantResources desc"),
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     to.Ptr("groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId, PolicyDefinitionReferenceId, ResourceId))/groupby((PolicyAssignmentId, PolicySetDefinitionId, PolicyDefinitionId, PolicyDefinitionReferenceId), aggregate($count as NumNonCompliantResources))"),
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryLatestAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_QuerySubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (TimeRangeSortSelectAndLimit)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_TimeRangeSortSelectTop.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyStatesResourceLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    nil,
		OrderBy:   to.Ptr("Timestamp desc, PolicyAssignmentId asc, SubscriptionId asc, ResourceGroup asc, ResourceId"),
		Select:    to.Ptr("Timestamp, PolicyAssignmentId, PolicyDefinitionId, SubscriptionId, ResourceGroup, ResourceId, policyDefinitionGroupNames"),
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-06T18:00:00Z"); return t }()),
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyStatesClient) SummarizeForManagementGroup

func (client *PolicyStatesClient) SummarizeForManagementGroup(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, managementGroupName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForManagementGroupOptions) (PolicyStatesClientSummarizeForManagementGroupResponse, error)

SummarizeForManagementGroup - Summarizes policy states for the resources under the management group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. managementGroupName - Management group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForManagementGroupOptions contains the optional parameters for the PolicyStatesClient.SummarizeForManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeManagementGroupScope.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForManagementGroup(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "myManagementGroup", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](0),
		Filter:    to.Ptr("PolicyDefinitionAction eq 'deny' or PolicyDefinitionAction eq 'audit'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-06T18:00:00Z"); return t }()),
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForPolicyDefinition

func (client *PolicyStatesClient) SummarizeForPolicyDefinition(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, policyDefinitionName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForPolicyDefinitionOptions) (PolicyStatesClientSummarizeForPolicyDefinitionResponse, error)

SummarizeForPolicyDefinition - Summarizes policy states for the subscription level policy definition. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. policyDefinitionName - Policy definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForPolicyDefinitionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForPolicyDefinition method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyDefinitionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForPolicyDefinition(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "24813039-7534-408a-9842-eb99f45721b1", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForPolicySetDefinition

func (client *PolicyStatesClient) SummarizeForPolicySetDefinition(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, policySetDefinitionName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForPolicySetDefinitionOptions) (PolicyStatesClientSummarizeForPolicySetDefinitionResponse, error)

SummarizeForPolicySetDefinition - Summarizes policy states for the subscription level policy set definition. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. policySetDefinitionName - Policy set definition name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForPolicySetDefinitionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForPolicySetDefinition method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicySetDefinitionScope.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForPolicySetDefinition(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "3e3807c1-65c9-49e0-a406-82d8ae3e338c", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyDefinitionAction eq 'deny'"),
		OrderBy:   nil,
		Select:    nil,
		From:      to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-05T18:00:00Z"); return t }()),
		To:        to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-06T18:00:00Z"); return t }()),
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForResource

func (client *PolicyStatesClient) SummarizeForResource(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, resourceID string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForResourceOptions) (PolicyStatesClientSummarizeForResourceResponse, error)

SummarizeForResource - Summarizes policy states for the resource. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. resourceID - Resource ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForResourceOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForResource(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/my-vault", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](2),
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForResourceGroup

func (client *PolicyStatesClient) SummarizeForResourceGroup(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, resourceGroupName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForResourceGroupOptions) (PolicyStatesClientSummarizeForResourceGroupResponse, error)

SummarizeForResourceGroup - Summarizes policy states for the resources under the resource group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForResourceGroupOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForResourceGroup(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignment

func (client *PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignment(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, resourceGroupName string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentOptions) (PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentResponse, error)

SummarizeForResourceGroupLevelPolicyAssignment - Summarizes policy states for the resource group level policy assignment. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. resourceGroupName - Resource group name. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResourceGroupLevelPolicyAssignment method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeResourceGroupLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForResourceGroupLevelPolicyAssignment(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "myResourceGroup", "b7a1ca2596524e3ab19597f2", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForSubscription

func (client *PolicyStatesClient) SummarizeForSubscription(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForSubscriptionOptions) (PolicyStatesClientSummarizeForSubscriptionResponse, error)

SummarizeForSubscription - Summarizes policy states for the resources under the subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForSubscriptionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForSubscription method.

Example (SummarizeAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForSubscription(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](5),
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

Example (SummarizeAtSubscriptionScopeForAPolicyDefinitionGroup)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionScopeForPolicyGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForSubscription(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("'group1' IN PolicyDefinitionGroupNames"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignment

func (client *PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignment(ctx context.Context, policyStatesSummaryResource PolicyStatesSummaryResourceType, subscriptionID string, policyAssignmentName string, queryOptions *QueryOptions, options *PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentOptions) (PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentResponse, error)

SummarizeForSubscriptionLevelPolicyAssignment - Summarizes policy states for the subscription level policy assignment. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2019-10-01 policyStatesSummaryResource - The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. subscriptionID - Microsoft Azure subscription ID. policyAssignmentName - Policy assignment name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.SummarizeForSubscriptionLevelPolicyAssignment method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2019-10-01/examples/PolicyStates_SummarizeSubscriptionLevelPolicyAssignmentScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyStatesClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.SummarizeForSubscriptionLevelPolicyAssignment(ctx, armpolicyinsights.PolicyStatesSummaryResourceTypeLatest, "fffedd8f-ffff-fffd-fffd-fffed2f84852", "ec8f9645-8ecb-4abb-9c0b-5292f19d4003", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type PolicyStatesClientBeginTriggerResourceGroupEvaluationOptions

type PolicyStatesClientBeginTriggerResourceGroupEvaluationOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

PolicyStatesClientBeginTriggerResourceGroupEvaluationOptions contains the optional parameters for the PolicyStatesClient.BeginTriggerResourceGroupEvaluation method.

type PolicyStatesClientBeginTriggerSubscriptionEvaluationOptions

type PolicyStatesClientBeginTriggerSubscriptionEvaluationOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

PolicyStatesClientBeginTriggerSubscriptionEvaluationOptions contains the optional parameters for the PolicyStatesClient.BeginTriggerSubscriptionEvaluation method.

type PolicyStatesClientListQueryResultsForManagementGroupOptions

type PolicyStatesClientListQueryResultsForManagementGroupOptions struct {
}

PolicyStatesClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForManagementGroup method.

type PolicyStatesClientListQueryResultsForManagementGroupResponse

type PolicyStatesClientListQueryResultsForManagementGroupResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForManagementGroupResponse contains the response from method PolicyStatesClient.ListQueryResultsForManagementGroup.

type PolicyStatesClientListQueryResultsForPolicyDefinitionOptions

type PolicyStatesClientListQueryResultsForPolicyDefinitionOptions struct {
}

PolicyStatesClientListQueryResultsForPolicyDefinitionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForPolicyDefinition method.

type PolicyStatesClientListQueryResultsForPolicyDefinitionResponse

type PolicyStatesClientListQueryResultsForPolicyDefinitionResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForPolicyDefinitionResponse contains the response from method PolicyStatesClient.ListQueryResultsForPolicyDefinition.

type PolicyStatesClientListQueryResultsForPolicySetDefinitionOptions

type PolicyStatesClientListQueryResultsForPolicySetDefinitionOptions struct {
}

PolicyStatesClientListQueryResultsForPolicySetDefinitionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForPolicySetDefinition method.

type PolicyStatesClientListQueryResultsForPolicySetDefinitionResponse

type PolicyStatesClientListQueryResultsForPolicySetDefinitionResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForPolicySetDefinitionResponse contains the response from method PolicyStatesClient.ListQueryResultsForPolicySetDefinition.

type PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions

type PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions struct {
}

PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResourceGroupLevelPolicyAssignment method.

type PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse

type PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForResourceGroupLevelPolicyAssignmentResponse contains the response from method PolicyStatesClient.ListQueryResultsForResourceGroupLevelPolicyAssignment.

type PolicyStatesClientListQueryResultsForResourceGroupOptions

type PolicyStatesClientListQueryResultsForResourceGroupOptions struct {
}

PolicyStatesClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResourceGroup method.

type PolicyStatesClientListQueryResultsForResourceGroupResponse

type PolicyStatesClientListQueryResultsForResourceGroupResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForResourceGroupResponse contains the response from method PolicyStatesClient.ListQueryResultsForResourceGroup.

type PolicyStatesClientListQueryResultsForResourceOptions

type PolicyStatesClientListQueryResultsForResourceOptions struct {
}

PolicyStatesClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForResource method.

type PolicyStatesClientListQueryResultsForResourceResponse

type PolicyStatesClientListQueryResultsForResourceResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForResourceResponse contains the response from method PolicyStatesClient.ListQueryResultsForResource.

type PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions

type PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions struct {
}

PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForSubscriptionLevelPolicyAssignment method.

type PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse

type PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForSubscriptionLevelPolicyAssignmentResponse contains the response from method PolicyStatesClient.ListQueryResultsForSubscriptionLevelPolicyAssignment.

type PolicyStatesClientListQueryResultsForSubscriptionOptions

type PolicyStatesClientListQueryResultsForSubscriptionOptions struct {
}

PolicyStatesClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyStatesClient.ListQueryResultsForSubscription method.

type PolicyStatesClientListQueryResultsForSubscriptionResponse

type PolicyStatesClientListQueryResultsForSubscriptionResponse struct {
	PolicyStatesQueryResults
}

PolicyStatesClientListQueryResultsForSubscriptionResponse contains the response from method PolicyStatesClient.ListQueryResultsForSubscription.

type PolicyStatesClientSummarizeForManagementGroupOptions

type PolicyStatesClientSummarizeForManagementGroupOptions struct {
}

PolicyStatesClientSummarizeForManagementGroupOptions contains the optional parameters for the PolicyStatesClient.SummarizeForManagementGroup method.

type PolicyStatesClientSummarizeForManagementGroupResponse

type PolicyStatesClientSummarizeForManagementGroupResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForManagementGroupResponse contains the response from method PolicyStatesClient.SummarizeForManagementGroup.

type PolicyStatesClientSummarizeForPolicyDefinitionOptions

type PolicyStatesClientSummarizeForPolicyDefinitionOptions struct {
}

PolicyStatesClientSummarizeForPolicyDefinitionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForPolicyDefinition method.

type PolicyStatesClientSummarizeForPolicyDefinitionResponse

type PolicyStatesClientSummarizeForPolicyDefinitionResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForPolicyDefinitionResponse contains the response from method PolicyStatesClient.SummarizeForPolicyDefinition.

type PolicyStatesClientSummarizeForPolicySetDefinitionOptions

type PolicyStatesClientSummarizeForPolicySetDefinitionOptions struct {
}

PolicyStatesClientSummarizeForPolicySetDefinitionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForPolicySetDefinition method.

type PolicyStatesClientSummarizeForPolicySetDefinitionResponse

type PolicyStatesClientSummarizeForPolicySetDefinitionResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForPolicySetDefinitionResponse contains the response from method PolicyStatesClient.SummarizeForPolicySetDefinition.

type PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentOptions

type PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentOptions struct {
}

PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResourceGroupLevelPolicyAssignment method.

type PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentResponse

type PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForResourceGroupLevelPolicyAssignmentResponse contains the response from method PolicyStatesClient.SummarizeForResourceGroupLevelPolicyAssignment.

type PolicyStatesClientSummarizeForResourceGroupOptions

type PolicyStatesClientSummarizeForResourceGroupOptions struct {
}

PolicyStatesClientSummarizeForResourceGroupOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResourceGroup method.

type PolicyStatesClientSummarizeForResourceGroupResponse

type PolicyStatesClientSummarizeForResourceGroupResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForResourceGroupResponse contains the response from method PolicyStatesClient.SummarizeForResourceGroup.

type PolicyStatesClientSummarizeForResourceOptions

type PolicyStatesClientSummarizeForResourceOptions struct {
}

PolicyStatesClientSummarizeForResourceOptions contains the optional parameters for the PolicyStatesClient.SummarizeForResource method.

type PolicyStatesClientSummarizeForResourceResponse

type PolicyStatesClientSummarizeForResourceResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForResourceResponse contains the response from method PolicyStatesClient.SummarizeForResource.

type PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentOptions

type PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentOptions struct {
}

PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentOptions contains the optional parameters for the PolicyStatesClient.SummarizeForSubscriptionLevelPolicyAssignment method.

type PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentResponse

type PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForSubscriptionLevelPolicyAssignmentResponse contains the response from method PolicyStatesClient.SummarizeForSubscriptionLevelPolicyAssignment.

type PolicyStatesClientSummarizeForSubscriptionOptions

type PolicyStatesClientSummarizeForSubscriptionOptions struct {
}

PolicyStatesClientSummarizeForSubscriptionOptions contains the optional parameters for the PolicyStatesClient.SummarizeForSubscription method.

type PolicyStatesClientSummarizeForSubscriptionResponse

type PolicyStatesClientSummarizeForSubscriptionResponse struct {
	SummarizeResults
}

PolicyStatesClientSummarizeForSubscriptionResponse contains the response from method PolicyStatesClient.SummarizeForSubscription.

type PolicyStatesClientTriggerResourceGroupEvaluationResponse

type PolicyStatesClientTriggerResourceGroupEvaluationResponse struct {
}

PolicyStatesClientTriggerResourceGroupEvaluationResponse contains the response from method PolicyStatesClient.TriggerResourceGroupEvaluation.

type PolicyStatesClientTriggerSubscriptionEvaluationResponse

type PolicyStatesClientTriggerSubscriptionEvaluationResponse struct {
}

PolicyStatesClientTriggerSubscriptionEvaluationResponse contains the response from method PolicyStatesClient.TriggerSubscriptionEvaluation.

type PolicyStatesQueryResults

type PolicyStatesQueryResults struct {
	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity count; represents the number of policy state records returned.
	ODataCount *int32 `json:"@odata.count,omitempty"`

	// Odata next link; URL to get the next set of results.
	ODataNextLink *string `json:"@odata.nextLink,omitempty"`

	// Query results.
	Value []*PolicyState `json:"value,omitempty"`
}

PolicyStatesQueryResults - Query results.

func (PolicyStatesQueryResults) MarshalJSON

func (p PolicyStatesQueryResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyStatesQueryResults.

func (*PolicyStatesQueryResults) UnmarshalJSON added in v0.6.0

func (p *PolicyStatesQueryResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyStatesQueryResults.

type PolicyStatesResource

type PolicyStatesResource string
const (
	PolicyStatesResourceDefault PolicyStatesResource = "default"
	PolicyStatesResourceLatest  PolicyStatesResource = "latest"
)

func PossiblePolicyStatesResourceValues

func PossiblePolicyStatesResourceValues() []PolicyStatesResource

PossiblePolicyStatesResourceValues returns the possible values for the PolicyStatesResource const type.

type PolicyStatesSummaryResourceType added in v0.2.0

type PolicyStatesSummaryResourceType string
const (
	PolicyStatesSummaryResourceTypeLatest PolicyStatesSummaryResourceType = "latest"
)

func PossiblePolicyStatesSummaryResourceTypeValues added in v0.2.0

func PossiblePolicyStatesSummaryResourceTypeValues() []PolicyStatesSummaryResourceType

PossiblePolicyStatesSummaryResourceTypeValues returns the possible values for the PolicyStatesSummaryResourceType const type.

type PolicyTrackedResource

type PolicyTrackedResource struct {
	// READ-ONLY; The details of the policy triggered deployment that created the tracked resource.
	CreatedBy *TrackedResourceModificationDetails `json:"createdBy,omitempty" azure:"ro"`

	// READ-ONLY; The details of the policy triggered deployment that modified the tracked resource.
	LastModifiedBy *TrackedResourceModificationDetails `json:"lastModifiedBy,omitempty" azure:"ro"`

	// READ-ONLY; Timestamp of the last update to the tracked resource.
	LastUpdateUTC *time.Time `json:"lastUpdateUtc,omitempty" azure:"ro"`

	// READ-ONLY; The details of the policy that require the tracked resource.
	PolicyDetails *PolicyDetails `json:"policyDetails,omitempty" azure:"ro"`

	// READ-ONLY; The ID of the policy tracked resource.
	TrackedResourceID *string `json:"trackedResourceId,omitempty" azure:"ro"`
}

PolicyTrackedResource - Policy tracked resource record.

func (PolicyTrackedResource) MarshalJSON

func (p PolicyTrackedResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyTrackedResource.

func (*PolicyTrackedResource) UnmarshalJSON

func (p *PolicyTrackedResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyTrackedResource.

type PolicyTrackedResourcesClient

type PolicyTrackedResourcesClient struct {
	// contains filtered or unexported fields
}

PolicyTrackedResourcesClient contains the methods for the PolicyTrackedResources group. Don't use this type directly, use NewPolicyTrackedResourcesClient() instead.

func NewPolicyTrackedResourcesClient

func NewPolicyTrackedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyTrackedResourcesClient, error)

NewPolicyTrackedResourcesClient creates a new instance of PolicyTrackedResourcesClient with the specified values. subscriptionID - Microsoft Azure subscription ID. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*PolicyTrackedResourcesClient) NewListQueryResultsForManagementGroupPager added in v0.4.0

NewListQueryResultsForManagementGroupPager - Queries policy tracked resources under the management group. Generated from API version 2018-07-01-preview managementGroupName - Management group name. policyTrackedResourcesResource - The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyTrackedResourcesClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method.

Example (QueryAtManagementGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForManagementGroupPager("myManagementGroup", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtManagementGroupScopeUsingQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryManagementGroupScopeWithFilterAndTop.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForManagementGroupPager("myManagementGroup", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment' AND TrackedResourceId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyTrackedResourcesClient) NewListQueryResultsForResourceGroupPager added in v0.4.0

NewListQueryResultsForResourceGroupPager - Queries policy tracked resources under the resource group. Generated from API version 2018-07-01-preview resourceGroupName - Resource group name. policyTrackedResourcesResource - The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyTrackedResourcesClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForResourceGroup method.

Example (QueryAtResourceGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("fffedd8f-ffff-fffd-fffd-fffed2f84852", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupPager("myResourceGroup", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtResourceGroupScopeUsingQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceGroupScopeWithFilterAndTop.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("fffedd8f-ffff-fffd-fffd-fffed2f84852", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourceGroupPager("myResourceGroup", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment' AND TrackedResourceId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyTrackedResourcesClient) NewListQueryResultsForResourcePager added in v0.4.0

NewListQueryResultsForResourcePager - Queries policy tracked resources under the resource. Generated from API version 2018-07-01-preview resourceID - Resource ID. policyTrackedResourcesResource - The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyTrackedResourcesClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForResource method.

Example (QueryAtResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager("subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtResourceScopeUsingQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QueryResourceScopeWithFilterAndTop.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForResourcePager("subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource", armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment' AND TrackedResourceId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*PolicyTrackedResourcesClient) NewListQueryResultsForSubscriptionPager added in v0.4.0

NewListQueryResultsForSubscriptionPager - Queries policy tracked resources under the subscription. Generated from API version 2018-07-01-preview policyTrackedResourcesResource - The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - PolicyTrackedResourcesClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForSubscription method.

Example (QueryAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("fffedd8f-ffff-fffd-fffd-fffed2f84852", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (QueryAtSubscriptionScopeUsingQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/preview/2018-07-01-preview/examples/PolicyTrackedResources_QuerySubscriptionScopeWithFilterAndTop.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewPolicyTrackedResourcesClient("fffedd8f-ffff-fffd-fffd-fffed2f84852", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListQueryResultsForSubscriptionPager(armpolicyinsights.PolicyTrackedResourcesResourceTypeDefault, &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment' AND TrackedResourceId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type PolicyTrackedResourcesClientListQueryResultsForManagementGroupOptions

type PolicyTrackedResourcesClientListQueryResultsForManagementGroupOptions struct {
}

PolicyTrackedResourcesClientListQueryResultsForManagementGroupOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method.

type PolicyTrackedResourcesClientListQueryResultsForManagementGroupResponse

type PolicyTrackedResourcesClientListQueryResultsForManagementGroupResponse struct {
	PolicyTrackedResourcesQueryResults
}

PolicyTrackedResourcesClientListQueryResultsForManagementGroupResponse contains the response from method PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup.

type PolicyTrackedResourcesClientListQueryResultsForResourceGroupOptions

type PolicyTrackedResourcesClientListQueryResultsForResourceGroupOptions struct {
}

PolicyTrackedResourcesClientListQueryResultsForResourceGroupOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForResourceGroup method.

type PolicyTrackedResourcesClientListQueryResultsForResourceGroupResponse

type PolicyTrackedResourcesClientListQueryResultsForResourceGroupResponse struct {
	PolicyTrackedResourcesQueryResults
}

PolicyTrackedResourcesClientListQueryResultsForResourceGroupResponse contains the response from method PolicyTrackedResourcesClient.ListQueryResultsForResourceGroup.

type PolicyTrackedResourcesClientListQueryResultsForResourceOptions

type PolicyTrackedResourcesClientListQueryResultsForResourceOptions struct {
}

PolicyTrackedResourcesClientListQueryResultsForResourceOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForResource method.

type PolicyTrackedResourcesClientListQueryResultsForResourceResponse

type PolicyTrackedResourcesClientListQueryResultsForResourceResponse struct {
	PolicyTrackedResourcesQueryResults
}

PolicyTrackedResourcesClientListQueryResultsForResourceResponse contains the response from method PolicyTrackedResourcesClient.ListQueryResultsForResource.

type PolicyTrackedResourcesClientListQueryResultsForSubscriptionOptions

type PolicyTrackedResourcesClientListQueryResultsForSubscriptionOptions struct {
}

PolicyTrackedResourcesClientListQueryResultsForSubscriptionOptions contains the optional parameters for the PolicyTrackedResourcesClient.ListQueryResultsForSubscription method.

type PolicyTrackedResourcesClientListQueryResultsForSubscriptionResponse

type PolicyTrackedResourcesClientListQueryResultsForSubscriptionResponse struct {
	PolicyTrackedResourcesQueryResults
}

PolicyTrackedResourcesClientListQueryResultsForSubscriptionResponse contains the response from method PolicyTrackedResourcesClient.ListQueryResultsForSubscription.

type PolicyTrackedResourcesQueryResults

type PolicyTrackedResourcesQueryResults struct {
	// READ-ONLY; The URL to get the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; Query results.
	Value []*PolicyTrackedResource `json:"value,omitempty" azure:"ro"`
}

PolicyTrackedResourcesQueryResults - Query results.

func (PolicyTrackedResourcesQueryResults) MarshalJSON

func (p PolicyTrackedResourcesQueryResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PolicyTrackedResourcesQueryResults.

func (*PolicyTrackedResourcesQueryResults) UnmarshalJSON added in v0.6.0

func (p *PolicyTrackedResourcesQueryResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PolicyTrackedResourcesQueryResults.

type PolicyTrackedResourcesResourceType added in v0.2.0

type PolicyTrackedResourcesResourceType string
const (
	PolicyTrackedResourcesResourceTypeDefault PolicyTrackedResourcesResourceType = "default"
)

func PossiblePolicyTrackedResourcesResourceTypeValues added in v0.2.0

func PossiblePolicyTrackedResourcesResourceTypeValues() []PolicyTrackedResourcesResourceType

PossiblePolicyTrackedResourcesResourceTypeValues returns the possible values for the PolicyTrackedResourcesResourceType const type.

type QueryFailure

type QueryFailure struct {
	// Error definition.
	Error *QueryFailureError `json:"error,omitempty"`
}

QueryFailure - Error response.

func (QueryFailure) MarshalJSON added in v0.6.0

func (q QueryFailure) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryFailure.

func (*QueryFailure) UnmarshalJSON added in v0.6.0

func (q *QueryFailure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryFailure.

type QueryFailureError

type QueryFailureError struct {
	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string `json:"code,omitempty" azure:"ro"`

	// READ-ONLY; Description of the error.
	Message *string `json:"message,omitempty" azure:"ro"`
}

QueryFailureError - Error definition.

func (QueryFailureError) MarshalJSON added in v0.6.0

func (q QueryFailureError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type QueryFailureError.

func (*QueryFailureError) UnmarshalJSON added in v0.6.0

func (q *QueryFailureError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type QueryFailureError.

type QueryOptions

type QueryOptions struct {
	// OData apply expression for aggregations.
	Apply *string
	// The $expand query parameter. For example, to expand components use $expand=components
	Expand *string
	// OData filter expression.
	Filter *string
	// ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to
	// - 1-day).
	From *time.Time
	// Ordering expression using OData notation. One or more comma-separated column names with an optional "desc" (the default)
	// or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc".
	OrderBy *string
	// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId,
	// ResourceId".
	Select *string
	// Skiptoken is only provided if a previous response returned a partial result as a part of nextLink element.
	SkipToken *string
	// ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request
	// time.
	To *time.Time
	// Maximum number of records to return.
	Top *int32
}

QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method.

type Remediation

type Remediation struct {
	// Properties for the remediation.
	Properties *RemediationProperties `json:"properties,omitempty"`

	// READ-ONLY; The ID of the remediation.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the remediation.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

	// READ-ONLY; The type of the remediation.
	Type *string `json:"type,omitempty" azure:"ro"`
}

Remediation - The remediation definition.

func (Remediation) MarshalJSON added in v0.6.0

func (r Remediation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Remediation.

func (*Remediation) UnmarshalJSON added in v0.6.0

func (r *Remediation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Remediation.

type RemediationDeployment

type RemediationDeployment struct {
	// READ-ONLY; The time at which the remediation was created.
	CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"`

	// READ-ONLY; Resource ID of the template deployment that will remediate the resource.
	DeploymentID *string `json:"deploymentId,omitempty" azure:"ro"`

	// READ-ONLY; Error encountered while remediated the resource.
	Error *ErrorDefinition `json:"error,omitempty" azure:"ro"`

	// READ-ONLY; The time at which the remediation deployment was last updated.
	LastUpdatedOn *time.Time `json:"lastUpdatedOn,omitempty" azure:"ro"`

	// READ-ONLY; Resource ID of the resource that is being remediated by the deployment.
	RemediatedResourceID *string `json:"remediatedResourceId,omitempty" azure:"ro"`

	// READ-ONLY; Location of the resource that is being remediated.
	ResourceLocation *string `json:"resourceLocation,omitempty" azure:"ro"`

	// READ-ONLY; Status of the remediation deployment.
	Status *string `json:"status,omitempty" azure:"ro"`
}

RemediationDeployment - Details of a single deployment created by the remediation.

func (RemediationDeployment) MarshalJSON

func (r RemediationDeployment) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationDeployment.

func (*RemediationDeployment) UnmarshalJSON

func (r *RemediationDeployment) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationDeployment.

type RemediationDeploymentSummary

type RemediationDeploymentSummary struct {
	// READ-ONLY; The number of deployments required by the remediation that have failed.
	FailedDeployments *int32 `json:"failedDeployments,omitempty" azure:"ro"`

	// READ-ONLY; The number of deployments required by the remediation that have succeeded.
	SuccessfulDeployments *int32 `json:"successfulDeployments,omitempty" azure:"ro"`

	// READ-ONLY; The number of deployments required by the remediation.
	TotalDeployments *int32 `json:"totalDeployments,omitempty" azure:"ro"`
}

RemediationDeploymentSummary - The deployment status summary for all deployments created by the remediation.

func (RemediationDeploymentSummary) MarshalJSON added in v0.6.0

func (r RemediationDeploymentSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationDeploymentSummary.

func (*RemediationDeploymentSummary) UnmarshalJSON added in v0.6.0

func (r *RemediationDeploymentSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationDeploymentSummary.

type RemediationDeploymentsListResult

type RemediationDeploymentsListResult struct {
	// READ-ONLY; The URL to get the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; Array of deployments for the remediation.
	Value []*RemediationDeployment `json:"value,omitempty" azure:"ro"`
}

RemediationDeploymentsListResult - List of deployments for a remediation.

func (RemediationDeploymentsListResult) MarshalJSON

func (r RemediationDeploymentsListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationDeploymentsListResult.

func (*RemediationDeploymentsListResult) UnmarshalJSON added in v0.6.0

func (r *RemediationDeploymentsListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationDeploymentsListResult.

type RemediationFilters

type RemediationFilters struct {
	// The resource locations that will be remediated.
	Locations []*string `json:"locations,omitempty"`
}

RemediationFilters - The filters that will be applied to determine which resources to remediate.

func (RemediationFilters) MarshalJSON

func (r RemediationFilters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationFilters.

func (*RemediationFilters) UnmarshalJSON added in v0.6.0

func (r *RemediationFilters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationFilters.

type RemediationListResult

type RemediationListResult struct {
	// READ-ONLY; The URL to get the next set of results.
	NextLink *string `json:"nextLink,omitempty" azure:"ro"`

	// READ-ONLY; Array of remediation definitions.
	Value []*Remediation `json:"value,omitempty" azure:"ro"`
}

RemediationListResult - List of remediations.

func (RemediationListResult) MarshalJSON

func (r RemediationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationListResult.

func (*RemediationListResult) UnmarshalJSON added in v0.6.0

func (r *RemediationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationListResult.

type RemediationProperties

type RemediationProperties struct {
	// The remediation failure threshold settings
	FailureThreshold *RemediationPropertiesFailureThreshold `json:"failureThreshold,omitempty"`

	// The filters that will be applied to determine which resources to remediate.
	Filters *RemediationFilters `json:"filters,omitempty"`

	// Determines how many resources to remediate at any given time. Can be used to increase or reduce the pace of the remediation.
	// If not provided, the default parallel deployments value is used.
	ParallelDeployments *int32 `json:"parallelDeployments,omitempty"`

	// The resource ID of the policy assignment that should be remediated.
	PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"`

	// The policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment
	// being remediated assigns a policy set definition.
	PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"`

	// Determines the max number of resources that can be remediated by the remediation job. If not provided, the default resource
	// count is used.
	ResourceCount *int32 `json:"resourceCount,omitempty"`

	// The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified.
	ResourceDiscoveryMode *ResourceDiscoveryMode `json:"resourceDiscoveryMode,omitempty"`

	// READ-ONLY; The remediation correlation Id. Can be used to find events related to the remediation in the activity log.
	CorrelationID *string `json:"correlationId,omitempty" azure:"ro"`

	// READ-ONLY; The time at which the remediation was created.
	CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"`

	// READ-ONLY; The deployment status summary for all deployments created by the remediation.
	DeploymentStatus *RemediationDeploymentSummary `json:"deploymentStatus,omitempty" azure:"ro"`

	// READ-ONLY; The time at which the remediation was last updated.
	LastUpdatedOn *time.Time `json:"lastUpdatedOn,omitempty" azure:"ro"`

	// READ-ONLY; The status of the remediation.
	ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"`

	// READ-ONLY; The remediation status message. Provides additional details regarding the state of the remediation.
	StatusMessage *string `json:"statusMessage,omitempty" azure:"ro"`
}

RemediationProperties - The remediation properties.

func (RemediationProperties) MarshalJSON

func (r RemediationProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationProperties.

func (*RemediationProperties) UnmarshalJSON

func (r *RemediationProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationProperties.

type RemediationPropertiesFailureThreshold

type RemediationPropertiesFailureThreshold struct {
	// A number between 0.0 to 1.0 representing the percentage failure threshold. The remediation will fail if the percentage
	// of failed remediation operations (i.e. failed deployments) exceeds this
	// threshold.
	Percentage *float32 `json:"percentage,omitempty"`
}

RemediationPropertiesFailureThreshold - The remediation failure threshold settings

func (RemediationPropertiesFailureThreshold) MarshalJSON added in v0.6.0

func (r RemediationPropertiesFailureThreshold) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RemediationPropertiesFailureThreshold.

func (*RemediationPropertiesFailureThreshold) UnmarshalJSON added in v0.6.0

func (r *RemediationPropertiesFailureThreshold) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RemediationPropertiesFailureThreshold.

type RemediationsClient

type RemediationsClient struct {
	// contains filtered or unexported fields
}

RemediationsClient contains the methods for the Remediations group. Don't use this type directly, use NewRemediationsClient() instead.

func NewRemediationsClient

func NewRemediationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RemediationsClient, error)

NewRemediationsClient creates a new instance of RemediationsClient with the specified values. subscriptionID - Microsoft Azure subscription ID. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*RemediationsClient) CancelAtManagementGroup

func (client *RemediationsClient) CancelAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, options *RemediationsClientCancelAtManagementGroupOptions) (RemediationsClientCancelAtManagementGroupResponse, error)

CancelAtManagementGroup - Cancels a remediation at management group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 managementGroupID - Management group ID. remediationName - The name of the remediation. options - RemediationsClientCancelAtManagementGroupOptions contains the optional parameters for the RemediationsClient.CancelAtManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CancelAtManagementGroup(ctx, "financeMg", "myRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CancelAtResource

func (client *RemediationsClient) CancelAtResource(ctx context.Context, resourceID string, remediationName string, options *RemediationsClientCancelAtResourceOptions) (RemediationsClientCancelAtResourceResponse, error)

CancelAtResource - Cancel a remediation at resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceID - Resource ID. remediationName - The name of the remediation. options - RemediationsClientCancelAtResourceOptions contains the optional parameters for the RemediationsClient.CancelAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CancelAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", "myRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CancelAtResourceGroup

func (client *RemediationsClient) CancelAtResourceGroup(ctx context.Context, resourceGroupName string, remediationName string, options *RemediationsClientCancelAtResourceGroupOptions) (RemediationsClientCancelAtResourceGroupResponse, error)

CancelAtResourceGroup - Cancels a remediation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceGroupName - Resource group name. remediationName - The name of the remediation. options - RemediationsClientCancelAtResourceGroupOptions contains the optional parameters for the RemediationsClient.CancelAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CancelAtResourceGroup(ctx, "myResourceGroup", "myRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CancelAtSubscription

CancelAtSubscription - Cancels a remediation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 remediationName - The name of the remediation. options - RemediationsClientCancelAtSubscriptionOptions contains the optional parameters for the RemediationsClient.CancelAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CancelSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CancelAtSubscription(ctx, "myRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CreateOrUpdateAtManagementGroup

func (client *RemediationsClient) CreateOrUpdateAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, parameters Remediation, options *RemediationsClientCreateOrUpdateAtManagementGroupOptions) (RemediationsClientCreateOrUpdateAtManagementGroupResponse, error)

CreateOrUpdateAtManagementGroup - Creates or updates a remediation at management group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 managementGroupID - Management group ID. remediationName - The name of the remediation. parameters - The remediation parameters. options - RemediationsClientCreateOrUpdateAtManagementGroupOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateOrUpdateAtManagementGroup(ctx, "financeMg", "storageRemediation", armpolicyinsights.Remediation{
		Properties: &armpolicyinsights.RemediationProperties{
			PolicyAssignmentID: to.Ptr("/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CreateOrUpdateAtResource

func (client *RemediationsClient) CreateOrUpdateAtResource(ctx context.Context, resourceID string, remediationName string, parameters Remediation, options *RemediationsClientCreateOrUpdateAtResourceOptions) (RemediationsClientCreateOrUpdateAtResourceResponse, error)

CreateOrUpdateAtResource - Creates or updates a remediation at resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceID - Resource ID. remediationName - The name of the remediation. parameters - The remediation parameters. options - RemediationsClientCreateOrUpdateAtResourceOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateOrUpdateAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", "storageRemediation", armpolicyinsights.Remediation{
		Properties: &armpolicyinsights.RemediationProperties{
			PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CreateOrUpdateAtResourceGroup

func (client *RemediationsClient) CreateOrUpdateAtResourceGroup(ctx context.Context, resourceGroupName string, remediationName string, parameters Remediation, options *RemediationsClientCreateOrUpdateAtResourceGroupOptions) (RemediationsClientCreateOrUpdateAtResourceGroupResponse, error)

CreateOrUpdateAtResourceGroup - Creates or updates a remediation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceGroupName - Resource group name. remediationName - The name of the remediation. parameters - The remediation parameters. options - RemediationsClientCreateOrUpdateAtResourceGroupOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateOrUpdateAtResourceGroup(ctx, "myResourceGroup", "storageRemediation", armpolicyinsights.Remediation{
		Properties: &armpolicyinsights.RemediationProperties{
			PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) CreateOrUpdateAtSubscription

CreateOrUpdateAtSubscription - Creates or updates a remediation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 remediationName - The name of the remediation. parameters - The remediation parameters. options - RemediationsClientCreateOrUpdateAtSubscriptionOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtSubscription method.

Example (CreateRemediationAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateOrUpdateAtSubscription(ctx, "storageRemediation", armpolicyinsights.Remediation{
		Properties: &armpolicyinsights.RemediationProperties{
			PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

Example (CreateRemediationAtSubscriptionScopeWithAllProperties)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_CreateSubscriptionScope_AllProperties.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateOrUpdateAtSubscription(ctx, "storageRemediation", armpolicyinsights.Remediation{
		Properties: &armpolicyinsights.RemediationProperties{
			FailureThreshold: &armpolicyinsights.RemediationPropertiesFailureThreshold{
				Percentage: to.Ptr[float32](0.1),
			},
			Filters: &armpolicyinsights.RemediationFilters{
				Locations: []*string{
					to.Ptr("eastus"),
					to.Ptr("westus")},
			},
			ParallelDeployments:         to.Ptr[int32](6),
			PolicyAssignmentID:          to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
			PolicyDefinitionReferenceID: to.Ptr("8c8fa9e4"),
			ResourceCount:               to.Ptr[int32](42),
			ResourceDiscoveryMode:       to.Ptr(armpolicyinsights.ResourceDiscoveryModeReEvaluateCompliance),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) DeleteAtManagementGroup

func (client *RemediationsClient) DeleteAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, options *RemediationsClientDeleteAtManagementGroupOptions) (RemediationsClientDeleteAtManagementGroupResponse, error)

DeleteAtManagementGroup - Deletes an existing remediation at management group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 managementGroupID - Management group ID. remediationName - The name of the remediation. options - RemediationsClientDeleteAtManagementGroupOptions contains the optional parameters for the RemediationsClient.DeleteAtManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.DeleteAtManagementGroup(ctx, "financeMg", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) DeleteAtResource

func (client *RemediationsClient) DeleteAtResource(ctx context.Context, resourceID string, remediationName string, options *RemediationsClientDeleteAtResourceOptions) (RemediationsClientDeleteAtResourceResponse, error)

DeleteAtResource - Deletes an existing remediation at individual resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceID - Resource ID. remediationName - The name of the remediation. options - RemediationsClientDeleteAtResourceOptions contains the optional parameters for the RemediationsClient.DeleteAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.DeleteAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) DeleteAtResourceGroup

func (client *RemediationsClient) DeleteAtResourceGroup(ctx context.Context, resourceGroupName string, remediationName string, options *RemediationsClientDeleteAtResourceGroupOptions) (RemediationsClientDeleteAtResourceGroupResponse, error)

DeleteAtResourceGroup - Deletes an existing remediation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceGroupName - Resource group name. remediationName - The name of the remediation. options - RemediationsClientDeleteAtResourceGroupOptions contains the optional parameters for the RemediationsClient.DeleteAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.DeleteAtResourceGroup(ctx, "myResourceGroup", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) DeleteAtSubscription

DeleteAtSubscription - Deletes an existing remediation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 remediationName - The name of the remediation. options - RemediationsClientDeleteAtSubscriptionOptions contains the optional parameters for the RemediationsClient.DeleteAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_DeleteSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.DeleteAtSubscription(ctx, "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) GetAtManagementGroup

func (client *RemediationsClient) GetAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, options *RemediationsClientGetAtManagementGroupOptions) (RemediationsClientGetAtManagementGroupResponse, error)

GetAtManagementGroup - Gets an existing remediation at management group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 managementGroupID - Management group ID. remediationName - The name of the remediation. options - RemediationsClientGetAtManagementGroupOptions contains the optional parameters for the RemediationsClient.GetAtManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtManagementGroup(ctx, "financeMg", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) GetAtResource

func (client *RemediationsClient) GetAtResource(ctx context.Context, resourceID string, remediationName string, options *RemediationsClientGetAtResourceOptions) (RemediationsClientGetAtResourceResponse, error)

GetAtResource - Gets an existing remediation at resource scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceID - Resource ID. remediationName - The name of the remediation. options - RemediationsClientGetAtResourceOptions contains the optional parameters for the RemediationsClient.GetAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtResource(ctx, "subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) GetAtResourceGroup

func (client *RemediationsClient) GetAtResourceGroup(ctx context.Context, resourceGroupName string, remediationName string, options *RemediationsClientGetAtResourceGroupOptions) (RemediationsClientGetAtResourceGroupResponse, error)

GetAtResourceGroup - Gets an existing remediation at resource group scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 resourceGroupName - Resource group name. remediationName - The name of the remediation. options - RemediationsClientGetAtResourceGroupOptions contains the optional parameters for the RemediationsClient.GetAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtResourceGroup(ctx, "myResourceGroup", "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) GetAtSubscription

GetAtSubscription - Gets an existing remediation at subscription scope. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-10-01 remediationName - The name of the remediation. options - RemediationsClientGetAtSubscriptionOptions contains the optional parameters for the RemediationsClient.GetAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_GetSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.GetAtSubscription(ctx, "storageRemediation", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RemediationsClient) NewListDeploymentsAtManagementGroupPager added in v0.4.0

func (client *RemediationsClient) NewListDeploymentsAtManagementGroupPager(managementGroupID string, remediationName string, queryOptions *QueryOptions, options *RemediationsClientListDeploymentsAtManagementGroupOptions) *runtime.Pager[RemediationsClientListDeploymentsAtManagementGroupResponse]

NewListDeploymentsAtManagementGroupPager - Gets all deployments for a remediation at management group scope. Generated from API version 2021-10-01 managementGroupID - Management group ID. remediationName - The name of the remediation. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListDeploymentsAtManagementGroupOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtManagementGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListDeploymentsAtManagementGroupPager("financeMg", "myRemediation", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListDeploymentsAtResourceGroupPager added in v0.4.0

func (client *RemediationsClient) NewListDeploymentsAtResourceGroupPager(resourceGroupName string, remediationName string, queryOptions *QueryOptions, options *RemediationsClientListDeploymentsAtResourceGroupOptions) *runtime.Pager[RemediationsClientListDeploymentsAtResourceGroupResponse]

NewListDeploymentsAtResourceGroupPager - Gets all deployments for a remediation at resource group scope. Generated from API version 2021-10-01 resourceGroupName - Resource group name. remediationName - The name of the remediation. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListDeploymentsAtResourceGroupOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListDeploymentsAtResourceGroupPager("myResourceGroup", "myRemediation", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListDeploymentsAtResourcePager added in v0.4.0

func (client *RemediationsClient) NewListDeploymentsAtResourcePager(resourceID string, remediationName string, queryOptions *QueryOptions, options *RemediationsClientListDeploymentsAtResourceOptions) *runtime.Pager[RemediationsClientListDeploymentsAtResourceResponse]

NewListDeploymentsAtResourcePager - Gets all deployments for a remediation at resource scope. Generated from API version 2021-10-01 resourceID - Resource ID. remediationName - The name of the remediation. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListDeploymentsAtResourceOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtResource method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListDeploymentsAtResourcePager("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", "myRemediation", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListDeploymentsAtSubscriptionPager added in v0.4.0

func (client *RemediationsClient) NewListDeploymentsAtSubscriptionPager(remediationName string, queryOptions *QueryOptions, options *RemediationsClientListDeploymentsAtSubscriptionOptions) *runtime.Pager[RemediationsClientListDeploymentsAtSubscriptionResponse]

NewListDeploymentsAtSubscriptionPager - Gets all deployments for a remediation at subscription scope. Generated from API version 2021-10-01 remediationName - The name of the remediation. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListDeploymentsAtSubscriptionOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtSubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListDeploymentsSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListDeploymentsAtSubscriptionPager("myRemediation", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListForManagementGroupPager added in v0.4.0

func (client *RemediationsClient) NewListForManagementGroupPager(managementGroupID string, queryOptions *QueryOptions, options *RemediationsClientListForManagementGroupOptions) *runtime.Pager[RemediationsClientListForManagementGroupResponse]

NewListForManagementGroupPager - Gets all remediations for the management group. Generated from API version 2021-10-01 managementGroupID - Management group ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListForManagementGroupOptions contains the optional parameters for the RemediationsClient.ListForManagementGroup method.

Example (ListRemediationsAtManagementGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForManagementGroupPager("financeMg", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListRemediationsAtManagementGroupScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListManagementGroupScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForManagementGroupPager("financeMg", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/providers/microsoft.management/managementGroups/financeMg/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListForResourceGroupPager added in v0.4.0

func (client *RemediationsClient) NewListForResourceGroupPager(resourceGroupName string, queryOptions *QueryOptions, options *RemediationsClientListForResourceGroupOptions) *runtime.Pager[RemediationsClientListForResourceGroupResponse]

NewListForResourceGroupPager - Gets all remediations for the subscription. Generated from API version 2021-10-01 resourceGroupName - Resource group name. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListForResourceGroupOptions contains the optional parameters for the RemediationsClient.ListForResourceGroup method.

Example (ListRemediationsAtResourceGroupScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourceGroupPager("myResourceGroup", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListRemediationsAtResourceGroupScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceGroupScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourceGroupPager("myResourceGroup", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourceGroups/myResourceGroup/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListForResourcePager added in v0.4.0

func (client *RemediationsClient) NewListForResourcePager(resourceID string, queryOptions *QueryOptions, options *RemediationsClientListForResourceOptions) *runtime.Pager[RemediationsClientListForResourceResponse]

NewListForResourcePager - Gets all remediations for a resource. Generated from API version 2021-10-01 resourceID - Resource ID. QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListForResourceOptions contains the optional parameters for the RemediationsClient.ListForResource method.

Example (ListRemediationsAtIndividualResourceScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourcePager("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", &armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListRemediationsAtIndividualResourceScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListResourceScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForResourcePager("subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storAc1", &armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*RemediationsClient) NewListForSubscriptionPager added in v0.4.0

NewListForSubscriptionPager - Gets all remediations for the subscription. Generated from API version 2021-10-01 QueryOptions - QueryOptions contains a group of parameters for the PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup method. options - RemediationsClientListForSubscriptionOptions contains the optional parameters for the RemediationsClient.ListForSubscription method.

Example (ListRemediationsAtSubscriptionScope)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: nil,
		Filter:    nil,
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

Example (ListRemediationsAtSubscriptionScopeWithQueryParameters)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2021-10-01/examples/Remediations_ListSubscriptionScope_WithQuery.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armpolicyinsights.NewRemediationsClient("35ee058e-5fa0-414c-8145-3ebb8d09b6e2", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListForSubscriptionPager(&armpolicyinsights.QueryOptions{Top: to.Ptr[int32](1),
		Filter:    to.Ptr("PolicyAssignmentId eq '/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5' AND PolicyDefinitionReferenceId eq 'storageSkuDef'"),
		OrderBy:   nil,
		Select:    nil,
		From:      nil,
		To:        nil,
		Apply:     nil,
		SkipToken: nil,
		Expand:    nil,
	}, nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type RemediationsClientCancelAtManagementGroupOptions

type RemediationsClientCancelAtManagementGroupOptions struct {
}

RemediationsClientCancelAtManagementGroupOptions contains the optional parameters for the RemediationsClient.CancelAtManagementGroup method.

type RemediationsClientCancelAtManagementGroupResponse

type RemediationsClientCancelAtManagementGroupResponse struct {
	Remediation
}

RemediationsClientCancelAtManagementGroupResponse contains the response from method RemediationsClient.CancelAtManagementGroup.

type RemediationsClientCancelAtResourceGroupOptions

type RemediationsClientCancelAtResourceGroupOptions struct {
}

RemediationsClientCancelAtResourceGroupOptions contains the optional parameters for the RemediationsClient.CancelAtResourceGroup method.

type RemediationsClientCancelAtResourceGroupResponse

type RemediationsClientCancelAtResourceGroupResponse struct {
	Remediation
}

RemediationsClientCancelAtResourceGroupResponse contains the response from method RemediationsClient.CancelAtResourceGroup.

type RemediationsClientCancelAtResourceOptions

type RemediationsClientCancelAtResourceOptions struct {
}

RemediationsClientCancelAtResourceOptions contains the optional parameters for the RemediationsClient.CancelAtResource method.

type RemediationsClientCancelAtResourceResponse

type RemediationsClientCancelAtResourceResponse struct {
	Remediation
}

RemediationsClientCancelAtResourceResponse contains the response from method RemediationsClient.CancelAtResource.

type RemediationsClientCancelAtSubscriptionOptions

type RemediationsClientCancelAtSubscriptionOptions struct {
}

RemediationsClientCancelAtSubscriptionOptions contains the optional parameters for the RemediationsClient.CancelAtSubscription method.

type RemediationsClientCancelAtSubscriptionResponse

type RemediationsClientCancelAtSubscriptionResponse struct {
	Remediation
}

RemediationsClientCancelAtSubscriptionResponse contains the response from method RemediationsClient.CancelAtSubscription.

type RemediationsClientCreateOrUpdateAtManagementGroupOptions

type RemediationsClientCreateOrUpdateAtManagementGroupOptions struct {
}

RemediationsClientCreateOrUpdateAtManagementGroupOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtManagementGroup method.

type RemediationsClientCreateOrUpdateAtManagementGroupResponse

type RemediationsClientCreateOrUpdateAtManagementGroupResponse struct {
	Remediation
}

RemediationsClientCreateOrUpdateAtManagementGroupResponse contains the response from method RemediationsClient.CreateOrUpdateAtManagementGroup.

type RemediationsClientCreateOrUpdateAtResourceGroupOptions

type RemediationsClientCreateOrUpdateAtResourceGroupOptions struct {
}

RemediationsClientCreateOrUpdateAtResourceGroupOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtResourceGroup method.

type RemediationsClientCreateOrUpdateAtResourceGroupResponse

type RemediationsClientCreateOrUpdateAtResourceGroupResponse struct {
	Remediation
}

RemediationsClientCreateOrUpdateAtResourceGroupResponse contains the response from method RemediationsClient.CreateOrUpdateAtResourceGroup.

type RemediationsClientCreateOrUpdateAtResourceOptions

type RemediationsClientCreateOrUpdateAtResourceOptions struct {
}

RemediationsClientCreateOrUpdateAtResourceOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtResource method.

type RemediationsClientCreateOrUpdateAtResourceResponse

type RemediationsClientCreateOrUpdateAtResourceResponse struct {
	Remediation
}

RemediationsClientCreateOrUpdateAtResourceResponse contains the response from method RemediationsClient.CreateOrUpdateAtResource.

type RemediationsClientCreateOrUpdateAtSubscriptionOptions

type RemediationsClientCreateOrUpdateAtSubscriptionOptions struct {
}

RemediationsClientCreateOrUpdateAtSubscriptionOptions contains the optional parameters for the RemediationsClient.CreateOrUpdateAtSubscription method.

type RemediationsClientCreateOrUpdateAtSubscriptionResponse

type RemediationsClientCreateOrUpdateAtSubscriptionResponse struct {
	Remediation
}

RemediationsClientCreateOrUpdateAtSubscriptionResponse contains the response from method RemediationsClient.CreateOrUpdateAtSubscription.

type RemediationsClientDeleteAtManagementGroupOptions

type RemediationsClientDeleteAtManagementGroupOptions struct {
}

RemediationsClientDeleteAtManagementGroupOptions contains the optional parameters for the RemediationsClient.DeleteAtManagementGroup method.

type RemediationsClientDeleteAtManagementGroupResponse

type RemediationsClientDeleteAtManagementGroupResponse struct {
	Remediation
}

RemediationsClientDeleteAtManagementGroupResponse contains the response from method RemediationsClient.DeleteAtManagementGroup.

type RemediationsClientDeleteAtResourceGroupOptions

type RemediationsClientDeleteAtResourceGroupOptions struct {
}

RemediationsClientDeleteAtResourceGroupOptions contains the optional parameters for the RemediationsClient.DeleteAtResourceGroup method.

type RemediationsClientDeleteAtResourceGroupResponse

type RemediationsClientDeleteAtResourceGroupResponse struct {
	Remediation
}

RemediationsClientDeleteAtResourceGroupResponse contains the response from method RemediationsClient.DeleteAtResourceGroup.

type RemediationsClientDeleteAtResourceOptions

type RemediationsClientDeleteAtResourceOptions struct {
}

RemediationsClientDeleteAtResourceOptions contains the optional parameters for the RemediationsClient.DeleteAtResource method.

type RemediationsClientDeleteAtResourceResponse

type RemediationsClientDeleteAtResourceResponse struct {
	Remediation
}

RemediationsClientDeleteAtResourceResponse contains the response from method RemediationsClient.DeleteAtResource.

type RemediationsClientDeleteAtSubscriptionOptions

type RemediationsClientDeleteAtSubscriptionOptions struct {
}

RemediationsClientDeleteAtSubscriptionOptions contains the optional parameters for the RemediationsClient.DeleteAtSubscription method.

type RemediationsClientDeleteAtSubscriptionResponse

type RemediationsClientDeleteAtSubscriptionResponse struct {
	Remediation
}

RemediationsClientDeleteAtSubscriptionResponse contains the response from method RemediationsClient.DeleteAtSubscription.

type RemediationsClientGetAtManagementGroupOptions

type RemediationsClientGetAtManagementGroupOptions struct {
}

RemediationsClientGetAtManagementGroupOptions contains the optional parameters for the RemediationsClient.GetAtManagementGroup method.

type RemediationsClientGetAtManagementGroupResponse

type RemediationsClientGetAtManagementGroupResponse struct {
	Remediation
}

RemediationsClientGetAtManagementGroupResponse contains the response from method RemediationsClient.GetAtManagementGroup.

type RemediationsClientGetAtResourceGroupOptions

type RemediationsClientGetAtResourceGroupOptions struct {
}

RemediationsClientGetAtResourceGroupOptions contains the optional parameters for the RemediationsClient.GetAtResourceGroup method.

type RemediationsClientGetAtResourceGroupResponse

type RemediationsClientGetAtResourceGroupResponse struct {
	Remediation
}

RemediationsClientGetAtResourceGroupResponse contains the response from method RemediationsClient.GetAtResourceGroup.

type RemediationsClientGetAtResourceOptions

type RemediationsClientGetAtResourceOptions struct {
}

RemediationsClientGetAtResourceOptions contains the optional parameters for the RemediationsClient.GetAtResource method.

type RemediationsClientGetAtResourceResponse

type RemediationsClientGetAtResourceResponse struct {
	Remediation
}

RemediationsClientGetAtResourceResponse contains the response from method RemediationsClient.GetAtResource.

type RemediationsClientGetAtSubscriptionOptions

type RemediationsClientGetAtSubscriptionOptions struct {
}

RemediationsClientGetAtSubscriptionOptions contains the optional parameters for the RemediationsClient.GetAtSubscription method.

type RemediationsClientGetAtSubscriptionResponse

type RemediationsClientGetAtSubscriptionResponse struct {
	Remediation
}

RemediationsClientGetAtSubscriptionResponse contains the response from method RemediationsClient.GetAtSubscription.

type RemediationsClientListDeploymentsAtManagementGroupOptions

type RemediationsClientListDeploymentsAtManagementGroupOptions struct {
}

RemediationsClientListDeploymentsAtManagementGroupOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtManagementGroup method.

type RemediationsClientListDeploymentsAtManagementGroupResponse

type RemediationsClientListDeploymentsAtManagementGroupResponse struct {
	RemediationDeploymentsListResult
}

RemediationsClientListDeploymentsAtManagementGroupResponse contains the response from method RemediationsClient.ListDeploymentsAtManagementGroup.

type RemediationsClientListDeploymentsAtResourceGroupOptions

type RemediationsClientListDeploymentsAtResourceGroupOptions struct {
}

RemediationsClientListDeploymentsAtResourceGroupOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtResourceGroup method.

type RemediationsClientListDeploymentsAtResourceGroupResponse

type RemediationsClientListDeploymentsAtResourceGroupResponse struct {
	RemediationDeploymentsListResult
}

RemediationsClientListDeploymentsAtResourceGroupResponse contains the response from method RemediationsClient.ListDeploymentsAtResourceGroup.

type RemediationsClientListDeploymentsAtResourceOptions

type RemediationsClientListDeploymentsAtResourceOptions struct {
}

RemediationsClientListDeploymentsAtResourceOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtResource method.

type RemediationsClientListDeploymentsAtResourceResponse

type RemediationsClientListDeploymentsAtResourceResponse struct {
	RemediationDeploymentsListResult
}

RemediationsClientListDeploymentsAtResourceResponse contains the response from method RemediationsClient.ListDeploymentsAtResource.

type RemediationsClientListDeploymentsAtSubscriptionOptions

type RemediationsClientListDeploymentsAtSubscriptionOptions struct {
}

RemediationsClientListDeploymentsAtSubscriptionOptions contains the optional parameters for the RemediationsClient.ListDeploymentsAtSubscription method.

type RemediationsClientListDeploymentsAtSubscriptionResponse

type RemediationsClientListDeploymentsAtSubscriptionResponse struct {
	RemediationDeploymentsListResult
}

RemediationsClientListDeploymentsAtSubscriptionResponse contains the response from method RemediationsClient.ListDeploymentsAtSubscription.

type RemediationsClientListForManagementGroupOptions

type RemediationsClientListForManagementGroupOptions struct {
}

RemediationsClientListForManagementGroupOptions contains the optional parameters for the RemediationsClient.ListForManagementGroup method.

type RemediationsClientListForManagementGroupResponse

type RemediationsClientListForManagementGroupResponse struct {
	RemediationListResult
}

RemediationsClientListForManagementGroupResponse contains the response from method RemediationsClient.ListForManagementGroup.

type RemediationsClientListForResourceGroupOptions

type RemediationsClientListForResourceGroupOptions struct {
}

RemediationsClientListForResourceGroupOptions contains the optional parameters for the RemediationsClient.ListForResourceGroup method.

type RemediationsClientListForResourceGroupResponse

type RemediationsClientListForResourceGroupResponse struct {
	RemediationListResult
}

RemediationsClientListForResourceGroupResponse contains the response from method RemediationsClient.ListForResourceGroup.

type RemediationsClientListForResourceOptions

type RemediationsClientListForResourceOptions struct {
}

RemediationsClientListForResourceOptions contains the optional parameters for the RemediationsClient.ListForResource method.

type RemediationsClientListForResourceResponse

type RemediationsClientListForResourceResponse struct {
	RemediationListResult
}

RemediationsClientListForResourceResponse contains the response from method RemediationsClient.ListForResource.

type RemediationsClientListForSubscriptionOptions

type RemediationsClientListForSubscriptionOptions struct {
}

RemediationsClientListForSubscriptionOptions contains the optional parameters for the RemediationsClient.ListForSubscription method.

type RemediationsClientListForSubscriptionResponse

type RemediationsClientListForSubscriptionResponse struct {
	RemediationListResult
}

RemediationsClientListForSubscriptionResponse contains the response from method RemediationsClient.ListForSubscription.

type Resource

type Resource struct {
	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty" azure:"ro"`
}

Resource - Common fields that are returned in the response for all Azure Resource Manager resources

func (Resource) MarshalJSON added in v0.6.0

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v0.6.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type ResourceDiscoveryMode

type ResourceDiscoveryMode string

ResourceDiscoveryMode - The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified.

const (
	// ResourceDiscoveryModeExistingNonCompliant - Remediate resources that are already known to be non-compliant.
	ResourceDiscoveryModeExistingNonCompliant ResourceDiscoveryMode = "ExistingNonCompliant"
	// ResourceDiscoveryModeReEvaluateCompliance - Re-evaluate the compliance state of resources and then remediate the resources
	// found to be non-compliant.
	ResourceDiscoveryModeReEvaluateCompliance ResourceDiscoveryMode = "ReEvaluateCompliance"
)

func PossibleResourceDiscoveryModeValues

func PossibleResourceDiscoveryModeValues() []ResourceDiscoveryMode

PossibleResourceDiscoveryModeValues returns the possible values for the ResourceDiscoveryMode const type.

type SlimPolicyMetadata

type SlimPolicyMetadata struct {
	// Properties of the policy metadata.
	Properties *PolicyMetadataSlimProperties `json:"properties,omitempty"`

	// READ-ONLY; The ID of the policy metadata.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the policy metadata.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the policy metadata.
	Type *string `json:"type,omitempty" azure:"ro"`
}

SlimPolicyMetadata - Slim version of policy metadata resource definition, excluding properties with large strings

func (SlimPolicyMetadata) MarshalJSON added in v0.6.0

func (s SlimPolicyMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SlimPolicyMetadata.

func (*SlimPolicyMetadata) UnmarshalJSON added in v0.6.0

func (s *SlimPolicyMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SlimPolicyMetadata.

type SummarizeResults

type SummarizeResults struct {
	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity count; represents the number of summaries returned; always set to 1.
	ODataCount *int32 `json:"@odata.count,omitempty"`

	// Summarize action results.
	Value []*Summary `json:"value,omitempty"`
}

SummarizeResults - Summarize action results.

func (SummarizeResults) MarshalJSON

func (s SummarizeResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SummarizeResults.

func (*SummarizeResults) UnmarshalJSON added in v0.6.0

func (s *SummarizeResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SummarizeResults.

type Summary

type Summary struct {
	// OData context string; used by OData clients to resolve type information based on metadata.
	ODataContext *string `json:"@odata.context,omitempty"`

	// OData entity ID; always set to null since summaries do not have an entity ID.
	ODataID *string `json:"@odata.id,omitempty"`

	// Policy assignments summary.
	PolicyAssignments []*PolicyAssignmentSummary `json:"policyAssignments,omitempty"`

	// Compliance summary for all policy assignments.
	Results *SummaryResults `json:"results,omitempty"`
}

Summary results.

func (Summary) MarshalJSON

func (s Summary) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Summary.

func (*Summary) UnmarshalJSON added in v0.6.0

func (s *Summary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Summary.

type SummaryResults

type SummaryResults struct {
	// Number of non-compliant policies.
	NonCompliantPolicies *int32 `json:"nonCompliantPolicies,omitempty"`

	// Number of non-compliant resources.
	NonCompliantResources *int32 `json:"nonCompliantResources,omitempty"`

	// The policy artifact summary at this level. For query scope level, it represents policy assignment summary. For policy assignment
	// level, it represents policy definitions summary.
	PolicyDetails []*ComplianceDetail `json:"policyDetails,omitempty"`

	// The policy definition group summary at this level.
	PolicyGroupDetails []*ComplianceDetail `json:"policyGroupDetails,omitempty"`

	// HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the compliance summary. This
	// property will not be available by default in future API versions, but could
	// be queried explicitly.
	QueryResultsURI *string `json:"queryResultsUri,omitempty"`

	// The resources summary at this level.
	ResourceDetails []*ComplianceDetail `json:"resourceDetails,omitempty"`
}

SummaryResults - Compliance summary on a particular summary level.

func (SummaryResults) MarshalJSON

func (s SummaryResults) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SummaryResults.

func (*SummaryResults) UnmarshalJSON added in v0.6.0

func (s *SummaryResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SummaryResults.

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// The type of identity that created the resource.
	CreatedByType *CreatedByType `json:"createdByType,omitempty"`

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"`

	// The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"`
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type TrackedResourceModificationDetails

type TrackedResourceModificationDetails struct {
	// READ-ONLY; The ID of the deployment that created or modified the tracked resource.
	DeploymentID *string `json:"deploymentId,omitempty" azure:"ro"`

	// READ-ONLY; Timestamp of the deployment that created or modified the tracked resource.
	DeploymentTime *time.Time `json:"deploymentTime,omitempty" azure:"ro"`

	// READ-ONLY; The details of the policy that created or modified the tracked resource.
	PolicyDetails *PolicyDetails `json:"policyDetails,omitempty" azure:"ro"`
}

TrackedResourceModificationDetails - The details of the policy triggered deployment that created or modified the tracked resource.

func (TrackedResourceModificationDetails) MarshalJSON

func (t TrackedResourceModificationDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TrackedResourceModificationDetails.

func (*TrackedResourceModificationDetails) UnmarshalJSON

func (t *TrackedResourceModificationDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceModificationDetails.

type TypedErrorInfo

type TypedErrorInfo struct {
	// READ-ONLY; The scenario specific error details.
	Info interface{} `json:"info,omitempty" azure:"ro"`

	// READ-ONLY; The type of included error details.
	Type *string `json:"type,omitempty" azure:"ro"`
}

TypedErrorInfo - Scenario specific error details.

func (TypedErrorInfo) MarshalJSON added in v0.6.0

func (t TypedErrorInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TypedErrorInfo.

func (*TypedErrorInfo) UnmarshalJSON added in v0.6.0

func (t *TypedErrorInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TypedErrorInfo.

Jump to

Keyboard shortcuts

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