Documentation ¶
Index ¶
- type ChangeAttributes
- type ChangeBase
- type ChangeCategory
- type ChangeProperties
- type ChangeResourceListResult
- type ChangeResourceResult
- type ChangeType
- type Client
- type ClientFactory
- type ClientGetOptions
- type ClientGetResponse
- type ClientListOptions
- type ClientListResponse
- type ErrorAdditionalInfo
- type ErrorDetail
- type ErrorResponse
- type PropertyChangeType
- type Resource
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeAttributes ¶
type ChangeAttributes struct { // READ-ONLY; The number of changes this resource captures ChangesCount *int64 // READ-ONLY; The ARM correlation ID of the change resource CorrelationID *string // READ-ONLY; The GUID of the new snapshot NewResourceSnapshotID *string // READ-ONLY; The GUID of the previous snapshot PreviousResourceSnapshotID *string // READ-ONLY; The time the change(s) on the target resource ocurred Timestamp *string }
ChangeAttributes - Details about the change resource
func (ChangeAttributes) MarshalJSON ¶ added in v1.1.0
func (c ChangeAttributes) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChangeAttributes.
func (*ChangeAttributes) UnmarshalJSON ¶ added in v1.1.0
func (c *ChangeAttributes) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChangeAttributes.
type ChangeBase ¶
type ChangeBase struct { // READ-ONLY; The entity that made the change ChangeCategory *ChangeCategory // READ-ONLY; The target resource property value after the change NewValue *string // READ-ONLY; The target resource property value before the change PreviousValue *string // READ-ONLY; The type of change that occurred PropertyChangeType *PropertyChangeType }
ChangeBase - An individual change on the target resource
func (ChangeBase) MarshalJSON ¶ added in v1.1.0
func (c ChangeBase) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChangeBase.
func (*ChangeBase) UnmarshalJSON ¶ added in v1.1.0
func (c *ChangeBase) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChangeBase.
type ChangeCategory ¶
type ChangeCategory string
ChangeCategory - The entity that made the change
const ( // ChangeCategorySystem - System initiated change ChangeCategorySystem ChangeCategory = "System" // ChangeCategoryUser - User initiated change ChangeCategoryUser ChangeCategory = "User" )
func PossibleChangeCategoryValues ¶
func PossibleChangeCategoryValues() []ChangeCategory
PossibleChangeCategoryValues returns the possible values for the ChangeCategory const type.
type ChangeProperties ¶
type ChangeProperties struct { // Details about the change resource ChangeAttributes *ChangeAttributes // A dictionary with changed property name as a key and the change details as the value Changes map[string]*ChangeBase // READ-ONLY; The type of change that was captured in the resource ChangeType *ChangeType // READ-ONLY; The fully qualified ID of the target resource that was changed TargetResourceID *string // READ-ONLY; The namespace and type of the resource TargetResourceType *string }
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 ¶ added in v1.1.0
func (c *ChangeProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChangeProperties.
type ChangeResourceListResult ¶
type ChangeResourceListResult struct { // The link used to get the next page of Change Resources NextLink *string // The list of resources Value []*ChangeResourceResult }
ChangeResourceListResult - The list of resources
func (ChangeResourceListResult) MarshalJSON ¶
func (c ChangeResourceListResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChangeResourceListResult.
func (*ChangeResourceListResult) UnmarshalJSON ¶ added in v1.1.0
func (c *ChangeResourceListResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChangeResourceListResult.
type ChangeResourceResult ¶
type ChangeResourceResult 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 }
ChangeResourceResult - Change Resource
func (ChangeResourceResult) MarshalJSON ¶ added in v1.1.0
func (c ChangeResourceResult) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ChangeResourceResult.
func (*ChangeResourceResult) UnmarshalJSON ¶ added in v1.1.0
func (c *ChangeResourceResult) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ChangeResourceResult.
type ChangeType ¶
type ChangeType string
ChangeType - The type of change that was captured in the resource
const ( // ChangeTypeCreate - A newly created resource ChangeTypeCreate ChangeType = "Create" // ChangeTypeDelete - An existing resource was deleted ChangeTypeDelete ChangeType = "Delete" // ChangeTypeUpdate - An existing resource underwent a change ChangeTypeUpdate ChangeType = "Update" )
func PossibleChangeTypeValues ¶
func PossibleChangeTypeValues() []ChangeType
PossibleChangeTypeValues returns the possible values for the ChangeType const type.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains the methods for the Changes group. Don't use this type directly, use NewClient() instead.
func NewClient ¶
func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)
NewClient creates a new instance of Client with the specified values.
- subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*Client) Get ¶
func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, changeResourceID string, options *ClientGetOptions) (ClientGetResponse, error)
Get - Obtains the specified change resource for the target resource If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2022-05-01
- resourceGroupName - The name of the resource group.
- resourceProviderNamespace - The name of the resource provider namespace.
- resourceType - The name of the resource type.
- resourceName - The name of the resource.
- changeResourceID - The ID of the change resource
- options - ClientGetOptions contains the optional parameters for the Client.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/GetChange.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armchanges" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armchanges.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewClient().Get(ctx, "resourceGroup1", "resourceProvider1", "resourceType1", "resourceName1", "1d58d72f-0719-4a48-9228-b7ea682885bf", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.ChangeResourceResult = armchanges.ChangeResourceResult{ // Name: to.Ptr("1d58d72f-0719-4a48-9228-b7ea682885bf"), // Type: to.Ptr("Microsoft.Resources/changes"), // ID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/1d58d72f-0719-4a48-9228-b7ea682885bf"), // Properties: &armchanges.ChangeProperties{ // ChangeAttributes: &armchanges.ChangeAttributes{ // ChangesCount: to.Ptr[int64](2), // CorrelationID: to.Ptr("88420d5d-8d0e-471f-9115-10d34750c617"), // NewResourceSnapshotID: to.Ptr("6eac9d0f-63b4-4e7f-97a5-740c73757efb"), // PreviousResourceSnapshotID: to.Ptr("ed90e35a-1661-42cc-a44c-e27f508005be"), // Timestamp: to.Ptr("2021-11-19T14:29:09.9210000Z"), // }, // ChangeType: to.Ptr(armchanges.ChangeTypeUpdate), // Changes: map[string]*armchanges.ChangeBase{ // "properties.provisioningState": &armchanges.ChangeBase{ // ChangeCategory: to.Ptr(armchanges.ChangeCategorySystem), // NewValue: to.Ptr("Succeeded"), // PreviousValue: to.Ptr("Updating"), // PropertyChangeType: to.Ptr(armchanges.PropertyChangeTypeUpdate), // }, // "tags.key1": &armchanges.ChangeBase{ // ChangeCategory: to.Ptr(armchanges.ChangeCategoryUser), // NewValue: to.Ptr("someValue"), // PreviousValue: to.Ptr("null"), // PropertyChangeType: to.Ptr(armchanges.PropertyChangeTypeInsert), // }, // }, // TargetResourceID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1"), // TargetResourceType: to.Ptr("resourceProvider1/resourceType1"), // }, // } }
Output:
func (*Client) NewListPager ¶
func (client *Client) NewListPager(resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *ClientListOptions) *runtime.Pager[ClientListResponse]
NewListPager - Obtains a list of change resources from the past 14 days for the target resource
Generated from API version 2022-05-01
- resourceGroupName - The name of the resource group.
- resourceProviderNamespace - The name of the resource provider namespace.
- resourceType - The name of the resource type.
- resourceName - The name of the resource.
- options - ClientListOptions contains the optional parameters for the Client.NewListPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0cc5e2efd6ffccf30e80d1e150b488dd87198b94/specification/resources/resource-manager/Microsoft.Resources/stable/2022-05-01/examples/ListChanges.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armchanges" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armchanges.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewClient().NewListPager("resourceGroup1", "resourceProvider1", "resourceType1", "resourceName1", &armchanges.ClientListOptions{Top: nil, 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.ChangeResourceListResult = armchanges.ChangeResourceListResult{ // Value: []*armchanges.ChangeResourceResult{ // { // Name: to.Ptr("a9f34285-13a2-e79c-f468-cfb71c7bd227"), // Type: to.Ptr("Microsoft.Resources/changes"), // ID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/a9f34285-13a2-e79c-f468-cfb71c7bd227"), // Properties: &armchanges.ChangeProperties{ // ChangeAttributes: &armchanges.ChangeAttributes{ // ChangesCount: to.Ptr[int64](2), // CorrelationID: to.Ptr("88420d5d-8d0e-471f-9115-10d34750c617"), // NewResourceSnapshotID: to.Ptr("6eac9d0f-63b4-4e7f-97a5-740c73757efb"), // PreviousResourceSnapshotID: to.Ptr("ed90e35a-1661-42cc-a44c-e27f508005be"), // Timestamp: to.Ptr("2021-11-19T14:29:09.9210000Z"), // }, // ChangeType: to.Ptr(armchanges.ChangeTypeUpdate), // Changes: map[string]*armchanges.ChangeBase{ // "properties.provisioningState": &armchanges.ChangeBase{ // ChangeCategory: to.Ptr(armchanges.ChangeCategorySystem), // NewValue: to.Ptr("Succeeded"), // PreviousValue: to.Ptr("Updating"), // PropertyChangeType: to.Ptr(armchanges.PropertyChangeTypeUpdate), // }, // "tags.key1": &armchanges.ChangeBase{ // ChangeCategory: to.Ptr(armchanges.ChangeCategoryUser), // NewValue: to.Ptr("someValue"), // PreviousValue: to.Ptr("null"), // PropertyChangeType: to.Ptr(armchanges.PropertyChangeTypeInsert), // }, // }, // TargetResourceID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1"), // TargetResourceType: to.Ptr("resourceProvider1/resourceType1"), // }, // }, // { // Name: to.Ptr("a9f34285-13a2-e79c-f468-cfb71c7bd227"), // Type: to.Ptr("Microsoft.Resources/changes"), // ID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1/Microsoft.Resources/changes/a9f34285-13a2-e79c-f468-cfb71c7bd227"), // Properties: &armchanges.ChangeProperties{ // ChangeAttributes: &armchanges.ChangeAttributes{ // ChangesCount: to.Ptr[int64](0), // CorrelationID: to.Ptr("88420d5d-8d0e-471f-9115-10d34750c617"), // NewResourceSnapshotID: to.Ptr("4db20fc0-de17-4cdd-92d8-fd6bf94b9fd9"), // PreviousResourceSnapshotID: to.Ptr("b09f5e52-0b46-4d13-84a9-08653d39fed6"), // Timestamp: to.Ptr("2021-11-19T14:29:09.9210000Z"), // }, // ChangeType: to.Ptr(armchanges.ChangeTypeCreate), // Changes: map[string]*armchanges.ChangeBase{ // }, // TargetResourceID: to.Ptr("/subscriptions/subscriptionId1/resourceGroups/resourceGroup1/providers/resourceProvider1/resourceType1/resourceName1"), // TargetResourceType: to.Ptr("resourceProvider1/resourceType1"), // }, // }}, // } } }
Output:
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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewClient ¶ added in v1.1.0
func (c *ClientFactory) NewClient() *Client
NewClient creates a new instance of Client.
type ClientGetOptions ¶
type ClientGetOptions struct { }
ClientGetOptions contains the optional parameters for the Client.Get method.
type ClientGetResponse ¶
type ClientGetResponse struct { // Change Resource ChangeResourceResult }
ClientGetResponse contains the response from method Client.Get.
type ClientListOptions ¶
type ClientListOptions struct { // (Optional) The page-continuation token SkipToken *string // (Optional) Set the maximum number of results per response. Top *int64 }
ClientListOptions contains the optional parameters for the Client.NewListPager method.
type ClientListResponse ¶
type ClientListResponse struct { // The list of resources ChangeResourceListResult }
ClientListResponse contains the response from method Client.NewListPager.
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 PropertyChangeType ¶
type PropertyChangeType string
PropertyChangeType - The type of change that occurred
const ( // PropertyChangeTypeInsert - A property was newly created PropertyChangeTypeInsert PropertyChangeType = "Insert" // PropertyChangeTypeRemove - An existing property was deleted PropertyChangeTypeRemove PropertyChangeType = "Remove" // PropertyChangeTypeUpdate - An existing property underwent a change PropertyChangeTypeUpdate PropertyChangeType = "Update" )
func PossiblePropertyChangeTypeValues ¶
func PossiblePropertyChangeTypeValues() []PropertyChangeType
PossiblePropertyChangeTypeValues returns the possible values for the PropertyChangeType const type.
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
MarshalJSON implements the json.Marshaller interface for type Resource.
func (*Resource) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaller interface for type Resource.