Documentation ¶
Index ¶
- type AuthorizationScopeFilter
- type Client
- type ClientFactory
- type ClientResourcesHistoryOptions
- type ClientResourcesHistoryResponse
- type ClientResourcesOptions
- type ClientResourcesResponse
- type Column
- type ColumnDataType
- type DateTimeInterval
- type Error
- type ErrorDetails
- type ErrorResponse
- type Facet
- type FacetClassification
- type FacetError
- type FacetRequest
- type FacetRequestOptions
- type FacetResult
- type FacetSortOrder
- type Operation
- type OperationDisplay
- type OperationListResult
- type OperationsClient
- type OperationsClientListOptions
- type OperationsClientListResponse
- type QueryRequest
- type QueryRequestOptions
- type QueryResponse
- type ResourcesHistoryRequest
- type ResourcesHistoryRequestOptions
- type ResultFormat
- type ResultTruncated
- type Table
Examples ¶
- Client.Resources (AccessAPropertiesField)
- Client.Resources (BasicManagementGroupQuery)
- Client.Resources (BasicQuery)
- Client.Resources (BasicTenantQuery)
- Client.Resources (ComplexQuery)
- Client.Resources (FilterResources)
- Client.Resources (FirstPageQuery)
- Client.Resources (NextPageQuery)
- Client.Resources (QueryWithAFacetRequest)
- Client.Resources (RandomPageQuery)
- Client.Resources (SummarizeResourcesByLocation)
- Client.ResourcesHistory (ResourceHistoryManagementGroupScopeQuery)
- Client.ResourcesHistory (ResourceHistoryQuery)
- OperationsClient.NewListPager
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 AuthorizationScopeFilter = "AtScopeAboveAndBelow" AuthorizationScopeFilterAtScopeAndAbove AuthorizationScopeFilter = "AtScopeAndAbove" AuthorizationScopeFilterAtScopeAndBelow AuthorizationScopeFilter = "AtScopeAndBelow" AuthorizationScopeFilterAtScopeExact AuthorizationScopeFilter = "AtScopeExact" )
func PossibleAuthorizationScopeFilterValues ¶
func PossibleAuthorizationScopeFilterValues() []AuthorizationScopeFilter
PossibleAuthorizationScopeFilterValues returns the possible values for the AuthorizationScopeFilter const type.
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client contains the methods for the ResourceGraphClient group. Don't use this type directly, use NewClient() instead.
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 - pass nil to accept the default values.
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.
Generated from API version 2021-06-01-preview
- query - Request specifying query and its options.
- options - ClientResourcesOptions contains the optional parameters for the Client.Resources method.
Example (AccessAPropertiesField) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.QueryResponse = armresourcegraph.QueryResponse{ // Count: to.Ptr[int64](2), // Data: []any{ // map[string]any{ // "count": float64(7), // "properties_storageProfile_osDisk_osType": "Linux", // }, // map[string]any{ // "count": float64(23), // "properties_storageProfile_osDisk_osType": "Windows", // }, // }, // Facets: []armresourcegraph.FacetClassification{ // }, // ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse), // TotalRecords: to.Ptr[int64](2), // } }
Output:
Example (BasicManagementGroupQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (BasicQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (BasicTenantQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (ComplexQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.QueryResponse = armresourcegraph.QueryResponse{ // Count: to.Ptr[int64](3), // Data: []any{ // map[string]any{ // "count_": float64(11), // "location": "centralus", // }, // map[string]any{ // "count_": float64(11), // "location": "eastus", // }, // map[string]any{ // "count_": float64(3), // "location": "southcentralus", // }, // }, // Facets: []armresourcegraph.FacetClassification{ // }, // ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse), // TotalRecords: to.Ptr[int64](3), // } }
Output:
Example (FilterResources) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (FirstPageQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (NextPageQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (QueryWithAFacetRequest) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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{ // Expression: to.Ptr("location"), // ResultType: to.Ptr("FacetResult"), // Count: to.Ptr[int32](3), // Data: []any{ // map[string]any{ // "count": float64(3), // "location": "eastus", // }, // map[string]any{ // "count": float64(1), // "location": "southcentralus", // }, // map[string]any{ // "count": float64(1), // "location": "westcentralus", // }, // }, // TotalRecords: to.Ptr[int64](3), // }, // &armresourcegraph.FacetResult{ // Expression: to.Ptr("properties.storageProfile.osDisk.osType"), // ResultType: to.Ptr("FacetResult"), // Count: to.Ptr[int32](2), // Data: []any{ // map[string]any{ // "count": float64(2), // "properties_storageProfile_osDisk_osType": "Linux", // }, // map[string]any{ // "count": float64(3), // "properties_storageProfile_osDisk_osType": "Windows", // }, // }, // TotalRecords: to.Ptr[int64](2), // }, // &armresourcegraph.FacetError{ // Expression: to.Ptr("nonExistingColumn"), // ResultType: to.Ptr("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]."), // }}, // }, // &armresourcegraph.FacetResult{ // Expression: to.Ptr("resourceGroup"), // ResultType: to.Ptr("FacetResult"), // Count: to.Ptr[int32](3), // Data: []any{ // map[string]any{ // "count": float64(1), // "resourceGroup": "B-TEST-RG", // }, // map[string]any{ // "count": float64(1), // "resourceGroup": "c-rg", // }, // map[string]any{ // "count": float64(1), // "resourceGroup": "I-RG", // }, // }, // TotalRecords: to.Ptr[int64](5), // }, // &armresourcegraph.FacetResult{ // Expression: to.Ptr("resourceGroup"), // ResultType: to.Ptr("FacetResult"), // Count: to.Ptr[int32](2), // Data: []any{ // map[string]any{ // "count": float64(1), // "resourceGroup": "B-TEST-RG", // }, // map[string]any{ // "count": float64(1), // "resourceGroup": "x-test-rg", // }, // }, // TotalRecords: to.Ptr[int64](2), // }}, // ResultTruncated: to.Ptr(armresourcegraph.ResultTruncatedFalse), // TotalRecords: to.Ptr[int64](5), // } }
Output:
Example (RandomPageQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
Example (SummarizeResourcesByLocation) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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), // } }
Output:
func (*Client) ResourcesHistory ¶ added in v0.2.0
func (client *Client) ResourcesHistory(ctx context.Context, request ResourcesHistoryRequest, options *ClientResourcesHistoryOptions) (ClientResourcesHistoryResponse, error)
ResourcesHistory - List all snapshots of a resource for a given time interval. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-06-01-preview
- request - Request specifying the query and its options.
- options - ClientResourcesHistoryOptions contains the optional parameters for the Client.ResourcesHistory method.
Example (ResourceHistoryManagementGroupScopeQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json
package main import ( "context" "log" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.000Z"); return t }()), Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:00:00.000Z"); 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.Interface = map[string]any{ // "count": float64(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", // }, // }, // }, // }, // } }
Output:
Example (ResourceHistoryQuery) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json
package main import ( "context" "log" "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.000Z"); return t }()), Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-12T01:00:00.000Z"); 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.Interface = map[string]any{ // "count": float64(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", // }, // }, // }, // }, // } }
Output:
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) NewOperationsClient ¶ added in v0.7.0
func (c *ClientFactory) NewOperationsClient() *OperationsClient
NewOperationsClient creates a new instance of OperationsClient.
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 { // Anything 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 Column ¶
type Column struct { // REQUIRED; Column name. Name *string // REQUIRED; Column data type. Type *ColumnDataType }
Column - Query result column descriptor.
func (Column) MarshalJSON ¶ added in v0.7.0
MarshalJSON implements the json.Marshaller interface for type Column.
func (*Column) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Column.
type ColumnDataType ¶
type ColumnDataType string
ColumnDataType - Data type of a column in a table.
const ( ColumnDataTypeBoolean ColumnDataType = "boolean" ColumnDataTypeDatetime ColumnDataType = "datetime" ColumnDataTypeInteger ColumnDataType = "integer" ColumnDataTypeNumber ColumnDataType = "number" ColumnDataTypeObject ColumnDataType = "object" ColumnDataTypeString ColumnDataType = "string" )
func PossibleColumnDataTypeValues ¶
func PossibleColumnDataTypeValues() []ColumnDataType
PossibleColumnDataTypeValues returns the possible values for the ColumnDataType 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 Error ¶
type Error struct { // REQUIRED; Error code identifying the specific error. Code *string // REQUIRED; A human readable error message. Message *string // Error details Details []*ErrorDetails }
Error details.
func (Error) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Error.
func (*Error) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Error.
type ErrorDetails ¶
type ErrorDetails struct { // REQUIRED; Error code identifying the specific error. Code *string // REQUIRED; A human readable error message. Message *string // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any }
ErrorDetails - 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 ErrorResponse ¶
type ErrorResponse struct { // REQUIRED; Error information. Error *Error }
ErrorResponse - An error response from the API.
func (ErrorResponse) MarshalJSON ¶ added in v0.7.0
func (e ErrorResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ErrorResponse.
func (*ErrorResponse) UnmarshalJSON ¶ added in v0.7.0
func (e *ErrorResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.
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) MarshalJSON ¶ added in v0.7.0
MarshalJSON implements the json.Marshaller interface for type Facet.
func (*Facet) UnmarshalJSON ¶
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 FacetSortOrder = "asc" FacetSortOrderDesc FacetSortOrder = "desc" )
func PossibleFacetSortOrderValues ¶
func PossibleFacetSortOrderValues() []FacetSortOrder
PossibleFacetSortOrderValues returns the possible values for the FacetSortOrder const type.
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
MarshalJSON implements the json.Marshaller interface for type Operation.
func (*Operation) UnmarshalJSON ¶ added in v0.7.0
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 { // List of Resource Graph operations supported by the Resource Graph resource provider. Value []*Operation }
OperationListResult - Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the next set of results.
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.
func NewOperationsClient ¶
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)
NewOperationsClient creates a new instance of OperationsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*OperationsClient) NewListPager ¶ added in v0.5.0
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]
NewListPager - Lists all of the available REST API operations.
Generated from API version 2021-06-01-preview
- options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph" ) 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.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"), // }, // }}, // } } }
Output:
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 { // Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the next // set of results. OperationListResult }
OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
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 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 ResultFormat = "objectArray" ResultFormatTable ResultFormat = "table" )
func PossibleResultFormatValues ¶
func PossibleResultFormatValues() []ResultFormat
PossibleResultFormatValues returns the possible values for the ResultFormat const type.
type ResultTruncated ¶
type ResultTruncated string
ResultTruncated - Indicates whether the query results are truncated.
const ( ResultTruncatedFalse ResultTruncated = "false" ResultTruncatedTrue ResultTruncated = "true" )
func PossibleResultTruncatedValues ¶
func PossibleResultTruncatedValues() []ResultTruncated
PossibleResultTruncatedValues returns the possible values for the ResultTruncated const type.
type Table ¶
type Table struct { // REQUIRED; Query result column descriptors. Columns []*Column // REQUIRED; Query result rows. Rows [][]any }
Table - Query output in tabular format.
func (Table) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Table.
func (*Table) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Table.