rg

package module
v0.0.0-...-0f4ba08 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package rg provides a simple interface to run Azure Resource Graph queries and unmarshall results into custom types. It is based on the modified official Azure SDK for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec[T any](ctx context.Context, query string, options *ExecOptions) ([]T, error)

Exec executes Azure Resource Graph query and returns rows from the result unmarshalled as an array of T.

This function uses shared cached Azure Token Credential obtained by calling official Azure SDK for Go function azidentity.NewDefaultAzureCredential.

Example:

	type record struct {
		Name string
		Type string
	}

	items, err := rg.Exec(context.Background, "resources | project name, type | order by name, type", nil)
	if err != nil {
		panic(err)
	}

	for _, item := range items {
		fmt.printf("%s, %s\n", item.Name, item.Type)
 }

Types

type ExecOptions

type ExecOptions struct {
}

ExecOptions is reserved for future expandability, e.g. providing subscription list.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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