armchangeanalysis

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 14 Imported by: 1

README

Azure Change Analysis Module for Go

PkgGoDev

The armchangeanalysis module provides operations for working with Azure Change Analysis.

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 Change Analysis module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/changeanalysis/armchangeanalysis

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Change Analysis. 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.

Client Factory

Azure Change Analysis module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armchangeanalysis.NewClientFactory(<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,
    },
}
clientFactory, err := armchangeanalysis.NewClientFactory(<subscription ID>, cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.NewChangesClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Change Analysis 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 Change

type Change struct {
	// The properties of a change.
	Properties *ChangeProperties

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Change - The detected change.

func (Change) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Change.

func (*Change) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Change.

type ChangeCategory

type ChangeCategory string

ChangeCategory - The change category.

const (
	ChangeCategorySystem ChangeCategory = "System"
	ChangeCategoryUser   ChangeCategory = "User"
)

func PossibleChangeCategoryValues

func PossibleChangeCategoryValues() []ChangeCategory

PossibleChangeCategoryValues returns the possible values for the ChangeCategory const type.

type ChangeList

type ChangeList struct {
	// The URI that can be used to request the next page of changes.
	NextLink *string

	// The list of changes.
	Value []*Change
}

ChangeList - The list of detected changes.

func (ChangeList) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ChangeList.

func (*ChangeList) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ChangeList.

type ChangeProperties

type ChangeProperties struct {
	// The type of the change.
	ChangeType *ChangeType

	// The list of identities who might initiated the change. The identity could be user name (email address) or the object ID
	// of the Service Principal.
	InitiatedByList []*string

	// The list of detailed changes at json property level.
	PropertyChanges []*PropertyChange

	// The resource id that the change is attached to.
	ResourceID *string

	// The time when the change is detected.
	TimeStamp *time.Time
}

ChangeProperties - The properties of a change.

func (ChangeProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ChangeProperties.

func (*ChangeProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ChangeProperties.

type ChangeType

type ChangeType string

ChangeType - The type of the change.

const (
	ChangeTypeAdd    ChangeType = "Add"
	ChangeTypeRemove ChangeType = "Remove"
	ChangeTypeUpdate ChangeType = "Update"
)

func PossibleChangeTypeValues

func PossibleChangeTypeValues() []ChangeType

PossibleChangeTypeValues returns the possible values for the ChangeType const type.

type ChangesClient

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

ChangesClient contains the methods for the Changes group. Don't use this type directly, use NewChangesClient() instead.

func NewChangesClient

func NewChangesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChangesClient, error)

NewChangesClient creates a new instance of ChangesClient with the specified values.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ChangesClient) NewListChangesByResourceGroupPager added in v0.4.0

func (client *ChangesClient) NewListChangesByResourceGroupPager(resourceGroupName string, startTime time.Time, endTime time.Time, options *ChangesClientListChangesByResourceGroupOptions) *runtime.Pager[ChangesClientListChangesByResourceGroupResponse]

NewListChangesByResourceGroupPager - List the changes of a resource group within the specified time range. Customer data will always be masked.

Generated from API version 2021-04-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • startTime - Specifies the start time of the changes request.
  • endTime - Specifies the end time of the changes request.
  • options - ChangesClientListChangesByResourceGroupOptions contains the optional parameters for the ChangesClient.NewListChangesByResourceGroupPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/changeanalysis/resource-manager/Microsoft.ChangeAnalysis/stable/2021-04-01/examples/ChangesListChangesByResourceGroup.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/changeanalysis/armchangeanalysis"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchangeanalysis.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewChangesClient().NewListChangesByResourceGroupPager("MyResourceGroup", func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-25T12:09:03.141Z"); return t }(), func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T12:09:03.141Z"); return t }(), &armchangeanalysis.ChangesClientListChangesByResourceGroupOptions{SkipToken: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ChangeList = armchangeanalysis.ChangeList{
		// 	Value: []*armchangeanalysis.Change{
		// 		{
		// 			Name: to.Ptr("ARG_23fa00fd-dda0-4268-b482-2076825cf165_970d8c6d-6b78-4270-92ef-88d5aa2b5f0b_132316363294700000_132316498613900000"),
		// 			Type: to.Ptr("Microsoft.ChangeAnalysis/changes"),
		// 			ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup"),
		// 			Properties: &armchangeanalysis.ChangeProperties{
		// 				ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 				InitiatedByList: []*string{
		// 					to.Ptr("ellen@contoso.com")},
		// 					PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 						{
		// 							Description: to.Ptr("The tag of the resource"),
		// 							ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 							ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 							DisplayName: to.Ptr("tags.resourceGroupTag"),
		// 							IsDataMasked: to.Ptr(false),
		// 							JSONPath: to.Ptr("tags.resourceGroupTag"),
		// 							Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 							NewValue: to.Ptr("new tag value"),
		// 							OldValue: to.Ptr("old tag value"),
		// 					}},
		// 					ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup"),
		// 					TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Type: to.Ptr("Microsoft.ChangeAnalysis/changes"),
		// 				ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite/extensions/AppStateTracker/providers/Microsoft.ChangeAnalysis/changes/AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Properties: &armchangeanalysis.ChangeProperties{
		// 					ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 					InitiatedByList: []*string{
		// 						to.Ptr("ellen@contoso.com")},
		// 						PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 							{
		// 								Description: to.Ptr("Application setting"),
		// 								ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 								ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 								DisplayName: to.Ptr("APPSETTING_DB_CONNSTR"),
		// 								IsDataMasked: to.Ptr(true),
		// 								JSONPath: to.Ptr("environment.environmentVariables.APPSETTING_DB_CONNSTR"),
		// 								Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 								NewValue: to.Ptr("***New Value Hidden***"),
		// 								OldValue: to.Ptr("***Old Value Hidden***"),
		// 						}},
		// 						ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite"),
		// 						TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

func (*ChangesClient) NewListChangesBySubscriptionPager added in v0.4.0

func (client *ChangesClient) NewListChangesBySubscriptionPager(startTime time.Time, endTime time.Time, options *ChangesClientListChangesBySubscriptionOptions) *runtime.Pager[ChangesClientListChangesBySubscriptionResponse]

NewListChangesBySubscriptionPager - List the changes of a subscription within the specified time range. Customer data will always be masked.

Generated from API version 2021-04-01

  • startTime - Specifies the start time of the changes request.
  • endTime - Specifies the end time of the changes request.
  • options - ChangesClientListChangesBySubscriptionOptions contains the optional parameters for the ChangesClient.NewListChangesBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/changeanalysis/resource-manager/Microsoft.ChangeAnalysis/stable/2021-04-01/examples/ChangesListChangesBySubscription.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/changeanalysis/armchangeanalysis"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchangeanalysis.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewChangesClient().NewListChangesBySubscriptionPager(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-25T12:09:03.141Z"); return t }(), func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T12:09:03.141Z"); return t }(), &armchangeanalysis.ChangesClientListChangesBySubscriptionOptions{SkipToken: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ChangeList = armchangeanalysis.ChangeList{
		// 	Value: []*armchangeanalysis.Change{
		// 		{
		// 			Name: to.Ptr("ARG_23fa00fd-dda0-4268-b482-2076825cf165_970d8c6d-6b78-4270-92ef-88d5aa2b5f0b_132316363294700000_132316498613900000"),
		// 			Type: to.Ptr("Microsoft.ChangeAnalysis/changes"),
		// 			ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1"),
		// 			Properties: &armchangeanalysis.ChangeProperties{
		// 				ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 				InitiatedByList: []*string{
		// 					to.Ptr("ellen@contoso.com")},
		// 					PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 						{
		// 							Description: to.Ptr("The tag of the resource"),
		// 							ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 							ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 							DisplayName: to.Ptr("tags.subscripitonTag"),
		// 							IsDataMasked: to.Ptr(false),
		// 							JSONPath: to.Ptr("tags.subscripitonTag"),
		// 							Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 							NewValue: to.Ptr("new tag value"),
		// 							OldValue: to.Ptr("old tag value"),
		// 					}},
		// 					ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1"),
		// 					TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Type: to.Ptr("Microsoft.ChangeAnalysis/changes"),
		// 				ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite/extensions/AppStateTracker/providers/Microsoft.ChangeAnalysis/changes/AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Properties: &armchangeanalysis.ChangeProperties{
		// 					ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 					InitiatedByList: []*string{
		// 						to.Ptr("ellen@contoso.com")},
		// 						PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 							{
		// 								Description: to.Ptr("Application setting"),
		// 								ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 								ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 								DisplayName: to.Ptr("APPSETTING_DB_CONNSTR"),
		// 								IsDataMasked: to.Ptr(true),
		// 								JSONPath: to.Ptr("environment.environmentVariables.APPSETTING_DB_CONNSTR"),
		// 								Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 								NewValue: to.Ptr("***New Value Hidden***"),
		// 								OldValue: to.Ptr("***Old Value Hidden***"),
		// 						}},
		// 						ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite"),
		// 						TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

type ChangesClientListChangesByResourceGroupOptions added in v0.2.0

type ChangesClientListChangesByResourceGroupOptions struct {
	// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains
	// a nextLink element, the value of the nextLink element will include a
	// skipToken parameter that specifies a starting point to use for subsequent calls.
	SkipToken *string
}

ChangesClientListChangesByResourceGroupOptions contains the optional parameters for the ChangesClient.NewListChangesByResourceGroupPager method.

type ChangesClientListChangesByResourceGroupResponse added in v0.2.0

type ChangesClientListChangesByResourceGroupResponse struct {
	// The list of detected changes.
	ChangeList
}

ChangesClientListChangesByResourceGroupResponse contains the response from method ChangesClient.NewListChangesByResourceGroupPager.

type ChangesClientListChangesBySubscriptionOptions added in v0.2.0

type ChangesClientListChangesBySubscriptionOptions struct {
	// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains
	// a nextLink element, the value of the nextLink element will include a
	// skipToken parameter that specifies a starting point to use for subsequent calls.
	SkipToken *string
}

ChangesClientListChangesBySubscriptionOptions contains the optional parameters for the ChangesClient.NewListChangesBySubscriptionPager method.

type ChangesClientListChangesBySubscriptionResponse added in v0.2.0

type ChangesClientListChangesBySubscriptionResponse struct {
	// The list of detected changes.
	ChangeList
}

ChangesClientListChangesBySubscriptionResponse contains the response from method ChangesClient.NewListChangesBySubscriptionPager.

type ClientFactory added in v1.1.0

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

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v1.1.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • subscriptionID - The ID of the target subscription.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewChangesClient added in v1.1.0

func (c *ClientFactory) NewChangesClient() *ChangesClient

NewChangesClient creates a new instance of ChangesClient.

func (*ClientFactory) NewOperationsClient added in v1.1.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewResourceChangesClient added in v1.1.0

func (c *ClientFactory) NewResourceChangesClient() *ResourceChangesClient

NewResourceChangesClient creates a new instance of ResourceChangesClient.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	// READ-ONLY; The additional info.
	Info any

	// READ-ONLY; The additional info type.
	Type *string
}

ErrorAdditionalInfo - The resource management error additional info.

func (ErrorAdditionalInfo) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo.

func (*ErrorAdditionalInfo) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo.

type ErrorDetail

type ErrorDetail struct {
	// READ-ONLY; The error additional info.
	AdditionalInfo []*ErrorAdditionalInfo

	// READ-ONLY; The error code.
	Code *string

	// READ-ONLY; The error details.
	Details []*ErrorDetail

	// READ-ONLY; The error message.
	Message *string

	// READ-ONLY; The error target.
	Target *string
}

ErrorDetail - The error detail.

func (ErrorDetail) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ErrorDetail.

func (*ErrorDetail) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail.

type ErrorResponse

type ErrorResponse struct {
	// The error object.
	Error *ErrorDetail
}

ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

func (ErrorResponse) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type Level

type Level string
const (
	LevelImportant Level = "Important"
	LevelNoisy     Level = "Noisy"
	LevelNormal    Level = "Normal"
)

func PossibleLevelValues

func PossibleLevelValues() []Level

PossibleLevelValues returns the possible values for the Level const type.

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) NewListPager added in v0.4.0

NewListPager - Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their descriptions.

Generated from API version 2021-04-01

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/changeanalysis/resource-manager/Microsoft.ChangeAnalysis/stable/2021-04-01/examples/OperationsList.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/changeanalysis/armchangeanalysis"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchangeanalysis.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(&armchangeanalysis.OperationsClientListOptions{SkipToken: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ResourceProviderOperationList = armchangeanalysis.ResourceProviderOperationList{
		// 	Value: []*armchangeanalysis.ResourceProviderOperationDefinition{
		// 		{
		// 			Name: to.Ptr("Microsoft.ChangeAnalysis/register/action"),
		// 			Display: &armchangeanalysis.ResourceProviderOperationDisplay{
		// 				Operation: to.Ptr("Register Microsoft Change Analysis resource provider with a subscriptions"),
		// 				Provider: to.Ptr("Microsoft Change Analysis"),
		// 				Resource: to.Ptr(""),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.ChangeAnalysis/changes/read"),
		// 			Display: &armchangeanalysis.ResourceProviderOperationDisplay{
		// 				Operation: to.Ptr("Read Azure Application Change Analysis Servie Change"),
		// 				Provider: to.Ptr("Microsoft Change Analysis"),
		// 				Resource: to.Ptr("Azure Application Change Analysis Service Change"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
	// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains
	// a nextLink element, the value of the nextLink element will include a
	// skipToken parameter that specifies a starting point to use for subsequent calls.
	SkipToken *string
}

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

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	// The resource provider operation list.
	ResourceProviderOperationList
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type PropertyChange

type PropertyChange struct {
	// The change category.
	ChangeCategory *ChangeCategory

	// The type of the change.
	ChangeType *ChangeType

	// The description of the changed property.
	Description *string

	// The enhanced display name of the json path. E.g., the json path value[0].properties will be translated to something meaningful
	// like slots["Staging"].properties.
	DisplayName *string

	// The boolean indicating whether the oldValue and newValue are masked. The values are masked if it contains sensitive information
	// that the user doesn't have access to.
	IsDataMasked *bool

	// The json path of the changed property.
	JSONPath *string
	Level    *Level

	// The value of the property after the change.
	NewValue *string

	// The value of the property before the change.
	OldValue *string
}

PropertyChange - Data of a property change.

func (PropertyChange) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type PropertyChange.

func (*PropertyChange) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type PropertyChange.

type ProxyResource

type ProxyResource struct {
	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location

func (ProxyResource) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ProxyResource.

func (*ProxyResource) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource.

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

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Resource - Common fields that are returned in the response for all Azure Resource Manager resources

func (Resource) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type ResourceChangesClient

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

ResourceChangesClient contains the methods for the ResourceChanges group. Don't use this type directly, use NewResourceChangesClient() instead.

func NewResourceChangesClient

func NewResourceChangesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceChangesClient, error)

NewResourceChangesClient creates a new instance of ResourceChangesClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ResourceChangesClient) NewListPager added in v0.4.0

func (client *ResourceChangesClient) NewListPager(resourceID string, startTime time.Time, endTime time.Time, options *ResourceChangesClientListOptions) *runtime.Pager[ResourceChangesClientListResponse]

NewListPager - List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't have access.

Generated from API version 2021-04-01

  • resourceID - The identifier of the resource.
  • startTime - Specifies the start time of the changes request.
  • endTime - Specifies the end time of the changes request.
  • options - ResourceChangesClientListOptions contains the optional parameters for the ResourceChangesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/changeanalysis/resource-manager/Microsoft.ChangeAnalysis/stable/2021-04-01/examples/ResourceChangesList.json

package main

import (
	"context"
	"log"

	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/changeanalysis/armchangeanalysis"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armchangeanalysis.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewResourceChangesClient().NewListPager("subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite", func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-25T12:09:03.141Z"); return t }(), func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T12:09:03.141Z"); return t }(), &armchangeanalysis.ResourceChangesClientListOptions{SkipToken: nil})
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.ChangeList = armchangeanalysis.ChangeList{
		// 	Value: []*armchangeanalysis.Change{
		// 		{
		// 			Name: to.Ptr("ARG_23fa00fd-dda0-4268-b482-2076825cf165_970d8c6d-6b78-4270-92ef-88d5aa2b5f0b_132316363294700000_132316498613900000"),
		// 			Type: to.Ptr("Microsoft.ChangeAnalysis/resourceChanges"),
		// 			ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite/providers/Microsoft.ChangeAnalysis/resourceChanges/ARG_23fa00fd-dda0-4268-b482-2076825cf165_970d8c6d-6b78-4270-92ef-88d5aa2b5f0b_132316363294700000_132316498613900000"),
		// 			Properties: &armchangeanalysis.ChangeProperties{
		// 				ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 				InitiatedByList: []*string{
		// 					to.Ptr("ellen@contoso.com")},
		// 					PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 						{
		// 							Description: to.Ptr("The thumbprint of the certificate"),
		// 							ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 							ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 							DisplayName: to.Ptr("publicCertificates[\"AppCert\"].properties.thumbprint"),
		// 							IsDataMasked: to.Ptr(false),
		// 							JSONPath: to.Ptr("value[1].properties.thumbprint"),
		// 							Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 							NewValue: to.Ptr("3F2DF554-B063-4383-8BD3-4970BCF20A7E"),
		// 							OldValue: to.Ptr("21D0482F-E91E-4C14-8078-65BFDCDBCA64"),
		// 					}},
		// 					ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite"),
		// 					TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Type: to.Ptr("Microsoft.ChangeAnalysis/changes"),
		// 				ID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite/extensions/AppStateTracker/providers/Microsoft.ChangeAnalysis/resourceChanges/AST_b2ecd7ec-00dd-4d44-bd19-fefc88790c05_da36e22e-f541-44bd-8d89-8f10a27af4ad_132592897881782408_132592957873393845"),
		// 				Properties: &armchangeanalysis.ChangeProperties{
		// 					ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 					InitiatedByList: []*string{
		// 						to.Ptr("ellen@contoso.com")},
		// 						PropertyChanges: []*armchangeanalysis.PropertyChange{
		// 							{
		// 								Description: to.Ptr("Application setting"),
		// 								ChangeCategory: to.Ptr(armchangeanalysis.ChangeCategoryUser),
		// 								ChangeType: to.Ptr(armchangeanalysis.ChangeTypeUpdate),
		// 								DisplayName: to.Ptr("APPSETTING_DB_CONNSTR"),
		// 								IsDataMasked: to.Ptr(false),
		// 								JSONPath: to.Ptr("environment.environmentVariables.APPSETTING_DB_CONNSTR"),
		// 								Level: to.Ptr(armchangeanalysis.LevelImportant),
		// 								NewValue: to.Ptr("<new database connection string>"),
		// 								OldValue: to.Ptr("<old database connection string>"),
		// 						}},
		// 						ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/mysite"),
		// 						TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-26T02:17:41.390Z"); return t}()),
		// 					},
		// 			}},
		// 		}
	}
}
Output:

type ResourceChangesClientListOptions added in v0.2.0

type ResourceChangesClientListOptions struct {
	// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains
	// a nextLink element, the value of the nextLink element will include a
	// skipToken parameter that specifies a starting point to use for subsequent calls.
	SkipToken *string
}

ResourceChangesClientListOptions contains the optional parameters for the ResourceChangesClient.NewListPager method.

type ResourceChangesClientListResponse added in v0.2.0

type ResourceChangesClientListResponse struct {
	// The list of detected changes.
	ChangeList
}

ResourceChangesClientListResponse contains the response from method ResourceChangesClient.NewListPager.

type ResourceProviderOperationDefinition

type ResourceProviderOperationDefinition struct {
	// The resource provider operation details.
	Display *ResourceProviderOperationDisplay

	// The resource provider operation name.
	Name *string
}

ResourceProviderOperationDefinition - The resource provider operation definition.

func (ResourceProviderOperationDefinition) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperationDefinition.

func (*ResourceProviderOperationDefinition) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationDefinition.

type ResourceProviderOperationDisplay

type ResourceProviderOperationDisplay struct {
	// Description of the resource provider operation.
	Description *string

	// Name of the resource provider operation.
	Operation *string

	// Name of the resource provider.
	Provider *string

	// Name of the resource type.
	Resource *string
}

ResourceProviderOperationDisplay - The resource provider operation details.

func (ResourceProviderOperationDisplay) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperationDisplay.

func (*ResourceProviderOperationDisplay) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationDisplay.

type ResourceProviderOperationList

type ResourceProviderOperationList struct {
	// The URI that can be used to request the next page for list of Azure operations.
	NextLink *string

	// Resource provider operations list.
	Value []*ResourceProviderOperationDefinition
}

ResourceProviderOperationList - The resource provider operation list.

func (ResourceProviderOperationList) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceProviderOperationList.

func (*ResourceProviderOperationList) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationList.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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