armresourcegraph

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 14 Imported by: 58

README

Azure Resource Graph Module for Go

The armresourcegraph module provides operations for working with Azure Resource Graph.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Supported version of Go (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 Resource Graph module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Resource Graph. 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 Resource Graph 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 := armresourcegraph.NewClientFactory(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 := armresourcegraph.NewClientFactory(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.NewGraphQueryClient()

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 Resource Graph 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 AuthorizationScopeFilter

type AuthorizationScopeFilter string

AuthorizationScopeFilter - Defines what level of authorization resources should be returned based on the which subscriptions and management groups are passed as scopes.

const (
	// AuthorizationScopeFilterAtScopeAboveAndBelow - AtScopeAboveAndBelow
	AuthorizationScopeFilterAtScopeAboveAndBelow AuthorizationScopeFilter = "AtScopeAboveAndBelow"
	// AuthorizationScopeFilterAtScopeAndAbove - AtScopeAndAbove
	AuthorizationScopeFilterAtScopeAndAbove AuthorizationScopeFilter = "AtScopeAndAbove"
	// AuthorizationScopeFilterAtScopeAndBelow - AtScopeAndBelow
	AuthorizationScopeFilterAtScopeAndBelow AuthorizationScopeFilter = "AtScopeAndBelow"
	// AuthorizationScopeFilterAtScopeExact - AtScopeExact
	AuthorizationScopeFilterAtScopeExact AuthorizationScopeFilter = "AtScopeExact"
)

func PossibleAuthorizationScopeFilterValues

func PossibleAuthorizationScopeFilterValues() []AuthorizationScopeFilter

PossibleAuthorizationScopeFilterValues returns the possible values for the AuthorizationScopeFilter const type.

type ChangeCategory added in v0.10.0

type ChangeCategory string

ChangeCategory - The change category.

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

func PossibleChangeCategoryValues added in v0.10.0

func PossibleChangeCategoryValues() []ChangeCategory

PossibleChangeCategoryValues returns the possible values for the ChangeCategory const type.

type ChangeType added in v0.10.0

type ChangeType string

ChangeType - The change type for snapshot. PropertyChanges will be provided in case of Update change type

const (
	// ChangeTypeCreate - Create
	ChangeTypeCreate ChangeType = "Create"
	// ChangeTypeDelete - Delete
	ChangeTypeDelete ChangeType = "Delete"
	// ChangeTypeUpdate - Update
	ChangeTypeUpdate ChangeType = "Update"
)

func PossibleChangeTypeValues added in v0.10.0

func PossibleChangeTypeValues() []ChangeType

PossibleChangeTypeValues returns the possible values for the ChangeType const type.

type Client added in v0.2.0

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

Client contains the methods for the service. Don't use this type directly, use NewClient() instead.

Generated from API versions 2020-09-01-preview, 2021-06-01-preview, 2024-04-01

func NewClient added in v0.2.0

func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)

NewClient creates a new instance of Client with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*Client) ResourceChangeDetails added in v0.10.0

ResourceChangeDetails - Get resource change details. If the operation fails it returns an *azcore.ResponseError type.

  • parameters - The request body
  • options - ClientResourceChangeDetailsOptions contains the optional parameters for the Client.ResourceChangeDetails method.
Example

Generated from example definition: 2020-09-01-preview/ResourceChangeDetails.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourceChangeDetails(ctx, armresourcegraph.ResourceChangeDetailsRequestParameters{
		ChangeIDs: []*string{
			to.Ptr("53dc0515-b86b-4bc2-979b-e4694ab4a556"),
		},
		ResourceIDs: []*string{
			to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
		},
	}, 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 = armresourcegraph.ClientResourceChangeDetailsResponse{
	// 	ResourceChangeDataArray: []*armresourcegraph.ResourceChangeData{
	// 		{
	// 			AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 				Content: map[string]any{
	// 					"name": "mystorageaccount",
	// 					"type": "Microsoft.Storage/storageAccounts",
	// 					"id": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount",
	// 					"kind": "Storage",
	// 					"location": "westus",
	// 					"properties": map[string]any{
	// 						"creationTime": "2018-07-27T18:37:21.7708872Z",
	// 						"encryption": map[string]any{
	// 							"keySource": "Microsoft.Storage",
	// 							"services": map[string]any{
	// 								"blob": map[string]any{
	// 									"enabled": true,
	// 									"lastEnabledTime": "2018-07-27T18:37:21.8333895Z",
	// 								},
	// 								"file": map[string]any{
	// 									"enabled": true,
	// 									"lastEnabledTime": "2018-07-27T18:37:21.8333895Z",
	// 								},
	// 							},
	// 						},
	// 						"networkAcls": map[string]any{
	// 							"bypass": "AzureServices",
	// 							"defaultAction": "Allow",
	// 							"ipRules": []any{
	// 							},
	// 							"virtualNetworkRules": []any{
	// 							},
	// 						},
	// 						"primaryEndpoints": map[string]any{
	// 							"blob": "https://mystorageaccount.blob.core.windows.net/",
	// 							"file": "https://mystorageaccount.file.core.windows.net/",
	// 							"queue": "https://mystorageaccount.queue.core.windows.net/",
	// 							"table": "https://mystorageaccount.table.core.windows.net/",
	// 						},
	// 						"primaryLocation": "westus",
	// 						"provisioningState": "Succeeded",
	// 						"statusOfPrimary": "available",
	// 						"supportsHttpsTrafficOnly": true,
	// 					},
	// 					"sku": map[string]any{
	// 						"name": "Standard_LRS",
	// 						"tier": "Standard",
	// 					},
	// 					"tags": map[string]any{
	// 					},
	// 				},
	// 				Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:54:24.42Z"); return t}()),
	// 			},
	// 			BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 				Content: map[string]any{
	// 					"name": "mystorageaccount",
	// 					"type": "Microsoft.Storage/storageAccounts",
	// 					"id": "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount",
	// 					"kind": "Storage",
	// 					"location": "westus",
	// 					"properties": map[string]any{
	// 						"creationTime": "2018-07-27T18:37:21.7708872Z",
	// 						"encryption": map[string]any{
	// 							"keySource": "Microsoft.Storage",
	// 							"services": map[string]any{
	// 								"blob": map[string]any{
	// 									"enabled": true,
	// 									"lastEnabledTime": "2018-07-27T18:37:21.8333895Z",
	// 								},
	// 								"file": map[string]any{
	// 									"enabled": true,
	// 									"lastEnabledTime": "2018-07-27T18:37:21.8333895Z",
	// 								},
	// 							},
	// 						},
	// 						"networkAcls": map[string]any{
	// 							"bypass": "AzureServices",
	// 							"defaultAction": "Allow",
	// 							"ipRules": []any{
	// 							},
	// 							"virtualNetworkRules": []any{
	// 							},
	// 						},
	// 						"primaryEndpoints": map[string]any{
	// 							"blob": "https://mystorageaccount.blob.core.windows.net/",
	// 							"file": "https://mystorageaccount.file.core.windows.net/",
	// 							"queue": "https://mystorageaccount.queue.core.windows.net/",
	// 							"table": "https://mystorageaccount.table.core.windows.net/",
	// 						},
	// 						"primaryLocation": "westus",
	// 						"provisioningState": "Succeeded",
	// 						"statusOfPrimary": "available",
	// 						"supportsHttpsTrafficOnly": false,
	// 					},
	// 					"sku": map[string]any{
	// 						"name": "Standard_LRS",
	// 						"tier": "Standard",
	// 					},
	// 					"tags": map[string]any{
	// 					},
	// 				},
	// 				Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:32:05.993Z"); return t}()),
	// 			},
	// 			ChangeID: to.Ptr("53dc0515-b86b-4bc2-979b-e4694ab4a556"),
	// 			ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 		},
	// 	},
	// }
}

func (*Client) ResourceChanges added in v0.10.0

ResourceChanges - List changes to a resource for a given time interval. If the operation fails it returns an *azcore.ResponseError type.

  • parameters - The request body
  • options - ClientResourceChangesOptions contains the optional parameters for the Client.ResourceChanges method.
Example (BasicQuery)

Generated from example definition: 2020-09-01-preview/ResourceChanges.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
	"time"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourceChanges(ctx, armresourcegraph.ResourceChangesRequestParameters{
		Interval: &armresourcegraph.ResourceChangesRequestParametersInterval{
			End:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T12:09:03.141Z"); return t }()),
			Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T12:09:03.141Z"); return t }()),
		},
		ResourceIDs: []*string{
			to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
		},
	}, 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 = armresourcegraph.ClientResourceChangesResponse{
	// 	ResourceChangeList: armresourcegraph.ResourceChangeList{
	// 		Changes: []*armresourcegraph.ResourceChangeData{
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:54:24.42Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:32:05.993Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("2db0ad2d-f6f0-4f46-b529-5c4e8c494648"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeUpdate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T21:12:31.337Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T10:30:19.68Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("9dc352cb-b7c1-4198-9eda-e5e3ed66aec8"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeCreate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (FirstPageQuery)

Generated from example definition: 2020-09-01-preview/ResourceChangesFirstPage.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
	"time"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourceChanges(ctx, armresourcegraph.ResourceChangesRequestParameters{
		Top: to.Ptr[int32](2),
		Interval: &armresourcegraph.ResourceChangesRequestParametersInterval{
			End:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T12:09:03.141Z"); return t }()),
			Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T12:09:03.141Z"); return t }()),
		},
		ResourceIDs: []*string{
			to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
		},
	}, 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 = armresourcegraph.ClientResourceChangesResponse{
	// 	ResourceChangeList: armresourcegraph.ResourceChangeList{
	// 		SkipToken: "ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT",
	// 		Changes: []*armresourcegraph.ResourceChangeData{
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:54:24.42Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:32:05.993Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("2db0ad2d-f6f0-4f46-b529-5c4e8c494648"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeUpdate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T21:12:31.337Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T10:30:19.68Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("9dc352cb-b7c1-4198-9eda-e5e3ed66aec8"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeCreate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (NextPageQuery)

Generated from example definition: 2020-09-01-preview/ResourceChangesNextPage.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
	"time"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourceChanges(ctx, armresourcegraph.ResourceChangesRequestParameters{
		SkipToken: to.Ptr("ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT"),
		Top:       to.Ptr[int32](2),
		Interval: &armresourcegraph.ResourceChangesRequestParametersInterval{
			End:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T12:09:03.141Z"); return t }()),
			Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T12:09:03.141Z"); return t }()),
		},
		ResourceIDs: []*string{
			to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
		},
	}, 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 = armresourcegraph.ClientResourceChangesResponse{
	// 	ResourceChangeList: armresourcegraph.ResourceChangeList{
	// 		SkipToken: "kVGltZSI6ICJcL0RhdGUoMTU1MDc0NTew0KICAiJGlkIjogIjEiLA0KICAiRW5",
	// 		Changes: []*armresourcegraph.ResourceChangeData{
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T05:12:32.087Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T03:43:08.629Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("55f458c4-f1c0-4963-bc6c-af275cd47702"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeUpdate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 			{
	// 				AfterSnapshot: &armresourcegraph.ResourceChangeDataAfterSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T02:01:02.163Z"); return t}()),
	// 				},
	// 				BeforeSnapshot: &armresourcegraph.ResourceChangeDataBeforeSnapshot{
	// 					Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T01:54:24.42Z"); return t}()),
	// 				},
	// 				ChangeID: to.Ptr("0495b929-b86d-46cc-a972-939145feed90"),
	// 				ChangeType: to.Ptr(armresourcegraph.ChangeTypeCreate),
	// 				ResourceID: to.Ptr("/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount"),
	// 			},
	// 		},
	// 	},
	// }
}

func (*Client) Resources added in v0.2.0

func (client *Client) Resources(ctx context.Context, query QueryRequest, options *ClientResourcesOptions) (ClientResourcesResponse, error)

Resources - Queries the resources managed by Azure Resource Manager for scopes specified in the request. If the operation fails it returns an *azcore.ResponseError type.

  • query - The request body
  • options - ClientResourcesOptions contains the optional parameters for the Client.Resources method.
Example (AccessAPropertiesField)

Generated from example definition: 2024-04-01/ResourcesPropertiesQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](2),
	// 		Data: []any{
	// 			map[string]any{
	// 				"count": 7,
	// 				"properties_storageProfile_osDisk_osType": "Linux",
	// 			},
	// 			map[string]any{
	// 				"count": 23,
	// 				"properties_storageProfile_osDisk_osType": "Windows",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](2),
	// 	},
	// }
}
Example (BasicManagementGroupQuery)

Generated from example definition: 2024-04-01/ResourcesMgBasicQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		ManagementGroups: []*string{
			to.Ptr("e927f598-c1d4-4f72-8541-95d83a6a4ac8"),
			to.Ptr("ProductionMG"),
		},
		Query: to.Ptr("Resources | project id, name, type, location, tags | limit 3"),
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "myNetworkInterface",
	// 				"type": "microsoft.network/networkinterfaces",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
	// 				"location": "centralus",
	// 				"tags": map[string]any{
	// 					"tag1": "Value1",
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myVnet",
	// 				"type": "microsoft.network/virtualnetworks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myPublicIp",
	// 				"type": "microsoft.network/publicipaddresses",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}
Example (BasicQuery)

Generated from example definition: 2024-04-01/ResourcesBasicQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | project id, name, type, location, tags | limit 3"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "myNetworkInterface",
	// 				"type": "microsoft.network/networkinterfaces",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
	// 				"location": "centralus",
	// 				"tags": map[string]any{
	// 					"tag1": "Value1",
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myVnet",
	// 				"type": "microsoft.network/virtualnetworks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myPublicIp",
	// 				"type": "microsoft.network/publicipaddresses",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}
Example (BasicTenantQuery)

Generated from example definition: 2024-04-01/ResourcesTenantBasicQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | project id, name, type, location, tags | limit 3"),
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "myNetworkInterface",
	// 				"type": "microsoft.network/networkinterfaces",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Network/networkInterfaces/myNetworkInterface",
	// 				"location": "centralus",
	// 				"tags": map[string]any{
	// 					"tag1": "Value1",
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myVnet",
	// 				"type": "microsoft.network/virtualnetworks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/virtualNetworks/myVnet",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 			map[string]any{
	// 				"name": "myPublicIp",
	// 				"type": "microsoft.network/publicipaddresses",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Network/publicIPAddresses/myPublicIp",
	// 				"location": "westus",
	// 				"tags": map[string]any{
	// 				},
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}
Example (ComplexQuery)

Generated from example definition: 2024-04-01/ResourcesComplexQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"count_": 11,
	// 				"location": "centralus",
	// 			},
	// 			map[string]any{
	// 				"count_": 11,
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"count_": 3,
	// 				"location": "southcentralus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}
Example (FilterResources)

Generated from example definition: 2024-04-01/ResourcesFilterQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "myVm1",
	// 				"type": "microsoft.compute/virtualmachines",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/virtualMachines/myVm1",
	// 				"location": "centralus",
	// 			},
	// 			map[string]any{
	// 				"name": "myVirtualMachine",
	// 				"type": "microsoft.compute/virtualmachines",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Compute/virtualMachines/myVirtualMachine",
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"name": "testVm",
	// 				"type": "microsoft.compute/virtualmachines",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG3/providers/Microsoft.Compute/virtualMachines/testVm",
	// 				"location": "eastus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}
Example (FirstPageQuery)

Generated from example definition: 2024-04-01/ResourcesFirstPageQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Options: &armresourcegraph.QueryRequestOptions{
			Skip: to.Ptr[int32](0),
			Top:  to.Ptr[int32](3),
		},
		Query: to.Ptr("Resources | where name contains 'test' | project id, name, type, location"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		SkipToken: to.Ptr("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ=="),
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
	// 				"type": "microsoft.compute/disks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/yetanothertest_OsDisk_1_f396cbcb625a457bb69fe2abf5975820",
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"name": "TestAA",
	// 				"type": "microsoft.automation/automationaccounts",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA",
	// 				"location": "westcentralus",
	// 			},
	// 			map[string]any{
	// 				"name": "TestRB",
	// 				"type": "microsoft.automation/automationaccounts/runbooks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/TestRB",
	// 				"location": "westcentralus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](386),
	// 	},
	// }
}
Example (NextPageQuery)

Generated from example definition: 2024-04-01/ResourcesNextPageQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Options: &armresourcegraph.QueryRequestOptions{
			SkipToken: to.Ptr("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ=="),
		},
		Query: to.Ptr("Resources | where name contains 'test' | project id, name, type, location"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		SkipToken: to.Ptr("eyAibm8yIjogImx1Y2syIiwgImJ1dDIiOiAibmljZTIiLCAidHJ5MiI6ICIhIiB9"),
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "second_OsDisk_dddddbcb625a457bb69fe2abf5975820",
	// 				"type": "microsoft.compute/disks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/second_OsDisk_dddddbcb625a457bb69fe2abf5975820",
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"name": "AATest",
	// 				"type": "microsoft.automation/automationaccounts",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/AATest",
	// 				"location": "westcentralus",
	// 			},
	// 			map[string]any{
	// 				"name": "RBTest",
	// 				"type": "microsoft.automation/automationaccounts/runbooks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/TestAA/runbooks/RBTest",
	// 				"location": "westcentralus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](386),
	// 	},
	// }
}
Example (QueryWithAFacetRequest)

Generated from example definition: 2024-04-01/ResourcesFacetQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Facets: []*armresourcegraph.FacetRequest{
			{
				Expression: to.Ptr("location"),
				Options: &armresourcegraph.FacetRequestOptions{
					Top:       to.Ptr[int32](3),
					SortOrder: to.Ptr(armresourcegraph.FacetSortOrderDesc),
				},
			},
			{
				Expression: to.Ptr("properties.storageProfile.osDisk.osType"),
				Options: &armresourcegraph.FacetRequestOptions{
					Top:       to.Ptr[int32](3),
					SortOrder: to.Ptr(armresourcegraph.FacetSortOrderDesc),
				},
			},
			{
				Expression: to.Ptr("nonExistingColumn"),
				Options: &armresourcegraph.FacetRequestOptions{
					Top:       to.Ptr[int32](3),
					SortOrder: to.Ptr(armresourcegraph.FacetSortOrderDesc),
				},
			},
			{
				Expression: to.Ptr("resourceGroup"),
				Options: &armresourcegraph.FacetRequestOptions{
					Top:       to.Ptr[int32](3),
					SortBy:    to.Ptr("tolower(resourceGroup)"),
					SortOrder: to.Ptr(armresourcegraph.FacetSortOrderAsc),
				},
			},
			{
				Expression: to.Ptr("resourceGroup"),
				Options: &armresourcegraph.FacetRequestOptions{
					Top:    to.Ptr[int32](3),
					Filter: to.Ptr("resourceGroup contains 'test'"),
				},
			},
		},
		Query: to.Ptr("Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](5),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "myTestVm",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/B-TEST-RG/providers/Microsoft.Compute/virtualMachines/myTestVm",
	// 				"location": "eastus",
	// 				"properties_storageProfile_osDisk_osType": "Windows",
	// 				"resourceGroup": "B-TEST-RG",
	// 			},
	// 			map[string]any{
	// 				"name": "myTestAccountVm",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/c-rg/providers/Microsoft.Compute/virtualMachines/myTestAccountVm",
	// 				"location": "westcentralus",
	// 				"properties_storageProfile_osDisk_osType": "Windows",
	// 				"resourceGroup": "c-rg",
	// 			},
	// 			map[string]any{
	// 				"name": "yetanothertest",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/I-RG/providers/Microsoft.Compute/virtualMachines/yetanothertest",
	// 				"location": "eastus",
	// 				"properties_storageProfile_osDisk_osType": "Linux",
	// 				"resourceGroup": "I-RG",
	// 			},
	// 			map[string]any{
	// 				"name": "drafttest1bux4cv7a7q3aw",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/x-test-rg/providers/Microsoft.Compute/virtualMachines/drafttest1bux4cv7a7q3aw",
	// 				"location": "southcentralus",
	// 				"properties_storageProfile_osDisk_osType": "Linux",
	// 				"resourceGroup": "x-test-rg",
	// 			},
	// 			map[string]any{
	// 				"name": "testvmntp25370",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/y-rg/providers/Microsoft.Compute/virtualMachines/testvmntp25370",
	// 				"location": "eastus",
	// 				"properties_storageProfile_osDisk_osType": "Windows",
	// 				"resourceGroup": "y-rg",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 			&armresourcegraph.FacetResult{
	// 				Count: to.Ptr[int32](3),
	// 				Data: []any{
	// 					map[string]any{
	// 						"count": 3,
	// 						"location": "eastus",
	// 					},
	// 					map[string]any{
	// 						"count": 1,
	// 						"location": "southcentralus",
	// 					},
	// 					map[string]any{
	// 						"count": 1,
	// 						"location": "westcentralus",
	// 					},
	// 				},
	// 				Expression: to.Ptr("location"),
	// 				ResultType: to.Ptr("FacetResult"),
	// 				TotalRecords: to.Ptr[int64](3),
	// 			},
	// 			&armresourcegraph.FacetResult{
	// 				Count: to.Ptr[int32](2),
	// 				Data: []any{
	// 					map[string]any{
	// 						"count": 2,
	// 						"properties_storageProfile_osDisk_osType": "Linux",
	// 					},
	// 					map[string]any{
	// 						"count": 3,
	// 						"properties_storageProfile_osDisk_osType": "Windows",
	// 					},
	// 				},
	// 				Expression: to.Ptr("properties.storageProfile.osDisk.osType"),
	// 				ResultType: to.Ptr("FacetResult"),
	// 				TotalRecords: to.Ptr[int64](2),
	// 			},
	// 			&armresourcegraph.FacetError{
	// 				Errors: []*armresourcegraph.ErrorDetails{
	// 					{
	// 						Code: to.Ptr("NoValidColumns"),
	// 						Message: to.Ptr("No valid columns in facet expression."),
	// 					},
	// 					{
	// 						Code: to.Ptr("InvalidColumnNames"),
	// 						Message: to.Ptr("Invalid column names: [nonExistingColumn]."),
	// 					},
	// 				},
	// 				Expression: to.Ptr("nonExistingColumn"),
	// 				ResultType: to.Ptr("FacetError"),
	// 			},
	// 			&armresourcegraph.FacetResult{
	// 				Count: to.Ptr[int32](3),
	// 				Data: []any{
	// 					map[string]any{
	// 						"count": 1,
	// 						"resourceGroup": "B-TEST-RG",
	// 					},
	// 					map[string]any{
	// 						"count": 1,
	// 						"resourceGroup": "c-rg",
	// 					},
	// 					map[string]any{
	// 						"count": 1,
	// 						"resourceGroup": "I-RG",
	// 					},
	// 				},
	// 				Expression: to.Ptr("resourceGroup"),
	// 				ResultType: to.Ptr("FacetResult"),
	// 				TotalRecords: to.Ptr[int64](5),
	// 			},
	// 			&armresourcegraph.FacetResult{
	// 				Count: to.Ptr[int32](2),
	// 				Data: []any{
	// 					map[string]any{
	// 						"count": 1,
	// 						"resourceGroup": "B-TEST-RG",
	// 					},
	// 					map[string]any{
	// 						"count": 1,
	// 						"resourceGroup": "x-test-rg",
	// 					},
	// 				},
	// 				Expression: to.Ptr("resourceGroup"),
	// 				ResultType: to.Ptr("FacetResult"),
	// 				TotalRecords: to.Ptr[int64](2),
	// 			},
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](5),
	// 	},
	// }
}
Example (RandomPageQuery)

Generated from example definition: 2024-04-01/ResourcesRandomPageQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Options: &armresourcegraph.QueryRequestOptions{
			Skip: to.Ptr[int32](10),
			Top:  to.Ptr[int32](2),
		},
		Query: to.Ptr("Resources | where name contains 'test' | project id, name, type, location"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		SkipToken: to.Ptr("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ=="),
	// 		Count: to.Ptr[int64](2),
	// 		Data: []any{
	// 			map[string]any{
	// 				"name": "third_OsDisk_dddddbcb625a457bb69fe2abf5975820",
	// 				"type": "microsoft.compute/disks",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG1/providers/Microsoft.Compute/disks/third_OsDisk_dddddbcb625a457bb69fe2abf5975820",
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"name": "CCTest",
	// 				"type": "microsoft.automation/automationaccounts",
	// 				"id": "/subscriptions/cfbbd179-59d2-4052-aa06-9270a38aa9d6/resourceGroups/RG2/providers/Microsoft.Automation/automationAccounts/CCTest",
	// 				"location": "westcentralus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](386),
	// 	},
	// }
}
Example (SummarizeResourcesByLocation)

Generated from example definition: 2024-04-01/ResourcesSummarizeQuery.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Resources(ctx, armresourcegraph.QueryRequest{
		Query: to.Ptr("Resources | project id, name, type, location | summarize by location"),
		Subscriptions: []*string{
			to.Ptr("cfbbd179-59d2-4052-aa06-9270a38aa9d6"),
		},
	}, 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 = armresourcegraph.ClientResourcesResponse{
	// 	QueryResponse: armresourcegraph.QueryResponse{
	// 		Count: to.Ptr[int64](3),
	// 		Data: []any{
	// 			map[string]any{
	// 				"location": "centralus",
	// 			},
	// 			map[string]any{
	// 				"location": "eastus",
	// 			},
	// 			map[string]any{
	// 				"location": "westus",
	// 			},
	// 		},
	// 		Facets: []armresourcegraph.FacetClassification{
	// 		},
	// 		ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse),
	// 		TotalRecords: to.Ptr[int64](3),
	// 	},
	// }
}

func (*Client) ResourcesHistory added in v0.2.0

ResourcesHistory - List all snapshots of a resource for a given time interval. If the operation fails it returns an *azcore.ResponseError type.

  • request - The request body
  • options - ClientResourcesHistoryOptions contains the optional parameters for the Client.ResourcesHistory method.
Example (ResourceHistoryManagementGroupScopeQuery)

Generated from example definition: 2021-06-01-preview/ResourcesHistoryMgsGet.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
	"time"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourcesHistory(ctx, armresourcegraph.ResourcesHistoryRequest{
		ManagementGroups: []*string{
			to.Ptr("e927f598-c1d4-4f72-8541-95d83a6a4ac8"),
			to.Ptr("ProductionMG"),
		},
		Options: &armresourcegraph.ResourcesHistoryRequestOptions{
			Interval: &armresourcegraph.DateTimeInterval{
				End:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:25:00.0000000Z"); return t }()),
				Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:00:00.0000000Z"); return t }()),
			},
		},
		Query: to.Ptr("where name =~ 'cpu-utilization' | project id, name, properties"),
	}, 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 = armresourcegraph.ClientResourcesHistoryResponse{
	// 	Interface: map[string]any{
	// 		"count": 2,
	// 		"snapshots": map[string]any{
	// 			"columns": []any{
	// 				map[string]any{
	// 					"name": "id",
	// 					"type": "string",
	// 				},
	// 				map[string]any{
	// 					"name": "name",
	// 					"type": "string",
	// 				},
	// 				map[string]any{
	// 					"name": "properties",
	// 					"type": "object",
	// 				},
	// 			},
	// 			"rows": []any{
	// 				[]any{
	// 					"/subscriptions/a7f33fdb-e646-4f15-89aa-3a360210861e/resourceGroups/meya-test-rg/providers/Microsoft.Compute/virtualMachines/meya-win-eus/providers/Microsoft.WorkloadMonitor/monitors/cpu-utilization",
	// 					"cpu-utilization",
	// 					map[string]any{
	// 						"currentStateFirstObservedTimestamp": "",
	// 						"monitorName": "",
	// 					},
	// 				},
	// 				[]any{
	// 					"/subscriptions/a7f33fdb-e646-4f15-89aa-3a360210861e/resourceGroups/meya-test-rg/providers/Microsoft.Compute/virtualMachines/meya-win-eus/providers/Microsoft.WorkloadMonitor/monitors/cpu-utilization",
	// 					"cpu-utilization",
	// 					map[string]any{
	// 						"currentStateFirstObservedTimestamp": "",
	// 						"monitorName": "test",
	// 					},
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}
Example (ResourceHistoryQuery)

Generated from example definition: 2021-06-01-preview/ResourcesHistoryGet.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
	"time"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().ResourcesHistory(ctx, armresourcegraph.ResourcesHistoryRequest{
		Options: &armresourcegraph.ResourcesHistoryRequestOptions{
			Interval: &armresourcegraph.DateTimeInterval{
				End:   to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:25:00.0000000Z"); return t }()),
				Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:00:00.0000000Z"); return t }()),
			},
		},
		Query: to.Ptr("where name =~ 'cpu-utilization' | project id, name, properties"),
		Subscriptions: []*string{
			to.Ptr("a7f33fdb-e646-4f15-89aa-3a360210861e"),
		},
	}, 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 = armresourcegraph.ClientResourcesHistoryResponse{
	// 	Interface: map[string]any{
	// 		"count": 2,
	// 		"snapshots": map[string]any{
	// 			"columns": []any{
	// 				map[string]any{
	// 					"name": "id",
	// 					"type": "string",
	// 				},
	// 				map[string]any{
	// 					"name": "name",
	// 					"type": "string",
	// 				},
	// 				map[string]any{
	// 					"name": "properties",
	// 					"type": "object",
	// 				},
	// 			},
	// 			"rows": []any{
	// 				[]any{
	// 					"/subscriptions/a7f33fdb-e646-4f15-89aa-3a360210861e/resourceGroups/meya-test-rg/providers/Microsoft.Compute/virtualMachines/meya-win-eus/providers/Microsoft.WorkloadMonitor/monitors/cpu-utilization",
	// 					"cpu-utilization",
	// 					map[string]any{
	// 						"currentStateFirstObservedTimestamp": "",
	// 						"monitorName": "",
	// 					},
	// 				},
	// 				[]any{
	// 					"/subscriptions/a7f33fdb-e646-4f15-89aa-3a360210861e/resourceGroups/meya-test-rg/providers/Microsoft.Compute/virtualMachines/meya-win-eus/providers/Microsoft.WorkloadMonitor/monitors/cpu-utilization",
	// 					"cpu-utilization",
	// 					map[string]any{
	// 						"currentStateFirstObservedTimestamp": "",
	// 						"monitorName": "test",
	// 					},
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}

type ClientFactory added in v0.7.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 v0.7.0

func NewClientFactory(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.

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

func (*ClientFactory) NewClient added in v0.7.0

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

func (*ClientFactory) NewGraphQueryClient added in v0.10.0

func (c *ClientFactory) NewGraphQueryClient(subscriptionID string) *GraphQueryClient

NewGraphQueryClient creates a new instance of GraphQueryClient.

func (*ClientFactory) NewOperationsClient added in v0.7.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

type ClientResourceChangeDetailsOptions added in v0.10.0

type ClientResourceChangeDetailsOptions struct {
}

ClientResourceChangeDetailsOptions contains the optional parameters for the Client.ResourceChangeDetails method.

type ClientResourceChangeDetailsResponse added in v0.10.0

type ClientResourceChangeDetailsResponse struct {
	ResourceChangeDataArray []*ResourceChangeData
}

ClientResourceChangeDetailsResponse contains the response from method Client.ResourceChangeDetails.

type ClientResourceChangesOptions added in v0.10.0

type ClientResourceChangesOptions struct {
}

ClientResourceChangesOptions contains the optional parameters for the Client.ResourceChanges method.

type ClientResourceChangesResponse added in v0.10.0

type ClientResourceChangesResponse struct {
	// A list of changes associated with a resource over a specific time interval.
	ResourceChangeList
}

ClientResourceChangesResponse contains the response from method Client.ResourceChanges.

type ClientResourcesHistoryOptions added in v0.2.0

type ClientResourcesHistoryOptions struct {
}

ClientResourcesHistoryOptions contains the optional parameters for the Client.ResourcesHistory method.

type ClientResourcesHistoryResponse added in v0.2.0

type ClientResourcesHistoryResponse struct {
	Interface any
}

ClientResourcesHistoryResponse contains the response from method Client.ResourcesHistory.

type ClientResourcesOptions added in v0.2.0

type ClientResourcesOptions struct {
}

ClientResourcesOptions contains the optional parameters for the Client.Resources method.

type ClientResourcesResponse added in v0.2.0

type ClientResourcesResponse struct {
	// Query result.
	QueryResponse
}

ClientResourcesResponse contains the response from method Client.Resources.

type CreatedByType added in v0.10.0

type CreatedByType string

CreatedByType - The kind of entity that created the resource.

const (
	// CreatedByTypeApplication - The entity was created by an application.
	CreatedByTypeApplication CreatedByType = "Application"
	// CreatedByTypeKey - The entity was created by a key.
	CreatedByTypeKey CreatedByType = "Key"
	// CreatedByTypeManagedIdentity - The entity was created by a managed identity.
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	// CreatedByTypeUser - The entity was created by a user.
	CreatedByTypeUser CreatedByType = "User"
)

func PossibleCreatedByTypeValues added in v0.10.0

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type DateTimeInterval

type DateTimeInterval struct {
	// REQUIRED; A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an
	// `end` that occurs chronologically before `start` will result in an error.
	End *time.Time

	// REQUIRED; A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying
	// a `start` that occurs chronologically after `end` will result in an error.
	Start *time.Time
}

DateTimeInterval - An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`.

func (DateTimeInterval) MarshalJSON

func (d DateTimeInterval) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DateTimeInterval.

func (*DateTimeInterval) UnmarshalJSON

func (d *DateTimeInterval) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DateTimeInterval.

type ErrorDetails

type ErrorDetails struct {
	// REQUIRED; Error code identifying the specific error.
	Code *string

	// REQUIRED; A human readable error message.
	Message              *string
	AdditionalProperties map[string]any
}

ErrorDetails - Error details.

Error details.

func (ErrorDetails) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ErrorDetails.

func (*ErrorDetails) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails.

type Facet

type Facet struct {
	// REQUIRED; Facet expression, same as in the corresponding facet request.
	Expression *string

	// REQUIRED; Result type
	ResultType *string
}

Facet - A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError.

func (*Facet) GetFacet

func (f *Facet) GetFacet() *Facet

GetFacet implements the FacetClassification interface for type Facet.

func (Facet) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type Facet.

func (*Facet) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Facet.

type FacetClassification

type FacetClassification interface {
	// GetFacet returns the Facet content of the underlying type.
	GetFacet() *Facet
}

FacetClassification provides polymorphic access to related types. Call the interface's GetFacet() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *Facet, *FacetError, *FacetResult

type FacetError

type FacetError struct {
	// REQUIRED; An array containing detected facet errors with details.
	Errors []*ErrorDetails

	// REQUIRED; Facet expression, same as in the corresponding facet request.
	Expression *string

	// REQUIRED; Result type
	ResultType *string
}

FacetError - A facet whose execution resulted in an error.

func (*FacetError) GetFacet added in v0.2.0

func (f *FacetError) GetFacet() *Facet

GetFacet implements the FacetClassification interface for type FacetError.

func (FacetError) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type FacetError.

func (*FacetError) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type FacetError.

type FacetRequest

type FacetRequest struct {
	// REQUIRED; The column or list of columns to summarize by
	Expression *string

	// The options for facet evaluation
	Options *FacetRequestOptions
}

FacetRequest - A request to compute additional statistics (facets) over the query results.

func (FacetRequest) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type FacetRequest.

func (*FacetRequest) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type FacetRequest.

type FacetRequestOptions

type FacetRequestOptions struct {
	// Specifies the filter condition for the 'where' clause which will be run on main query's result, just before the actual
	// faceting.
	Filter *string

	// The column name or query expression to sort on. Defaults to count if not present.
	SortBy *string

	// The sorting order by the selected column (count by default).
	SortOrder *FacetSortOrder

	// The maximum number of facet rows that should be returned.
	Top *int32
}

FacetRequestOptions - The options for facet evaluation

func (FacetRequestOptions) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type FacetRequestOptions.

func (*FacetRequestOptions) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type FacetRequestOptions.

type FacetResult

type FacetResult struct {
	// REQUIRED; Number of records returned in the facet response.
	Count *int32

	// REQUIRED; A JObject array or Table containing the desired facets. Only present if the facet is valid.
	Data any

	// REQUIRED; Facet expression, same as in the corresponding facet request.
	Expression *string

	// REQUIRED; Result type
	ResultType *string

	// REQUIRED; Number of total records in the facet results.
	TotalRecords *int64
}

FacetResult - Successfully executed facet containing additional statistics on the response of a query.

func (*FacetResult) GetFacet added in v0.2.0

func (f *FacetResult) GetFacet() *Facet

GetFacet implements the FacetClassification interface for type FacetResult.

func (FacetResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type FacetResult.

func (*FacetResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type FacetResult.

type FacetSortOrder

type FacetSortOrder string

FacetSortOrder - The sorting order by the selected column (count by default).

const (
	// FacetSortOrderAsc - asc
	FacetSortOrderAsc FacetSortOrder = "asc"
	// FacetSortOrderDesc - desc
	FacetSortOrderDesc FacetSortOrder = "desc"
)

func PossibleFacetSortOrderValues

func PossibleFacetSortOrderValues() []FacetSortOrder

PossibleFacetSortOrderValues returns the possible values for the FacetSortOrder const type.

type GraphQueryClient added in v0.10.0

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

GraphQueryClient contains the methods for the GraphQuery group. Don't use this type directly, use NewGraphQueryClient() instead.

Generated from API version 2024-04-01

func NewGraphQueryClient added in v0.10.0

func NewGraphQueryClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GraphQueryClient, error)

NewGraphQueryClient creates a new instance of GraphQueryClient with the specified values.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*GraphQueryClient) CreateOrUpdate added in v0.10.0

func (client *GraphQueryClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, properties GraphQueryResource, options *GraphQueryClientCreateOrUpdateOptions) (GraphQueryClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create a new graph query. If the operation fails it returns an *azcore.ResponseError type.

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the Graph Query resource.
  • properties - Properties that need to be specified to create a new graph query.
  • options - GraphQueryClientCreateOrUpdateOptions contains the optional parameters for the GraphQueryClient.CreateOrUpdate method.
Example

Generated from example definition: 2024-04-01/GraphQueryAdd.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").CreateOrUpdate(ctx, "my-resource-group", "MyDockerVMs", armresourcegraph.GraphQueryResource{
		Properties: &armresourcegraph.GraphQueryProperties{
			Description: to.Ptr("Docker VMs in PROD"),
			Query:       to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
		},
		Tags: map[string]*string{},
	}, 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 = armresourcegraph.GraphQueryClientCreateOrUpdateResponse{
	// 	GraphQueryResource: armresourcegraph.GraphQueryResource{
	// 		Name: to.Ptr("MyDockerVMs"),
	// 		Type: to.Ptr("Microsoft.ResourceGraph/queries"),
	// 		Etag: to.Ptr("5d64408e-4ca3-41f7-b725-6914f3012afa"),
	// 		ID: to.Ptr("/subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs"),
	// 		Properties: &armresourcegraph.GraphQueryProperties{
	// 			Description: to.Ptr("Docker VMs in PROD"),
	// 			Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
	// 			ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
	// 			TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T13:51:13-07:00"); return t}()),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

func (*GraphQueryClient) Delete added in v0.10.0

func (client *GraphQueryClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *GraphQueryClientDeleteOptions) (GraphQueryClientDeleteResponse, error)

Delete - Delete a graph query. If the operation fails it returns an *azcore.ResponseError type.

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the Graph Query resource.
  • options - GraphQueryClientDeleteOptions contains the optional parameters for the GraphQueryClient.Delete method.
Example

Generated from example definition: 2024-04-01/GraphQueryDelete.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").Delete(ctx, "my-resource-group", "MyDockerVM", 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 = armresourcegraph.GraphQueryClientDeleteResponse{
	// }
}

func (*GraphQueryClient) Get added in v0.10.0

func (client *GraphQueryClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *GraphQueryClientGetOptions) (GraphQueryClientGetResponse, error)

Get - Get a single graph query by its resourceName. If the operation fails it returns an *azcore.ResponseError type.

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the Graph Query resource.
  • options - GraphQueryClientGetOptions contains the optional parameters for the GraphQueryClient.Get method.
Example

Generated from example definition: 2024-04-01/GraphQueryGet.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").Get(ctx, "my-resource-group", "MyDockerVMs", 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 = armresourcegraph.GraphQueryClientGetResponse{
	// 	GraphQueryResource: armresourcegraph.GraphQueryResource{
	// 		Name: to.Ptr("MyDockerVMs"),
	// 		Type: to.Ptr("Microsoft.ResourceGraph/queries"),
	// 		Etag: to.Ptr("5d64408e-4ca3-41f7-b725-6914f3012afa"),
	// 		ID: to.Ptr("/subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs"),
	// 		Properties: &armresourcegraph.GraphQueryProperties{
	// 			Description: to.Ptr("Docker VMs in PROD"),
	// 			Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
	// 			ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
	// 			TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T13:51:13-07:00"); return t}()),
	// 		},
	// 	},
	// }
}

func (*GraphQueryClient) NewListBySubscriptionPager added in v0.10.0

NewListBySubscriptionPager - Get all graph queries defined within a specified subscription.

  • options - GraphQueryClientListBySubscriptionOptions contains the optional parameters for the GraphQueryClient.NewListBySubscriptionPager method.
Example

Generated from example definition: 2024-04-01/GraphQueryList.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").NewListBySubscriptionPager(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 = armresourcegraph.GraphQueryClientListBySubscriptionResponse{
		// 	GraphQueryListResult: armresourcegraph.GraphQueryListResult{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/subscriptionId/providers/Microsoft.ResourceGraph/queries?api-version=2019-09-01-preview&$top=10&$skiptoken=skiptoken"),
		// 		Value: []*armresourcegraph.GraphQueryResource{
		// 			{
		// 				Name: to.Ptr("MyDockerVMs"),
		// 				Type: to.Ptr("Microsoft.ResourceGraph/queries"),
		// 				Etag: to.Ptr("5d64408e-4ca3-41f7-b725-6914f3012afa"),
		// 				ID: to.Ptr("/subscriptions/87f4f8b0-83c1-4aa9-b318-5237aeb15264/resourceGroups/rid1/providers/Microsoft.ResourceGraph/queries/MyDockerVMs"),
		// 				Properties: &armresourcegraph.GraphQueryProperties{
		// 					Description: to.Ptr("Docker VMs in PROD"),
		// 					Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
		// 					ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
		// 					TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T13:51:13-07:00"); return t}()),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("MyTestVMs"),
		// 				Type: to.Ptr("Microsoft.ResourceGraph/queries"),
		// 				Etag: to.Ptr("b0809832-ca62-4133-8f13-0c46580f9db1"),
		// 				ID: to.Ptr("/subscriptions/6abb2f31-3e6a-4134-9968-219a596012a0/resourceGroups/rid2/providers/Microsoft.ResourceGraph/queries/MyTestVMs"),
		// 				Properties: &armresourcegraph.GraphQueryProperties{
		// 					Description: to.Ptr("Test VMs in PROD"),
		// 					Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'test'"),
		// 					ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
		// 					TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-13T13:51:13-07:00"); return t}()),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*GraphQueryClient) NewListPager added in v0.10.0

func (client *GraphQueryClient) NewListPager(resourceGroupName string, options *GraphQueryClientListOptions) *runtime.Pager[GraphQueryClientListResponse]

NewListPager - Get all graph queries defined within a specified subscription and resource group.

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - GraphQueryClientListOptions contains the optional parameters for the GraphQueryClient.NewListPager method.
Example

Generated from example definition: 2024-04-01/GraphQueryList1.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").NewListPager("my-resource-group", 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 = armresourcegraph.GraphQueryClientListResponse{
		// 	GraphQueryListResult: armresourcegraph.GraphQueryListResult{
		// 		NextLink: to.Ptr("https://management.azure.com/subscriptions/subscriptionId/providers/Microsoft.ResourceGraph/queries?api-version=2019-09-01-preview&$top=10&$skiptoken=skiptoken"),
		// 		Value: []*armresourcegraph.GraphQueryResource{
		// 			{
		// 				Name: to.Ptr("MyDockerVMs"),
		// 				Type: to.Ptr("Microsoft.ResourceGraph/queries"),
		// 				Etag: to.Ptr("5d64408e-4ca3-41f7-b725-6914f3012afa"),
		// 				ID: to.Ptr("/subscriptions/87f4f8b0-83c1-4aa9-b318-5237aeb15264/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs"),
		// 				Properties: &armresourcegraph.GraphQueryProperties{
		// 					Description: to.Ptr("Docker VMs in PROD"),
		// 					Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
		// 					ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
		// 					TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T13:51:13-07:00"); return t}()),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("MyTestVMs"),
		// 				Type: to.Ptr("Microsoft.ResourceGraph/queries"),
		// 				Etag: to.Ptr("b0809832-ca62-4133-8f13-0c46580f9db1"),
		// 				ID: to.Ptr("/subscriptions/6abb2f31-3e6a-4134-9968-219a596012a0/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyTestVMs"),
		// 				Properties: &armresourcegraph.GraphQueryProperties{
		// 					Description: to.Ptr("Test VMs in PROD"),
		// 					Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'test'"),
		// 					ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
		// 					TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-13T13:51:13-07:00"); return t}()),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*GraphQueryClient) Update added in v0.10.0

func (client *GraphQueryClient) Update(ctx context.Context, resourceGroupName string, resourceName string, body GraphQueryUpdateParameters, options *GraphQueryClientUpdateOptions) (GraphQueryClientUpdateResponse, error)

Update - Updates a graph query that has already been added. If the operation fails it returns an *azcore.ResponseError type.

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • resourceName - The name of the Graph Query resource.
  • body - Properties that need to be specified to create a new graph query.
  • options - GraphQueryClientUpdateOptions contains the optional parameters for the GraphQueryClient.Update method.
Example

Generated from example definition: 2024-04-01/GraphQueryUpdate.json

package main

import (
	"context"
	"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/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGraphQueryClient("024e2271-06fa-46b6-9079-f1ed3c7b070e").Update(ctx, "my-resource-group", "MyDockerVMs", armresourcegraph.GraphQueryUpdateParameters{
		Etag: to.Ptr("b0809832-ca62-4133-8f13-0c46580f9db1"),
		Properties: &armresourcegraph.GraphQueryPropertiesUpdateParameters{
			Description: to.Ptr("Modified description"),
			Query:       to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
		},
	}, 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 = armresourcegraph.GraphQueryClientUpdateResponse{
	// 	GraphQueryResource: armresourcegraph.GraphQueryResource{
	// 		Name: to.Ptr("MyDockerVMs"),
	// 		Type: to.Ptr("Microsoft.ResourceGraph/queries"),
	// 		Etag: to.Ptr("73811091-6188-4523-97b7-b5e7134e7fd9"),
	// 		ID: to.Ptr("/subscriptions/024e2271-06fa-46b6-9079-f1ed3c7b070e/resourceGroups/my-resource-group/providers/Microsoft.ResourceGraph/queries/MyDockerVMs"),
	// 		Properties: &armresourcegraph.GraphQueryProperties{
	// 			Description: to.Ptr("Modified description"),
	// 			Query: to.Ptr("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'"),
	// 			ResultKind: to.Ptr(armresourcegraph.ResultKindBasic),
	// 			TimeModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-14T13:51:13-07:00"); return t}()),
	// 		},
	// 	},
	// }
}

type GraphQueryClientCreateOrUpdateOptions added in v0.10.0

type GraphQueryClientCreateOrUpdateOptions struct {
}

GraphQueryClientCreateOrUpdateOptions contains the optional parameters for the GraphQueryClient.CreateOrUpdate method.

type GraphQueryClientCreateOrUpdateResponse added in v0.10.0

type GraphQueryClientCreateOrUpdateResponse struct {
	// Graph Query entity definition.
	GraphQueryResource
}

GraphQueryClientCreateOrUpdateResponse contains the response from method GraphQueryClient.CreateOrUpdate.

type GraphQueryClientDeleteOptions added in v0.10.0

type GraphQueryClientDeleteOptions struct {
}

GraphQueryClientDeleteOptions contains the optional parameters for the GraphQueryClient.Delete method.

type GraphQueryClientDeleteResponse added in v0.10.0

type GraphQueryClientDeleteResponse struct {
}

GraphQueryClientDeleteResponse contains the response from method GraphQueryClient.Delete.

type GraphQueryClientGetOptions added in v0.10.0

type GraphQueryClientGetOptions struct {
}

GraphQueryClientGetOptions contains the optional parameters for the GraphQueryClient.Get method.

type GraphQueryClientGetResponse added in v0.10.0

type GraphQueryClientGetResponse struct {
	// Graph Query entity definition.
	GraphQueryResource
}

GraphQueryClientGetResponse contains the response from method GraphQueryClient.Get.

type GraphQueryClientListBySubscriptionOptions added in v0.10.0

type GraphQueryClientListBySubscriptionOptions struct {
}

GraphQueryClientListBySubscriptionOptions contains the optional parameters for the GraphQueryClient.NewListBySubscriptionPager method.

type GraphQueryClientListBySubscriptionResponse added in v0.10.0

type GraphQueryClientListBySubscriptionResponse struct {
	// Graph query list result.
	GraphQueryListResult
}

GraphQueryClientListBySubscriptionResponse contains the response from method GraphQueryClient.NewListBySubscriptionPager.

type GraphQueryClientListOptions added in v0.10.0

type GraphQueryClientListOptions struct {
}

GraphQueryClientListOptions contains the optional parameters for the GraphQueryClient.NewListPager method.

type GraphQueryClientListResponse added in v0.10.0

type GraphQueryClientListResponse struct {
	// Graph query list result.
	GraphQueryListResult
}

GraphQueryClientListResponse contains the response from method GraphQueryClient.NewListPager.

type GraphQueryClientUpdateOptions added in v0.10.0

type GraphQueryClientUpdateOptions struct {
}

GraphQueryClientUpdateOptions contains the optional parameters for the GraphQueryClient.Update method.

type GraphQueryClientUpdateResponse added in v0.10.0

type GraphQueryClientUpdateResponse struct {
	// Graph Query entity definition.
	GraphQueryResource
}

GraphQueryClientUpdateResponse contains the response from method GraphQueryClient.Update.

type GraphQueryListResult added in v0.10.0

type GraphQueryListResult struct {
	// REQUIRED; The GraphQueryResource items on this page
	Value []*GraphQueryResource

	// The link to the next page of items
	NextLink *string
}

GraphQueryListResult - Graph query list result.

func (GraphQueryListResult) MarshalJSON added in v0.10.0

func (g GraphQueryListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GraphQueryListResult.

func (*GraphQueryListResult) UnmarshalJSON added in v0.10.0

func (g *GraphQueryListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GraphQueryListResult.

type GraphQueryProperties added in v0.10.0

type GraphQueryProperties struct {
	// REQUIRED; KQL query that will be graph.
	Query *string

	// The description of a graph query.
	Description *string

	// READ-ONLY; Enum indicating a type of graph query.
	ResultKind *ResultKind

	// READ-ONLY; Date and time in UTC of the last modification that was made to this graph query definition.
	TimeModified *time.Time
}

GraphQueryProperties - Properties that contain a graph query.

func (GraphQueryProperties) MarshalJSON added in v0.10.0

func (g GraphQueryProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GraphQueryProperties.

func (*GraphQueryProperties) UnmarshalJSON added in v0.10.0

func (g *GraphQueryProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GraphQueryProperties.

type GraphQueryPropertiesUpdateParameters added in v0.10.0

type GraphQueryPropertiesUpdateParameters struct {
	// The description of a graph query.
	Description *string

	// KQL query that will be graph.
	Query *string
}

GraphQueryPropertiesUpdateParameters - Properties that contain a workbook for PATCH operation.

func (GraphQueryPropertiesUpdateParameters) MarshalJSON added in v0.10.0

func (g GraphQueryPropertiesUpdateParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GraphQueryPropertiesUpdateParameters.

func (*GraphQueryPropertiesUpdateParameters) UnmarshalJSON added in v0.10.0

func (g *GraphQueryPropertiesUpdateParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GraphQueryPropertiesUpdateParameters.

type GraphQueryResource added in v0.10.0

type GraphQueryResource struct {
	// This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without
	// checking conflict.
	Etag *string

	// The location of the resource
	Location *string

	// Metadata describing a graph query for an Azure resource.
	Properties *GraphQueryProperties

	// Resource tags.
	Tags map[string]*string

	// 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; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

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

GraphQueryResource - Graph Query entity definition.

func (GraphQueryResource) MarshalJSON added in v0.10.0

func (g GraphQueryResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GraphQueryResource.

func (*GraphQueryResource) UnmarshalJSON added in v0.10.0

func (g *GraphQueryResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GraphQueryResource.

type GraphQueryUpdateParameters added in v0.10.0

type GraphQueryUpdateParameters struct {
	// This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing resource without
	// checking conflict.
	Etag *string

	// Metadata describing a graph query for an Azure resource.
	Properties *GraphQueryPropertiesUpdateParameters

	// Resource tags
	Tags map[string]*string
}

GraphQueryUpdateParameters - The parameters that can be provided when updating workbook properties properties.

func (GraphQueryUpdateParameters) MarshalJSON added in v0.10.0

func (g GraphQueryUpdateParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GraphQueryUpdateParameters.

func (*GraphQueryUpdateParameters) UnmarshalJSON added in v0.10.0

func (g *GraphQueryUpdateParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GraphQueryUpdateParameters.

type Operation

type Operation struct {
	// Display metadata associated with the operation.
	Display *OperationDisplay

	// Operation name: {provider}/{resource}/{operation}
	Name *string

	// The origin of operations.
	Origin *string
}

Operation - Resource Graph REST API operation definition.

func (Operation) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// Description for the operation.
	Description *string

	// Type of operation: get, read, delete, etc.
	Operation *string

	// Service provider: Microsoft Resource Graph.
	Provider *string

	// Resource on which the operation is performed etc.
	Resource *string
}

OperationDisplay - Display metadata associated with the operation.

func (OperationDisplay) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// REQUIRED; The Operation items on this page
	Value []*Operation

	// The link to the next page of items
	NextLink *string
}

OperationListResult - Paged collection of Operation items

func (OperationListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

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.

Generated from API version 2024-04-01

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 - Contains optional client configuration. Pass nil to accept the default values.

func (*OperationsClient) NewListPager added in v0.5.0

NewListPager - List the operations for the provider

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

Generated from example definition: 2024-04-01/OperationsList.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armresourcegraph.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(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 = armresourcegraph.OperationsClientListResponse{
		// 	OperationListResult: armresourcegraph.OperationListResult{
		// 		Value: []*armresourcegraph.Operation{
		// 			{
		// 				Name: to.Ptr("Microsoft.ResourceGraph/operations/read"),
		// 				Display: &armresourcegraph.OperationDisplay{
		// 					Description: to.Ptr("Gets the list of supported operations"),
		// 					Operation: to.Ptr("Get Operations"),
		// 					Provider: to.Ptr("Microsoft Resource Graph"),
		// 					Resource: to.Ptr("Operation"),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("Microsoft.ResourceGraph/resources/read"),
		// 				Display: &armresourcegraph.OperationDisplay{
		// 					Description: to.Ptr("Submits a query on resources within specified subscriptions, the specified management groups, or against all access granted in the tenant."),
		// 					Operation: to.Ptr("Query resources"),
		// 					Provider: to.Ptr("Microsoft Resource Graph"),
		// 					Resource: to.Ptr("Resources"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	// Paged collection of Operation items
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type PropertyChangeType added in v0.10.0

type PropertyChangeType string

PropertyChangeType - The property change Type

const (
	// PropertyChangeTypeInsert - Insert
	PropertyChangeTypeInsert PropertyChangeType = "Insert"
	// PropertyChangeTypeRemove - Remove
	PropertyChangeTypeRemove PropertyChangeType = "Remove"
	// PropertyChangeTypeUpdate - Update
	PropertyChangeTypeUpdate PropertyChangeType = "Update"
)

func PossiblePropertyChangeTypeValues added in v0.10.0

func PossiblePropertyChangeTypeValues() []PropertyChangeType

PossiblePropertyChangeTypeValues returns the possible values for the PropertyChangeType const type.

type QueryRequest

type QueryRequest struct {
	// REQUIRED; The resources query.
	Query *string

	// An array of facet requests to be computed against the query result.
	Facets []*FacetRequest

	// Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ]
	ManagementGroups []*string

	// The query evaluation options
	Options *QueryRequestOptions

	// Azure subscriptions against which to execute the query.
	Subscriptions []*string
}

QueryRequest - Describes a query to be executed.

func (QueryRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type QueryRequest.

func (*QueryRequest) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type QueryRequest.

type QueryRequestOptions

type QueryRequestOptions struct {
	// Only applicable for tenant and management group level queries to decide whether to allow partial scopes for result in case
	// the number of subscriptions exceed allowed limits.
	AllowPartialScopes *bool

	// Defines what level of authorization resources should be returned based on the which subscriptions and management groups
	// are passed as scopes.
	AuthorizationScopeFilter *AuthorizationScopeFilter

	// Defines in which format query result returned.
	ResultFormat *ResultFormat

	// The number of rows to skip from the beginning of the results. Overrides the next page offset when “`$skipToken“` property
	// is present.
	Skip *int32

	// Continuation token for pagination, capturing the next page size and offset, as well as the context of the query.
	SkipToken *string

	// The maximum number of rows that the query should return. Overrides the page size when “`$skipToken“` property is present.
	Top *int32
}

QueryRequestOptions - The options for query evaluation

func (QueryRequestOptions) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type QueryRequestOptions.

func (*QueryRequestOptions) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type QueryRequestOptions.

type QueryResponse

type QueryResponse struct {
	// REQUIRED; Number of records returned in the current response. In the case of paging, this is the number of records in the
	// current page.
	Count *int64

	// REQUIRED; Query output in JObject array or Table format.
	Data any

	// REQUIRED; Indicates whether the query results are truncated.
	ResultTruncated *ResultTruncated

	// REQUIRED; Number of total records matching the query.
	TotalRecords *int64

	// Query facets.
	Facets []FacetClassification

	// When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current
	// request) to retrieve the next page of data.
	SkipToken *string
}

QueryResponse - Query result.

func (QueryResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type QueryResponse.

func (*QueryResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type QueryResponse.

type ResourceChangeData added in v0.10.0

type ResourceChangeData struct {
	// REQUIRED; The snapshot after the change.
	AfterSnapshot *ResourceChangeDataAfterSnapshot

	// REQUIRED; The snapshot before the change.
	BeforeSnapshot *ResourceChangeDataBeforeSnapshot

	// REQUIRED; The change ID. Valid and unique within the specified resource only.
	ChangeID *string

	// The change type for snapshot. PropertyChanges will be provided in case of Update change type
	ChangeType *ChangeType

	// An array of resource property change
	PropertyChanges []*ResourcePropertyChange

	// The resource for a change.
	ResourceID *string
}

ResourceChangeData - Data on a specific change, represented by a pair of before and after resource snapshots.

func (ResourceChangeData) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangeData.

func (*ResourceChangeData) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangeData.

type ResourceChangeDataAfterSnapshot added in v0.10.0

type ResourceChangeDataAfterSnapshot struct {
	// REQUIRED; The time when the snapshot was created.
	// The snapshot timestamp provides an approximation as to when a modification to a resource was detected. There can be a difference
	// between the actual modification time and the detection time. This is due to differences in how operations that modify a
	// resource are processed, versus how operation that record resource snapshots are processed.
	Timestamp *time.Time

	// The resource snapshot content (in resourceChangeDetails response only).
	Content any

	// The ID of the snapshot.
	SnapshotID *string
}

ResourceChangeDataAfterSnapshot - The snapshot after the change.

func (ResourceChangeDataAfterSnapshot) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangeDataAfterSnapshot.

func (*ResourceChangeDataAfterSnapshot) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangeDataAfterSnapshot.

type ResourceChangeDataBeforeSnapshot added in v0.10.0

type ResourceChangeDataBeforeSnapshot struct {
	// REQUIRED; The time when the snapshot was created.
	// The snapshot timestamp provides an approximation as to when a modification to a resource was detected. There can be a difference
	// between the actual modification time and the detection time. This is due to differences in how operations that modify a
	// resource are processed, versus how operation that record resource snapshots are processed.
	Timestamp *time.Time

	// The resource snapshot content (in resourceChangeDetails response only).
	Content any

	// The ID of the snapshot.
	SnapshotID *string
}

ResourceChangeDataBeforeSnapshot - The snapshot before the change.

func (ResourceChangeDataBeforeSnapshot) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangeDataBeforeSnapshot.

func (*ResourceChangeDataBeforeSnapshot) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangeDataBeforeSnapshot.

type ResourceChangeDetailsRequestParameters added in v0.10.0

type ResourceChangeDetailsRequestParameters struct {
	// REQUIRED; Specifies the list of change IDs for a change details request.
	ChangeIDs []*string

	// REQUIRED; Specifies the list of resources for a change details request.
	ResourceIDs []*string
}

ResourceChangeDetailsRequestParameters - The parameters for a specific change details request.

func (ResourceChangeDetailsRequestParameters) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangeDetailsRequestParameters.

func (*ResourceChangeDetailsRequestParameters) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangeDetailsRequestParameters.

type ResourceChangeList added in v0.10.0

type ResourceChangeList struct {
	// The pageable value returned by the operation, i.e. a list of changes to the resource.
	// - The list is ordered from the most recent changes to the least recent changes.
	// - This list will be empty if there were no changes during the requested interval.
	// - The `Before` snapshot timestamp value of the oldest change can be outside of the specified time interval.
	Changes []*ResourceChangeData

	// Skip token that encodes the skip information while executing the current request
	SkipToken any
}

ResourceChangeList - A list of changes associated with a resource over a specific time interval.

func (ResourceChangeList) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangeList.

func (*ResourceChangeList) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangeList.

type ResourceChangesRequestParameters added in v0.10.0

type ResourceChangesRequestParameters struct {
	// REQUIRED; Specifies the date and time interval for a changes request.
	Interval *ResourceChangesRequestParametersInterval

	// The flag if set to true will fetch property changes
	FetchPropertyChanges *bool

	// The flag if set to true will fetch change snapshots
	FetchSnapshots *bool

	// Specifies the list of resources for a changes request.
	ResourceIDs []*string

	// Acts as the continuation token for paged responses.
	SkipToken *string

	// The subscription id of resources to query the changes from.
	SubscriptionID *string

	// The table name to query resources from.
	Table *string

	// The maximum number of changes the client can accept in a paged response.
	Top *int32
}

ResourceChangesRequestParameters - The parameters for a specific changes request.

func (ResourceChangesRequestParameters) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceChangesRequestParameters.

func (*ResourceChangesRequestParameters) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangesRequestParameters.

type ResourceChangesRequestParametersInterval added in v0.10.0

type ResourceChangesRequestParametersInterval struct {
	// REQUIRED; A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an
	// `end` that occurs chronologically before `start` will result in an error.
	End *time.Time

	// REQUIRED; A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying
	// a `start` that occurs chronologically after `end` will result in an error.
	Start *time.Time
}

ResourceChangesRequestParametersInterval - Specifies the date and time interval for a changes request.

func (ResourceChangesRequestParametersInterval) MarshalJSON added in v0.10.0

MarshalJSON implements the json.Marshaller interface for type ResourceChangesRequestParametersInterval.

func (*ResourceChangesRequestParametersInterval) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceChangesRequestParametersInterval.

type ResourcePropertyChange added in v0.10.0

type ResourcePropertyChange struct {
	// REQUIRED; The change category.
	ChangeCategory *ChangeCategory

	// REQUIRED; The property change Type
	PropertyChangeType *PropertyChangeType

	// REQUIRED; The property name
	PropertyName *string

	// The property value in after snapshot
	AfterValue *string

	// The property value in before snapshot
	BeforeValue *string
}

ResourcePropertyChange - The resource property change

func (ResourcePropertyChange) MarshalJSON added in v0.10.0

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

MarshalJSON implements the json.Marshaller interface for type ResourcePropertyChange.

func (*ResourcePropertyChange) UnmarshalJSON added in v0.10.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePropertyChange.

type ResourcesHistoryRequest

type ResourcesHistoryRequest struct {
	// Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ]
	ManagementGroups []*string

	// The history request evaluation options
	Options *ResourcesHistoryRequestOptions

	// The resources query.
	Query *string

	// Azure subscriptions against which to execute the query.
	Subscriptions []*string
}

ResourcesHistoryRequest - Describes a history request to be executed.

func (ResourcesHistoryRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourcesHistoryRequest.

func (*ResourcesHistoryRequest) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourcesHistoryRequest.

type ResourcesHistoryRequestOptions

type ResourcesHistoryRequestOptions struct {
	// The time interval used to fetch history.
	Interval *DateTimeInterval

	// Defines in which format query result returned.
	ResultFormat *ResultFormat

	// The number of rows to skip from the beginning of the results. Overrides the next page offset when “`$skipToken“` property
	// is present.
	Skip *int32

	// Continuation token for pagination, capturing the next page size and offset, as well as the context of the query.
	SkipToken *string

	// The maximum number of rows that the query should return. Overrides the page size when “`$skipToken“` property is present.
	Top *int32
}

ResourcesHistoryRequestOptions - The options for history request evaluation

func (ResourcesHistoryRequestOptions) MarshalJSON added in v0.7.0

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

MarshalJSON implements the json.Marshaller interface for type ResourcesHistoryRequestOptions.

func (*ResourcesHistoryRequestOptions) UnmarshalJSON added in v0.7.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourcesHistoryRequestOptions.

type ResultFormat

type ResultFormat string

ResultFormat - Defines in which format query result returned.

const (
	// ResultFormatObjectArray - objectArray
	ResultFormatObjectArray ResultFormat = "objectArray"
	// ResultFormatTable - table
	ResultFormatTable ResultFormat = "table"
)

func PossibleResultFormatValues

func PossibleResultFormatValues() []ResultFormat

PossibleResultFormatValues returns the possible values for the ResultFormat const type.

type ResultKind added in v0.10.0

type ResultKind string

ResultKind - Enum indicating a type of graph query.

const (
	// ResultKindBasic - basic
	ResultKindBasic ResultKind = "basic"
)

func PossibleResultKindValues added in v0.10.0

func PossibleResultKindValues() []ResultKind

PossibleResultKindValues returns the possible values for the ResultKind const type.

type ResultTruncated

type ResultTruncated string

ResultTruncated - Indicates whether the query results are truncated.

const (
	// ResultTruncatedFalse - false
	ResultTruncatedFalse ResultTruncated = "false"
	// ResultTruncatedTrue - true
	ResultTruncatedTrue ResultTruncated = "true"
)

func PossibleResultTruncatedValues

func PossibleResultTruncatedValues() []ResultTruncated

PossibleResultTruncatedValues returns the possible values for the ResultTruncated const type.

type SystemData added in v0.10.0

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time

	// The identity that created the resource.
	CreatedBy *string

	// The type of identity that created the resource.
	CreatedByType *CreatedByType

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time

	// The identity that last modified the resource.
	LastModifiedBy *string

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON added in v0.10.0

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON added in v0.10.0

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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