api

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationAPIVersion = "2022-04-01"
View Source
const ComputeAPIVersion = "2022-08-01"
View Source
const CostManagementAPIVersion = "2023-11-01"
View Source
const DNSAPIVersion = "2018-05-01"
View Source
const InsightsAPIVersion = "2015-04-01"
View Source
const NetworkAPIVersion = "2022-07-01"
View Source
const OperationalInsightsAPIVersion = "2022-10-01"
View Source
const ResourcesAPIVersion = "2021-04-01"
View Source
const SQLAPIVersion = "2022-05-01-preview"
View Source
const StorageAPIVersion = "2022-05-01"
View Source
const SubscriptionsAPIVersion = "2021-01-01"

Variables

This section is empty.

Functions

func DecodeError

func DecodeError(statusCode int, body []byte) error

func IsAuthFailure

func IsAuthFailure(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func NewHTTPClient

func NewHTTPClient() *http.Client

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
	RequestID  string
}

func (*APIError) Error

func (e *APIError) Error() string

type ActivityLogEvent added in v0.3.1

type ActivityLogEvent struct {
	EventDataID   string `json:"eventDataId"`
	OperationName struct {
		Value          string `json:"value"`
		LocalizedValue string `json:"localizedValue"`
	} `json:"operationName"`
	EventTimestamp string `json:"eventTimestamp"`
	Caller         string `json:"caller"`
	HTTPRequest    struct {
		ClientIPAddress string `json:"clientIpAddress"`
	} `json:"httpRequest"`
	ResourceID string `json:"resourceId"`
	Status     struct {
		Value          string `json:"value"`
		LocalizedValue string `json:"localizedValue"`
	} `json:"status"`
	SubmissionTimestamp string `json:"submissionTimestamp"`
	Authorization       struct {
		Action string `json:"action"`
		Scope  string `json:"scope"`
	} `json:"authorization"`
	ResourceType struct {
		Value          string `json:"value"`
		LocalizedValue string `json:"localizedValue"`
	} `json:"resourceType"`
}

ActivityLogEvent maps a single record from the `Microsoft.Insights/eventtypes/management/values` listing. Only fields useful for the validation flow are projected.

type ActivityLogResponse added in v0.3.1

type ActivityLogResponse struct {
	Value    []ActivityLogEvent `json:"value"`
	NextLink string             `json:"nextLink"`
}

type BlobContainer

type BlobContainer struct {
	ID         string                   `json:"id"`
	Name       string                   `json:"name"`
	Properties *BlobContainerProperties `json:"properties,omitempty"`
}

type BlobContainerPatchRequest added in v0.3.1

type BlobContainerPatchRequest struct {
	Properties BlobContainerProperties `json:"properties"`
}

BlobContainerPatchRequest is the body of PATCH on the container resource. It is also valid for PUT (update). PublicAccess values: "None", "Blob", "Container".

type BlobContainerProperties added in v0.3.1

type BlobContainerProperties struct {
	PublicAccess string `json:"publicAccess,omitempty"`
}

type BlobService

type BlobService struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Client

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

func NewClient

func NewClient(ts *auth.TokenSource, endpoints cloud.Endpoints, opts ...Option) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req Request, out any) error

func (*Client) DoWithResponse added in v0.3.1

func (c *Client) DoWithResponse(ctx context.Context, req Request, out any) (ResponseMetadata, error)

type CostManagementAggregation added in v0.3.1

type CostManagementAggregation struct {
	Name     string `json:"name"`
	Function string `json:"function"`
}

type CostManagementColumn added in v0.3.1

type CostManagementColumn struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type CostManagementQueryDataset added in v0.3.1

type CostManagementQueryDataset struct {
	Granularity string                               `json:"granularity"`
	Aggregation map[string]CostManagementAggregation `json:"aggregation"`
}

type CostManagementQueryProperties added in v0.3.1

type CostManagementQueryProperties struct {
	NextLink string                 `json:"nextLink"`
	Columns  []CostManagementColumn `json:"columns"`
	Rows     [][]any                `json:"rows"`
}

type CostManagementQueryRequest added in v0.3.1

type CostManagementQueryRequest struct {
	Type       string                         `json:"type"`
	Timeframe  string                         `json:"timeframe"`
	Dataset    CostManagementQueryDataset     `json:"dataset"`
	TimePeriod *CostManagementQueryTimePeriod `json:"timePeriod,omitempty"`
}

CostManagementQueryRequest is the body of the Cost Management `query` POST. The Azure API supports a wide range of grouping/filter options; we keep the minimum that yields the current-month total for an account.

type CostManagementQueryResponse added in v0.3.1

type CostManagementQueryResponse struct {
	ID         string                        `json:"id"`
	Name       string                        `json:"name"`
	Type       string                        `json:"type"`
	Properties CostManagementQueryProperties `json:"properties"`
}

CostManagementQueryResponse mirrors the shape returned by `Microsoft.CostManagement /query`. Rows are interleaved Cost+Currency values with column descriptors.

type CostManagementQueryTimePeriod added in v0.3.1

type CostManagementQueryTimePeriod struct {
	From string `json:"from"`
	To   string `json:"to"`
}

type CreateRoleAssignmentRequest added in v0.3.1

type CreateRoleAssignmentRequest struct {
	Properties RoleAssignmentProperties `json:"properties"`
}

CreateRoleAssignmentRequest is the body of PUT /{scope}/providers/Microsoft.Authorization/roleAssignments/{name}.

type DNSAAAARecord added in v0.3.1

type DNSAAAARecord struct {
	IPv6Address string `json:"ipv6Address"`
}

type DNSARecord added in v0.3.1

type DNSARecord struct {
	IPv4Address string `json:"ipv4Address"`
}

type DNSCNAMERecord added in v0.3.1

type DNSCNAMERecord struct {
	CNAME string `json:"cname"`
}

type DNSMXRecord added in v0.3.1

type DNSMXRecord struct {
	Preference int64  `json:"preference"`
	Exchange   string `json:"exchange"`
}

type DNSNSRecord added in v0.3.1

type DNSNSRecord struct {
	NSDName string `json:"nsdname"`
}

type DNSRecordSet added in v0.3.1

type DNSRecordSet struct {
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	Type       string            `json:"type"`
	Etag       string            `json:"etag"`
	Properties DNSRecordSetProps `json:"properties"`
}

DNSRecordSet covers the union of record-set property shapes Azure returns in the `recordSets` list for a DNS zone. Only one of the typed slices is populated per record set, keyed by the trailing segment of `Type` (e.g. `Microsoft.Network/dnszones/A` → ARecords).

type DNSRecordSetProps added in v0.3.1

type DNSRecordSetProps struct {
	TTL         int64           `json:"TTL"`
	FQDN        string          `json:"fqdn"`
	ARecords    []DNSARecord    `json:"ARecords,omitempty"`
	AAAARecords []DNSAAAARecord `json:"AAAARecords,omitempty"`
	CNAMERecord *DNSCNAMERecord `json:"CNAMERecord,omitempty"`
	MXRecords   []DNSMXRecord   `json:"MXRecords,omitempty"`
	TXTRecords  []DNSTXTRecord  `json:"TXTRecords,omitempty"`
	NSRecords   []DNSNSRecord   `json:"NSRecords,omitempty"`
	SOARecord   *DNSSOARecord   `json:"SOARecord,omitempty"`
}

type DNSSOARecord added in v0.3.1

type DNSSOARecord struct {
	Email string `json:"email"`
	Host  string `json:"host"`
}

type DNSTXTRecord added in v0.3.1

type DNSTXTRecord struct {
	Value []string `json:"value"`
}

type DNSZone added in v0.3.1

type DNSZone struct {
	ID         string       `json:"id"`
	Name       string       `json:"name"`
	Type       string       `json:"type"`
	Location   string       `json:"location"`
	Properties DNSZoneProps `json:"properties"`
}

DNSZone is the management-plane representation of a public Azure DNS zone (`Microsoft.Network/dnsZones`). Private DNS lives under `Microsoft.Network/privateDnsZones` with a separate API version; the demo surface only models public zones for now (CSPM signal value is highest on internet-facing zones).

type DNSZoneProps added in v0.3.1

type DNSZoneProps struct {
	NumberOfRecordSets    int64    `json:"numberOfRecordSets"`
	MaxNumberOfRecordSets int64    `json:"maxNumberOfRecordSets"`
	NameServers           []string `json:"nameServers"`
	ZoneType              string   `json:"zoneType"`
}

type IPConfiguration

type IPConfiguration struct {
	Name       string               `json:"name"`
	Properties IPConfigurationProps `json:"properties"`
}

type IPConfigurationProps

type IPConfigurationProps struct {
	PrivateIPAddress string       `json:"privateIPAddress"`
	PublicIPAddress  *ResourceRef `json:"publicIPAddress,omitempty"`
}

type ListBlobContainersResponse

type ListBlobContainersResponse struct {
	Value    []BlobContainer `json:"value"`
	NextLink string          `json:"nextLink"`
}

type ListBlobServicesResponse

type ListBlobServicesResponse struct {
	Value []BlobService `json:"value"`
}

type ListResourceGroupsResponse

type ListResourceGroupsResponse struct {
	Value    []ResourceGroup `json:"value"`
	NextLink string          `json:"nextLink"`
}

type ListRoleAssignmentsResponse added in v0.3.1

type ListRoleAssignmentsResponse struct {
	Value    []RoleAssignment `json:"value"`
	NextLink string           `json:"nextLink"`
}

type ListRoleDefinitionsResponse added in v0.3.1

type ListRoleDefinitionsResponse struct {
	Value    []RoleDefinition `json:"value"`
	NextLink string           `json:"nextLink"`
}

type ListStorageAccountsResponse

type ListStorageAccountsResponse struct {
	Value    []StorageAccount `json:"value"`
	NextLink string           `json:"nextLink"`
}

type ListSubscriptionsResponse

type ListSubscriptionsResponse struct {
	Value    []Subscription `json:"value"`
	NextLink string         `json:"nextLink"`
}

type ListVirtualMachinesResponse

type ListVirtualMachinesResponse struct {
	Value    []VirtualMachine `json:"value"`
	NextLink string           `json:"nextLink"`
}

type NetworkInterface

type NetworkInterface struct {
	ID         string                `json:"id"`
	Name       string                `json:"name"`
	Properties NetworkInterfaceProps `json:"properties"`
}

type NetworkInterfaceProps

type NetworkInterfaceProps struct {
	IPConfigurations []IPConfiguration `json:"ipConfigurations"`
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(raw string) Option

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

func WithRetryPolicy

func WithRetryPolicy(p RetryPolicy) Option

type Pager

type Pager[T any] struct {
	// contains filtered or unexported fields
}

Pager walks Azure ARM list responses that use nextLink.

func NewPager

func NewPager[T any](c *Client, initial Request) *Pager[T]

func (*Pager[T]) All

func (p *Pager[T]) All(ctx context.Context) ([]T, error)

type PublicIPAddress

type PublicIPAddress struct {
	ID         string               `json:"id"`
	Name       string               `json:"name"`
	Properties PublicIPAddressProps `json:"properties"`
}

type PublicIPAddressProps

type PublicIPAddressProps struct {
	IPAddress string `json:"ipAddress"`
}

type Request

type Request struct {
	Method     string
	Path       string
	Query      url.Values
	Headers    http.Header
	Body       []byte
	Idempotent bool
}

type ResourceGroup

type ResourceGroup struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Location string `json:"location"`
}

type ResourceID

type ResourceID struct {
	SubscriptionID string
	ResourceGroup  string
	Provider       string
	ResourceType   string
	ResourceName   string
}

func ParseResourceID

func ParseResourceID(id string) (ResourceID, error)

type ResourceRef

type ResourceRef struct {
	ID string `json:"id"`
}

type ResponseMetadata added in v0.3.1

type ResponseMetadata struct {
	StatusCode int
	Header     http.Header
	RequestID  string
}

type RetryPolicy

type RetryPolicy = httpclient.RetryPolicy

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

type RoleAssignment added in v0.3.1

type RoleAssignment struct {
	ID         string                   `json:"id"`
	Name       string                   `json:"name"`
	Type       string                   `json:"type"`
	Properties RoleAssignmentProperties `json:"properties"`
}

RoleAssignment represents a Microsoft.Authorization/roleAssignments resource in Azure Resource Manager.

type RoleAssignmentProperties added in v0.3.1

type RoleAssignmentProperties struct {
	RoleDefinitionID string `json:"roleDefinitionId"`
	PrincipalID      string `json:"principalId"`
	PrincipalType    string `json:"principalType,omitempty"`
	Scope            string `json:"scope,omitempty"`
}

type RoleDefinition added in v0.3.1

type RoleDefinition struct {
	ID         string                   `json:"id"`
	Name       string                   `json:"name"`
	Type       string                   `json:"type"`
	Properties RoleDefinitionProperties `json:"properties"`
}

RoleDefinition represents a Microsoft.Authorization/roleDefinitions resource.

type RoleDefinitionProperties added in v0.3.1

type RoleDefinitionProperties struct {
	RoleName    string `json:"roleName"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
}

type RunCommandInput added in v0.3.1

type RunCommandInput struct {
	CommandID string   `json:"commandId"`
	Script    []string `json:"script"`
}

RunCommandInput models the request body for `virtualMachines/runCommand`. `commandId` selects a built-in script: `RunShellScript` (Linux) or `RunPowerShellScript` (Windows). `script` holds the command lines.

type RunCommandInstanceView added in v0.3.1

type RunCommandInstanceView struct {
	Code          string `json:"code"`
	Level         string `json:"level"`
	DisplayStatus string `json:"displayStatus"`
	Message       string `json:"message"`
}

type RunCommandResult added in v0.3.1

type RunCommandResult struct {
	Value []RunCommandInstanceView `json:"value"`
}

RunCommandResult is the synchronous response payload. ARM may return 202 with a Location header for long-running ops; the simple cases return the inline result.

type SQLServer added in v0.3.1

type SQLServer struct {
	ID         string              `json:"id"`
	Name       string              `json:"name"`
	Location   string              `json:"location"`
	Properties SQLServerProperties `json:"properties"`
}

type SQLServerPatch added in v0.3.1

type SQLServerPatch struct {
	Properties SQLServerProperties `json:"properties"`
}

type SQLServerProperties added in v0.3.1

type SQLServerProperties struct {
	AdministratorLogin         string `json:"administratorLogin,omitempty"`
	AdministratorLoginPassword string `json:"administratorLoginPassword,omitempty"`
	Version                    string `json:"version,omitempty"`
	State                      string `json:"state,omitempty"`
	FullyQualifiedDomainName   string `json:"fullyQualifiedDomainName,omitempty"`
}

type StorageAccount

type StorageAccount struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Location string `json:"location"`
}

type Subscription

type Subscription struct {
	SubscriptionID string `json:"subscriptionId"`
	DisplayName    string `json:"displayName"`
	State          string `json:"state"`
}

type VMNetworkInterfaceRef

type VMNetworkInterfaceRef struct {
	ID string `json:"id"`
}

type VMNetworkProfile

type VMNetworkProfile struct {
	NetworkInterfaces []VMNetworkInterfaceRef `json:"networkInterfaces"`
}

type VirtualMachine

type VirtualMachine struct {
	ID         string              `json:"id"`
	Name       string              `json:"name"`
	Location   string              `json:"location"`
	Status     string              `json:"status"`
	Properties VirtualMachineProps `json:"properties"`
}

type VirtualMachineProps

type VirtualMachineProps struct {
	ProvisioningState string            `json:"provisioningState"`
	NetworkProfile    *VMNetworkProfile `json:"networkProfile,omitempty"`
}

type Workspace added in v0.3.1

type Workspace struct {
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Type       string         `json:"type"`
	Location   string         `json:"location"`
	Properties WorkspaceProps `json:"properties"`
}

Workspace is the management-plane representation of a Log Analytics workspace (`Microsoft.OperationalInsights/workspaces`). It is the closest equivalent to the cloudlist `log` asset on Azure: a workspace is the container that aggregates logs from connected resources.

type WorkspaceProps added in v0.3.1

type WorkspaceProps struct {
	CustomerID        string `json:"customerId"`
	ProvisioningState string `json:"provisioningState"`
	CreatedDate       string `json:"createdDate"`
	ModifiedDate      string `json:"modifiedDate"`
	RetentionInDays   int64  `json:"retentionInDays"`
	Sku               *struct {
		Name string `json:"name"`
	} `json:"sku,omitempty"`
}

Jump to

Keyboard shortcuts

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