Documentation
¶
Overview ¶
These APIs allow you to manage Billable Usage, Budget Policy, Budgets, Log Delivery, Usage Dashboards, etc.
Index ¶
- type ActionConfiguration
- type ActionConfigurationType
- type AlertConfiguration
- type AlertConfigurationQuantityType
- type AlertConfigurationTimePeriod
- type AlertConfigurationTriggerType
- type BillableUsageAPI
- type BillableUsageInterface
- type BillableUsageService
- type BudgetConfiguration
- type BudgetConfigurationFilter
- type BudgetConfigurationFilterClause
- type BudgetConfigurationFilterOperator
- type BudgetConfigurationFilterTagClause
- type BudgetConfigurationFilterWorkspaceIdClause
- type BudgetPolicy
- type BudgetPolicyAPI
- func (a *BudgetPolicyAPI) Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error)
- func (a *BudgetPolicyAPI) Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error
- func (a *BudgetPolicyAPI) DeleteByPolicyId(ctx context.Context, policyId string) error
- func (a *BudgetPolicyAPI) Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error)
- func (a *BudgetPolicyAPI) GetByPolicyId(ctx context.Context, policyId string) (*BudgetPolicy, error)
- func (a *BudgetPolicyAPI) List(ctx context.Context, request ListBudgetPoliciesRequest) listing.Iterator[BudgetPolicy]
- func (a *BudgetPolicyAPI) ListAll(ctx context.Context, request ListBudgetPoliciesRequest) ([]BudgetPolicy, error)
- func (a *BudgetPolicyAPI) Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error)
- type BudgetPolicyInterface
- type BudgetPolicyService
- type BudgetsAPI
- func (a *BudgetsAPI) Create(ctx context.Context, request CreateBudgetConfigurationRequest) (*CreateBudgetConfigurationResponse, error)
- func (a *BudgetsAPI) Delete(ctx context.Context, request DeleteBudgetConfigurationRequest) error
- func (a *BudgetsAPI) DeleteByBudgetId(ctx context.Context, budgetId string) error
- func (a *BudgetsAPI) Get(ctx context.Context, request GetBudgetConfigurationRequest) (*GetBudgetConfigurationResponse, error)
- func (a *BudgetsAPI) GetByBudgetId(ctx context.Context, budgetId string) (*GetBudgetConfigurationResponse, error)
- func (a *BudgetsAPI) List(ctx context.Context, request ListBudgetConfigurationsRequest) listing.Iterator[BudgetConfiguration]
- func (a *BudgetsAPI) ListAll(ctx context.Context, request ListBudgetConfigurationsRequest) ([]BudgetConfiguration, error)
- func (a *BudgetsAPI) Update(ctx context.Context, request UpdateBudgetConfigurationRequest) (*UpdateBudgetConfigurationResponse, error)
- type BudgetsInterface
- type BudgetsService
- type CreateBillingUsageDashboardRequest
- type CreateBillingUsageDashboardResponse
- type CreateBudgetConfigurationBudget
- type CreateBudgetConfigurationBudgetActionConfigurations
- type CreateBudgetConfigurationBudgetAlertConfigurations
- type CreateBudgetConfigurationRequest
- type CreateBudgetConfigurationResponse
- type CreateBudgetPolicyRequest
- type CreateLogDeliveryConfigurationParams
- type DeleteBudgetConfigurationRequest
- type DeleteBudgetConfigurationResponse
- type DeleteBudgetPolicyRequest
- type DeleteResponse
- type DeliveryStatus
- type DownloadRequest
- type DownloadResponse
- type Filter
- type GetBillingUsageDashboardRequest
- type GetBillingUsageDashboardResponse
- type GetBudgetConfigurationRequest
- type GetBudgetConfigurationResponse
- type GetBudgetPolicyRequest
- type GetLogDeliveryRequest
- type LimitConfig
- type ListBudgetConfigurationsRequest
- type ListBudgetConfigurationsResponse
- type ListBudgetPoliciesRequest
- type ListBudgetPoliciesResponse
- type ListLogDeliveryRequest
- type LogDeliveryAPI
- func (a *LogDeliveryAPI) Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error)
- func (a *LogDeliveryAPI) Get(ctx context.Context, request GetLogDeliveryRequest) (*WrappedLogDeliveryConfiguration, error)
- func (a *LogDeliveryAPI) GetByConfigName(ctx context.Context, name string) (*LogDeliveryConfiguration, error)
- func (a *LogDeliveryAPI) GetByLogDeliveryConfigurationId(ctx context.Context, logDeliveryConfigurationId string) (*WrappedLogDeliveryConfiguration, error)
- func (a *LogDeliveryAPI) List(ctx context.Context, request ListLogDeliveryRequest) listing.Iterator[LogDeliveryConfiguration]
- func (a *LogDeliveryAPI) ListAll(ctx context.Context, request ListLogDeliveryRequest) ([]LogDeliveryConfiguration, error)
- func (a *LogDeliveryAPI) LogDeliveryConfigurationConfigNameToConfigIdMap(ctx context.Context, request ListLogDeliveryRequest) (map[string]string, error)
- func (a *LogDeliveryAPI) PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error
- type LogDeliveryConfigStatus
- type LogDeliveryConfiguration
- type LogDeliveryInterface
- type LogDeliveryService
- type LogDeliveryStatus
- type LogType
- type OutputFormat
- type PatchStatusResponse
- type SortSpec
- type SortSpecField
- type UpdateBudgetConfigurationBudget
- type UpdateBudgetConfigurationRequest
- type UpdateBudgetConfigurationResponse
- type UpdateBudgetPolicyRequest
- type UpdateLogDeliveryConfigurationStatusRequest
- type UsageDashboardType
- type UsageDashboardsAPI
- type UsageDashboardsInterface
- type UsageDashboardsService
- type WrappedCreateLogDeliveryConfiguration
- type WrappedLogDeliveryConfiguration
- type WrappedLogDeliveryConfigurations
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionConfiguration ¶ added in v0.44.0
type ActionConfiguration struct { // Databricks action configuration ID. ActionConfigurationId string `json:"action_configuration_id,omitempty"` // The type of the action. ActionType ActionConfigurationType `json:"action_type,omitempty"` // Target for the action. For example, an email address. Target string `json:"target,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (ActionConfiguration) MarshalJSON ¶ added in v0.44.0
func (s ActionConfiguration) MarshalJSON() ([]byte, error)
func (*ActionConfiguration) UnmarshalJSON ¶ added in v0.44.0
func (s *ActionConfiguration) UnmarshalJSON(b []byte) error
type ActionConfigurationType ¶ added in v0.44.0
type ActionConfigurationType string
const ActionConfigurationTypeEmailNotification ActionConfigurationType = `EMAIL_NOTIFICATION`
func (*ActionConfigurationType) Set ¶ added in v0.44.0
func (f *ActionConfigurationType) Set(v string) error
Set raw string value and validate it against allowed values
func (*ActionConfigurationType) String ¶ added in v0.44.0
func (f *ActionConfigurationType) String() string
String representation for fmt.Print
func (*ActionConfigurationType) Type ¶ added in v0.44.0
func (f *ActionConfigurationType) Type() string
Type always returns ActionConfigurationType to satisfy [pflag.Value] interface
type AlertConfiguration ¶ added in v0.44.0
type AlertConfiguration struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. ActionConfigurations []ActionConfiguration `json:"action_configurations,omitempty"` // Databricks alert configuration ID. AlertConfigurationId string `json:"alert_configuration_id,omitempty"` // The threshold for the budget alert to determine if it is in a triggered // state. The number is evaluated based on `quantity_type`. QuantityThreshold string `json:"quantity_threshold,omitempty"` // The way to calculate cost for this budget alert. This is what // `quantity_threshold` is measured in. QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` // The time window of usage data for the budget. TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` // The evaluation method to determine when this budget alert is in a // triggered state. TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (AlertConfiguration) MarshalJSON ¶ added in v0.44.0
func (s AlertConfiguration) MarshalJSON() ([]byte, error)
func (*AlertConfiguration) UnmarshalJSON ¶ added in v0.44.0
func (s *AlertConfiguration) UnmarshalJSON(b []byte) error
type AlertConfigurationQuantityType ¶ added in v0.44.0
type AlertConfigurationQuantityType string
const AlertConfigurationQuantityTypeListPriceDollarsUsd AlertConfigurationQuantityType = `LIST_PRICE_DOLLARS_USD`
func (*AlertConfigurationQuantityType) Set ¶ added in v0.44.0
func (f *AlertConfigurationQuantityType) Set(v string) error
Set raw string value and validate it against allowed values
func (*AlertConfigurationQuantityType) String ¶ added in v0.44.0
func (f *AlertConfigurationQuantityType) String() string
String representation for fmt.Print
func (*AlertConfigurationQuantityType) Type ¶ added in v0.44.0
func (f *AlertConfigurationQuantityType) Type() string
Type always returns AlertConfigurationQuantityType to satisfy [pflag.Value] interface
type AlertConfigurationTimePeriod ¶ added in v0.44.0
type AlertConfigurationTimePeriod string
const AlertConfigurationTimePeriodMonth AlertConfigurationTimePeriod = `MONTH`
func (*AlertConfigurationTimePeriod) Set ¶ added in v0.44.0
func (f *AlertConfigurationTimePeriod) Set(v string) error
Set raw string value and validate it against allowed values
func (*AlertConfigurationTimePeriod) String ¶ added in v0.44.0
func (f *AlertConfigurationTimePeriod) String() string
String representation for fmt.Print
func (*AlertConfigurationTimePeriod) Type ¶ added in v0.44.0
func (f *AlertConfigurationTimePeriod) Type() string
Type always returns AlertConfigurationTimePeriod to satisfy [pflag.Value] interface
type AlertConfigurationTriggerType ¶ added in v0.44.0
type AlertConfigurationTriggerType string
const AlertConfigurationTriggerTypeCumulativeSpendingExceeded AlertConfigurationTriggerType = `CUMULATIVE_SPENDING_EXCEEDED`
func (*AlertConfigurationTriggerType) Set ¶ added in v0.44.0
func (f *AlertConfigurationTriggerType) Set(v string) error
Set raw string value and validate it against allowed values
func (*AlertConfigurationTriggerType) String ¶ added in v0.44.0
func (f *AlertConfigurationTriggerType) String() string
String representation for fmt.Print
func (*AlertConfigurationTriggerType) Type ¶ added in v0.44.0
func (f *AlertConfigurationTriggerType) Type() string
Type always returns AlertConfigurationTriggerType to satisfy [pflag.Value] interface
type BillableUsageAPI ¶
type BillableUsageAPI struct {
// contains filtered or unexported fields
}
This API allows you to download billable usage logs for the specified account and date range. This feature works with all account types.
func NewBillableUsage ¶
func NewBillableUsage(client *client.DatabricksClient) *BillableUsageAPI
func (*BillableUsageAPI) Download ¶
func (a *BillableUsageAPI) Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error)
Example (UsageDownload) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } resp, err := a.BillableUsage.Download(ctx, billing.DownloadRequest{ StartMonth: "2024-08", EndMonth: "2024-09", }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", resp)
Output:
type BillableUsageInterface ¶ added in v0.29.0
type BillableUsageInterface interface { // Return billable usage logs. // // Returns billable usage logs in CSV format for the specified account and date // range. For the data schema, see [CSV file schema]. Note that this method // might take multiple minutes to complete. // // **Warning**: Depending on the queried date range, the number of workspaces in // the account, the size of the response and the internet speed of the caller, // this API may hit a timeout after a few minutes. If you experience this, try // to mitigate by calling the API with narrower date ranges. // // [CSV file schema]: https://docs.databricks.com/administration-guide/account-settings/usage-analysis.html#schema Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error) }
type BillableUsageService ¶
type BillableUsageService interface { // Return billable usage logs. // // Returns billable usage logs in CSV format for the specified account and // date range. For the data schema, see [CSV file schema]. Note that this // method might take multiple minutes to complete. // // **Warning**: Depending on the queried date range, the number of // workspaces in the account, the size of the response and the internet // speed of the caller, this API may hit a timeout after a few minutes. If // you experience this, try to mitigate by calling the API with narrower // date ranges. // // [CSV file schema]: https://docs.databricks.com/administration-guide/account-settings/usage-analysis.html#schema Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error) }
This API allows you to download billable usage logs for the specified account and date range. This feature works with all account types.
type BudgetConfiguration ¶ added in v0.44.0
type BudgetConfiguration struct { // Databricks account ID. AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` // Databricks budget configuration ID. BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` // Creation time of this budget configuration. CreateTime int64 `json:"create_time,omitempty"` // Human-readable name of budget configuration. Max Length: 128 DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. Filter *BudgetConfigurationFilter `json:"filter,omitempty"` // Update time of this budget configuration. UpdateTime int64 `json:"update_time,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (BudgetConfiguration) MarshalJSON ¶ added in v0.44.0
func (s BudgetConfiguration) MarshalJSON() ([]byte, error)
func (*BudgetConfiguration) UnmarshalJSON ¶ added in v0.44.0
func (s *BudgetConfiguration) UnmarshalJSON(b []byte) error
type BudgetConfigurationFilter ¶ added in v0.44.0
type BudgetConfigurationFilter struct { // A list of tag keys and values that will limit the budget to usage that // includes those specific custom tags. Tags are case-sensitive and should // be entered exactly as they appear in your usage data. Tags []BudgetConfigurationFilterTagClause `json:"tags,omitempty"` // If provided, usage must match with the provided Databricks workspace IDs. WorkspaceId *BudgetConfigurationFilterWorkspaceIdClause `json:"workspace_id,omitempty"` }
type BudgetConfigurationFilterClause ¶ added in v0.44.0
type BudgetConfigurationFilterClause struct { Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` Values []string `json:"values,omitempty"` }
type BudgetConfigurationFilterOperator ¶ added in v0.44.0
type BudgetConfigurationFilterOperator string
const BudgetConfigurationFilterOperatorIn BudgetConfigurationFilterOperator = `IN`
func (*BudgetConfigurationFilterOperator) Set ¶ added in v0.44.0
func (f *BudgetConfigurationFilterOperator) Set(v string) error
Set raw string value and validate it against allowed values
func (*BudgetConfigurationFilterOperator) String ¶ added in v0.44.0
func (f *BudgetConfigurationFilterOperator) String() string
String representation for fmt.Print
func (*BudgetConfigurationFilterOperator) Type ¶ added in v0.44.0
func (f *BudgetConfigurationFilterOperator) Type() string
Type always returns BudgetConfigurationFilterOperator to satisfy [pflag.Value] interface
type BudgetConfigurationFilterTagClause ¶ added in v0.44.0
type BudgetConfigurationFilterTagClause struct { Key string `json:"key,omitempty"` Value *BudgetConfigurationFilterClause `json:"value,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (BudgetConfigurationFilterTagClause) MarshalJSON ¶ added in v0.44.0
func (s BudgetConfigurationFilterTagClause) MarshalJSON() ([]byte, error)
func (*BudgetConfigurationFilterTagClause) UnmarshalJSON ¶ added in v0.44.0
func (s *BudgetConfigurationFilterTagClause) UnmarshalJSON(b []byte) error
type BudgetConfigurationFilterWorkspaceIdClause ¶ added in v0.44.0
type BudgetConfigurationFilterWorkspaceIdClause struct { Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` Values []int64 `json:"values,omitempty"` }
type BudgetPolicy ¶ added in v0.57.0
type BudgetPolicy struct { // A list of tags defined by the customer. At most 20 entries are allowed // per policy. CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` // The Id of the policy. This field is generated by Databricks and globally // unique. PolicyId string `json:"policy_id"` // The name of the policy. - Must be unique among active policies. - Can // contain only characters from the ISO 8859-1 (latin1) set. PolicyName string `json:"policy_name,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Contains the BudgetPolicy details.
func (BudgetPolicy) MarshalJSON ¶ added in v0.57.0
func (s BudgetPolicy) MarshalJSON() ([]byte, error)
func (*BudgetPolicy) UnmarshalJSON ¶ added in v0.57.0
func (s *BudgetPolicy) UnmarshalJSON(b []byte) error
type BudgetPolicyAPI ¶ added in v0.57.0
type BudgetPolicyAPI struct {
// contains filtered or unexported fields
}
A service serves REST API about Budget policies
func NewBudgetPolicy ¶ added in v0.57.0
func NewBudgetPolicy(client *client.DatabricksClient) *BudgetPolicyAPI
func (*BudgetPolicyAPI) Create ¶ added in v0.57.0
func (a *BudgetPolicyAPI) Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error)
func (*BudgetPolicyAPI) Delete ¶ added in v0.57.0
func (a *BudgetPolicyAPI) Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error
func (*BudgetPolicyAPI) DeleteByPolicyId ¶ added in v0.57.0
func (a *BudgetPolicyAPI) DeleteByPolicyId(ctx context.Context, policyId string) error
Delete a budget policy.
Deletes a policy
func (*BudgetPolicyAPI) Get ¶ added in v0.57.0
func (a *BudgetPolicyAPI) Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error)
func (*BudgetPolicyAPI) GetByPolicyId ¶ added in v0.57.0
func (a *BudgetPolicyAPI) GetByPolicyId(ctx context.Context, policyId string) (*BudgetPolicy, error)
Get a budget policy.
Retrieves a policy by it's ID.
func (*BudgetPolicyAPI) List ¶ added in v0.57.0
func (a *BudgetPolicyAPI) List(ctx context.Context, request ListBudgetPoliciesRequest) listing.Iterator[BudgetPolicy]
List policies.
Lists all policies. Policies are returned in the alphabetically ascending order of their names.
func (*BudgetPolicyAPI) ListAll ¶ added in v0.57.0
func (a *BudgetPolicyAPI) ListAll(ctx context.Context, request ListBudgetPoliciesRequest) ([]BudgetPolicy, error)
List policies.
Lists all policies. Policies are returned in the alphabetically ascending order of their names.
func (*BudgetPolicyAPI) Update ¶ added in v0.57.0
func (a *BudgetPolicyAPI) Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error)
type BudgetPolicyInterface ¶ added in v0.57.0
type BudgetPolicyInterface interface { // Create a budget policy. // // Creates a new policy. Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) // Delete a budget policy. // // Deletes a policy Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error // Delete a budget policy. // // Deletes a policy DeleteByPolicyId(ctx context.Context, policyId string) error // Get a budget policy. // // Retrieves a policy by it's ID. Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) // Get a budget policy. // // Retrieves a policy by it's ID. GetByPolicyId(ctx context.Context, policyId string) (*BudgetPolicy, error) // List policies. // // Lists all policies. Policies are returned in the alphabetically ascending // order of their names. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListBudgetPoliciesRequest) listing.Iterator[BudgetPolicy] // List policies. // // Lists all policies. Policies are returned in the alphabetically ascending // order of their names. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListBudgetPoliciesRequest) ([]BudgetPolicy, error) // Update a budget policy. // // Updates a policy Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) }
type BudgetPolicyService ¶ added in v0.57.0
type BudgetPolicyService interface { // Create a budget policy. // // Creates a new policy. Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) // Delete a budget policy. // // Deletes a policy Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error // Get a budget policy. // // Retrieves a policy by it's ID. Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) // List policies. // // Lists all policies. Policies are returned in the alphabetically ascending // order of their names. // // Use ListAll() to get all BudgetPolicy instances, which will iterate over every result page. List(ctx context.Context, request ListBudgetPoliciesRequest) (*ListBudgetPoliciesResponse, error) // Update a budget policy. // // Updates a policy Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) }
A service serves REST API about Budget policies
type BudgetsAPI ¶
type BudgetsAPI struct {
// contains filtered or unexported fields
}
These APIs manage budget configurations for this account. Budgets enable you to monitor usage across your account. You can set up budgets to either track account-wide spending, or apply filters to track the spending of specific teams, projects, or workspaces.
func NewBudgets ¶
func NewBudgets(client *client.DatabricksClient) *BudgetsAPI
func (*BudgetsAPI) Create ¶
func (a *BudgetsAPI) Create(ctx context.Context, request CreateBudgetConfigurationRequest) (*CreateBudgetConfigurationResponse, error)
Example (Budgets) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } created, err := a.Budgets.Create(ctx, billing.CreateBudgetConfigurationRequest{ Budget: billing.CreateBudgetConfigurationBudget{ DisplayName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), Filter: &billing.BudgetConfigurationFilter{ Tags: []billing.BudgetConfigurationFilterTagClause{billing.BudgetConfigurationFilterTagClause{ Key: "tagName", Value: &billing.BudgetConfigurationFilterClause{ Operator: billing.BudgetConfigurationFilterOperatorIn, Values: []string{"all"}, }, }}, }, AlertConfigurations: []billing.CreateBudgetConfigurationBudgetAlertConfigurations{billing.CreateBudgetConfigurationBudgetAlertConfigurations{ TimePeriod: billing.AlertConfigurationTimePeriodMonth, QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd, TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded, QuantityThreshold: "100", ActionConfigurations: []billing.CreateBudgetConfigurationBudgetActionConfigurations{billing.CreateBudgetConfigurationBudgetActionConfigurations{ ActionType: billing.ActionConfigurationTypeEmailNotification, Target: "admin@example.com", }}, }}, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", created) // cleanup err = a.Budgets.DeleteByBudgetId(ctx, created.Budget.BudgetConfigurationId) if err != nil { panic(err) }
Output:
func (*BudgetsAPI) Delete ¶
func (a *BudgetsAPI) Delete(ctx context.Context, request DeleteBudgetConfigurationRequest) error
func (*BudgetsAPI) DeleteByBudgetId ¶
func (a *BudgetsAPI) DeleteByBudgetId(ctx context.Context, budgetId string) error
Delete budget.
Deletes a budget configuration for an account. Both account and budget configuration are specified by ID. This cannot be undone.
func (*BudgetsAPI) Get ¶
func (a *BudgetsAPI) Get(ctx context.Context, request GetBudgetConfigurationRequest) (*GetBudgetConfigurationResponse, error)
Example (Budgets) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } created, err := a.Budgets.Create(ctx, billing.CreateBudgetConfigurationRequest{ Budget: billing.CreateBudgetConfigurationBudget{ DisplayName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), Filter: &billing.BudgetConfigurationFilter{ Tags: []billing.BudgetConfigurationFilterTagClause{billing.BudgetConfigurationFilterTagClause{ Key: "tagName", Value: &billing.BudgetConfigurationFilterClause{ Operator: billing.BudgetConfigurationFilterOperatorIn, Values: []string{"all"}, }, }}, }, AlertConfigurations: []billing.CreateBudgetConfigurationBudgetAlertConfigurations{billing.CreateBudgetConfigurationBudgetAlertConfigurations{ TimePeriod: billing.AlertConfigurationTimePeriodMonth, QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd, TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded, QuantityThreshold: "100", ActionConfigurations: []billing.CreateBudgetConfigurationBudgetActionConfigurations{billing.CreateBudgetConfigurationBudgetActionConfigurations{ ActionType: billing.ActionConfigurationTypeEmailNotification, Target: "admin@example.com", }}, }}, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", created) byId, err := a.Budgets.GetByBudgetId(ctx, created.Budget.BudgetConfigurationId) if err != nil { panic(err) } logger.Infof(ctx, "found %v", byId) // cleanup err = a.Budgets.DeleteByBudgetId(ctx, created.Budget.BudgetConfigurationId) if err != nil { panic(err) }
Output:
func (*BudgetsAPI) GetByBudgetId ¶
func (a *BudgetsAPI) GetByBudgetId(ctx context.Context, budgetId string) (*GetBudgetConfigurationResponse, error)
Get budget.
Gets a budget configuration for an account. Both account and budget configuration are specified by ID.
func (*BudgetsAPI) List ¶ added in v0.24.0
func (a *BudgetsAPI) List(ctx context.Context, request ListBudgetConfigurationsRequest) listing.Iterator[BudgetConfiguration]
Get all budgets.
Gets all budgets associated with this account.
func (*BudgetsAPI) ListAll ¶
func (a *BudgetsAPI) ListAll(ctx context.Context, request ListBudgetConfigurationsRequest) ([]BudgetConfiguration, error)
Get all budgets.
Gets all budgets associated with this account.
Example (Budgets) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } all, err := a.Budgets.ListAll(ctx, billing.ListBudgetConfigurationsRequest{}) if err != nil { panic(err) } logger.Infof(ctx, "found %v", all)
Output:
func (*BudgetsAPI) Update ¶
func (a *BudgetsAPI) Update(ctx context.Context, request UpdateBudgetConfigurationRequest) (*UpdateBudgetConfigurationResponse, error)
Example (Budgets) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } created, err := a.Budgets.Create(ctx, billing.CreateBudgetConfigurationRequest{ Budget: billing.CreateBudgetConfigurationBudget{ DisplayName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), Filter: &billing.BudgetConfigurationFilter{ Tags: []billing.BudgetConfigurationFilterTagClause{billing.BudgetConfigurationFilterTagClause{ Key: "tagName", Value: &billing.BudgetConfigurationFilterClause{ Operator: billing.BudgetConfigurationFilterOperatorIn, Values: []string{"all"}, }, }}, }, AlertConfigurations: []billing.CreateBudgetConfigurationBudgetAlertConfigurations{billing.CreateBudgetConfigurationBudgetAlertConfigurations{ TimePeriod: billing.AlertConfigurationTimePeriodMonth, QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd, TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded, QuantityThreshold: "100", ActionConfigurations: []billing.CreateBudgetConfigurationBudgetActionConfigurations{billing.CreateBudgetConfigurationBudgetActionConfigurations{ ActionType: billing.ActionConfigurationTypeEmailNotification, Target: "admin@example.com", }}, }}, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", created) _, err = a.Budgets.Update(ctx, billing.UpdateBudgetConfigurationRequest{ BudgetId: created.Budget.BudgetConfigurationId, Budget: billing.UpdateBudgetConfigurationBudget{ BudgetConfigurationId: created.Budget.BudgetConfigurationId, DisplayName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), Filter: &billing.BudgetConfigurationFilter{ Tags: []billing.BudgetConfigurationFilterTagClause{billing.BudgetConfigurationFilterTagClause{ Key: "tagName", Value: &billing.BudgetConfigurationFilterClause{ Operator: billing.BudgetConfigurationFilterOperatorIn, Values: []string{"all"}, }, }}, }, AlertConfigurations: []billing.AlertConfiguration{billing.AlertConfiguration{ AlertConfigurationId: created.Budget.AlertConfigurations[0].AlertConfigurationId, TimePeriod: billing.AlertConfigurationTimePeriodMonth, QuantityType: billing.AlertConfigurationQuantityTypeListPriceDollarsUsd, TriggerType: billing.AlertConfigurationTriggerTypeCumulativeSpendingExceeded, QuantityThreshold: "50", ActionConfigurations: created.Budget.AlertConfigurations[0].ActionConfigurations, }}, }, }) if err != nil { panic(err) } // cleanup err = a.Budgets.DeleteByBudgetId(ctx, created.Budget.BudgetConfigurationId) if err != nil { panic(err) }
Output:
type BudgetsInterface ¶ added in v0.29.0
type BudgetsInterface interface { // Create new budget. // // Create a new budget configuration for an account. For full details, see // https://docs.databricks.com/en/admin/account-settings/budgets.html. Create(ctx context.Context, request CreateBudgetConfigurationRequest) (*CreateBudgetConfigurationResponse, error) // Delete budget. // // Deletes a budget configuration for an account. Both account and budget // configuration are specified by ID. This cannot be undone. Delete(ctx context.Context, request DeleteBudgetConfigurationRequest) error // Delete budget. // // Deletes a budget configuration for an account. Both account and budget // configuration are specified by ID. This cannot be undone. DeleteByBudgetId(ctx context.Context, budgetId string) error // Get budget. // // Gets a budget configuration for an account. Both account and budget // configuration are specified by ID. Get(ctx context.Context, request GetBudgetConfigurationRequest) (*GetBudgetConfigurationResponse, error) // Get budget. // // Gets a budget configuration for an account. Both account and budget // configuration are specified by ID. GetByBudgetId(ctx context.Context, budgetId string) (*GetBudgetConfigurationResponse, error) // Get all budgets. // // Gets all budgets associated with this account. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListBudgetConfigurationsRequest) listing.Iterator[BudgetConfiguration] // Get all budgets. // // Gets all budgets associated with this account. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListBudgetConfigurationsRequest) ([]BudgetConfiguration, error) // Modify budget. // // Updates a budget configuration for an account. Both account and budget // configuration are specified by ID. Update(ctx context.Context, request UpdateBudgetConfigurationRequest) (*UpdateBudgetConfigurationResponse, error) }
type BudgetsService ¶
type BudgetsService interface { // Create new budget. // // Create a new budget configuration for an account. For full details, see // https://docs.databricks.com/en/admin/account-settings/budgets.html. Create(ctx context.Context, request CreateBudgetConfigurationRequest) (*CreateBudgetConfigurationResponse, error) // Delete budget. // // Deletes a budget configuration for an account. Both account and budget // configuration are specified by ID. This cannot be undone. Delete(ctx context.Context, request DeleteBudgetConfigurationRequest) error // Get budget. // // Gets a budget configuration for an account. Both account and budget // configuration are specified by ID. Get(ctx context.Context, request GetBudgetConfigurationRequest) (*GetBudgetConfigurationResponse, error) // Get all budgets. // // Gets all budgets associated with this account. // // Use ListAll() to get all BudgetConfiguration instances, which will iterate over every result page. List(ctx context.Context, request ListBudgetConfigurationsRequest) (*ListBudgetConfigurationsResponse, error) // Modify budget. // // Updates a budget configuration for an account. Both account and budget // configuration are specified by ID. Update(ctx context.Context, request UpdateBudgetConfigurationRequest) (*UpdateBudgetConfigurationResponse, error) }
These APIs manage budget configurations for this account. Budgets enable you to monitor usage across your account. You can set up budgets to either track account-wide spending, or apply filters to track the spending of specific teams, projects, or workspaces.
type CreateBillingUsageDashboardRequest ¶ added in v0.44.0
type CreateBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all // workspaces in the account. DashboardType UsageDashboardType `json:"dashboard_type,omitempty"` // The workspace ID of the workspace in which the usage dashboard is // created. WorkspaceId int64 `json:"workspace_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateBillingUsageDashboardRequest) MarshalJSON ¶ added in v0.44.0
func (s CreateBillingUsageDashboardRequest) MarshalJSON() ([]byte, error)
func (*CreateBillingUsageDashboardRequest) UnmarshalJSON ¶ added in v0.44.0
func (s *CreateBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error
type CreateBillingUsageDashboardResponse ¶ added in v0.44.0
type CreateBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. DashboardId string `json:"dashboard_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateBillingUsageDashboardResponse) MarshalJSON ¶ added in v0.44.0
func (s CreateBillingUsageDashboardResponse) MarshalJSON() ([]byte, error)
func (*CreateBillingUsageDashboardResponse) UnmarshalJSON ¶ added in v0.44.0
func (s *CreateBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error
type CreateBudgetConfigurationBudget ¶ added in v0.44.0
type CreateBudgetConfigurationBudget struct { // Databricks account ID. AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. AlertConfigurations []CreateBudgetConfigurationBudgetAlertConfigurations `json:"alert_configurations,omitempty"` // Human-readable name of budget configuration. Max Length: 128 DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. Filter *BudgetConfigurationFilter `json:"filter,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateBudgetConfigurationBudget) MarshalJSON ¶ added in v0.44.0
func (s CreateBudgetConfigurationBudget) MarshalJSON() ([]byte, error)
func (*CreateBudgetConfigurationBudget) UnmarshalJSON ¶ added in v0.44.0
func (s *CreateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error
type CreateBudgetConfigurationBudgetActionConfigurations ¶ added in v0.44.0
type CreateBudgetConfigurationBudgetActionConfigurations struct { // The type of the action. ActionType ActionConfigurationType `json:"action_type,omitempty"` // Target for the action. For example, an email address. Target string `json:"target,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateBudgetConfigurationBudgetActionConfigurations) MarshalJSON ¶ added in v0.44.0
func (s CreateBudgetConfigurationBudgetActionConfigurations) MarshalJSON() ([]byte, error)
func (*CreateBudgetConfigurationBudgetActionConfigurations) UnmarshalJSON ¶ added in v0.44.0
func (s *CreateBudgetConfigurationBudgetActionConfigurations) UnmarshalJSON(b []byte) error
type CreateBudgetConfigurationBudgetAlertConfigurations ¶ added in v0.44.0
type CreateBudgetConfigurationBudgetAlertConfigurations struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. ActionConfigurations []CreateBudgetConfigurationBudgetActionConfigurations `json:"action_configurations,omitempty"` // The threshold for the budget alert to determine if it is in a triggered // state. The number is evaluated based on `quantity_type`. QuantityThreshold string `json:"quantity_threshold,omitempty"` // The way to calculate cost for this budget alert. This is what // `quantity_threshold` is measured in. QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` // The time window of usage data for the budget. TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` // The evaluation method to determine when this budget alert is in a // triggered state. TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateBudgetConfigurationBudgetAlertConfigurations) MarshalJSON ¶ added in v0.44.0
func (s CreateBudgetConfigurationBudgetAlertConfigurations) MarshalJSON() ([]byte, error)
func (*CreateBudgetConfigurationBudgetAlertConfigurations) UnmarshalJSON ¶ added in v0.44.0
func (s *CreateBudgetConfigurationBudgetAlertConfigurations) UnmarshalJSON(b []byte) error
type CreateBudgetConfigurationRequest ¶ added in v0.44.0
type CreateBudgetConfigurationRequest struct { // Properties of the new budget configuration. Budget CreateBudgetConfigurationBudget `json:"budget"` }
type CreateBudgetConfigurationResponse ¶ added in v0.44.0
type CreateBudgetConfigurationResponse struct { // The created budget configuration. Budget *BudgetConfiguration `json:"budget,omitempty"` }
type CreateBudgetPolicyRequest ¶ added in v0.57.0
type CreateBudgetPolicyRequest struct { // A list of tags defined by the customer. At most 40 entries are allowed // per policy. CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` // The name of the policy. - Must be unique among active policies. - Can // contain only characters of 0-9, a-z, A-Z, -, =, ., :, /, @, _, +, // whitespace. PolicyName string `json:"policy_name,omitempty"` // A unique identifier for this request. Restricted to 36 ASCII characters. // A random UUID is recommended. This request is only idempotent if a // `request_id` is provided. RequestId string `json:"request_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
A request to create a BudgetPolicy.
func (CreateBudgetPolicyRequest) MarshalJSON ¶ added in v0.57.0
func (s CreateBudgetPolicyRequest) MarshalJSON() ([]byte, error)
func (*CreateBudgetPolicyRequest) UnmarshalJSON ¶ added in v0.57.0
func (s *CreateBudgetPolicyRequest) UnmarshalJSON(b []byte) error
type CreateLogDeliveryConfigurationParams ¶
type CreateLogDeliveryConfigurationParams struct { // The optional human-readable name of the log delivery configuration. // Defaults to empty. ConfigName string `json:"config_name,omitempty"` // The ID for a method:credentials/create that represents the AWS IAM role // with policy and trust relationship as described in the main billable // usage documentation page. See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html CredentialsId string `json:"credentials_id"` // The optional delivery path prefix within Amazon S3 storage. Defaults to // empty, which means that logs are delivered to the root of the bucket. // This must be a valid S3 object key. This must not start or end with a // slash character. DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` // This field applies only if `log_type` is `BILLABLE_USAGE`. This is the // optional start month and year for delivery, specified in `YYYY-MM` // format. Defaults to current year and month. `BILLABLE_USAGE` logs are not // available for usage before March 2019 (`2019-03`). DeliveryStartTime string `json:"delivery_start_time,omitempty"` // Log delivery type. Supported values are: // // * `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the // CSV schema, see the [View billable usage]. // // * `AUDIT_LOGS` — Configure [audit log delivery]. For the JSON schema, // see [Configure audit logging] // // [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html // [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html LogType LogType `json:"log_type"` // The file type of log delivery. // // * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the // CSV (comma-separated values) format is supported. For the schema, see the // [View billable usage] * If `log_type` is `AUDIT_LOGS`, this value must be // `JSON`. Only the JSON (JavaScript Object Notation) format is supported. // For the schema, see the [Configuring audit logs]. // // [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html OutputFormat OutputFormat `json:"output_format"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. Status LogDeliveryConfigStatus `json:"status,omitempty"` // The ID for a method:storage/create that represents the S3 bucket with // bucket policy as described in the main billable usage documentation page. // See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html StorageConfigurationId string `json:"storage_configuration_id"` // Optional filter that specifies workspace IDs to deliver logs for. By // default the workspace filter is empty and log delivery applies at the // account level, delivering workspace-level logs for all workspaces in your // account, plus account level logs. You can optionally set this field to an // array of workspace IDs (each one is an `int64`) to which log delivery // should apply, in which case only workspace-level logs relating to the // specified workspaces are delivered. If you plan to use different log // delivery configurations for different workspaces, set this field // explicitly. Be aware that delivery configurations mentioning specific // workspaces won't apply to new workspaces created in the future, and // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (CreateLogDeliveryConfigurationParams) MarshalJSON ¶ added in v0.23.0
func (s CreateLogDeliveryConfigurationParams) MarshalJSON() ([]byte, error)
func (*CreateLogDeliveryConfigurationParams) UnmarshalJSON ¶ added in v0.23.0
func (s *CreateLogDeliveryConfigurationParams) UnmarshalJSON(b []byte) error
type DeleteBudgetConfigurationRequest ¶ added in v0.44.0
type DeleteBudgetConfigurationRequest struct { // The Databricks budget configuration ID. BudgetId string `json:"-" url:"-"` }
Delete budget
type DeleteBudgetConfigurationResponse ¶ added in v0.44.0
type DeleteBudgetConfigurationResponse struct { }
type DeleteBudgetPolicyRequest ¶ added in v0.57.0
type DeleteBudgetPolicyRequest struct { // The Id of the policy. PolicyId string `json:"-" url:"-"` }
Delete a budget policy
type DeleteResponse ¶ added in v0.34.0
type DeleteResponse struct { }
type DeliveryStatus ¶
type DeliveryStatus string
The status string for log delivery. Possible values are: * `CREATED`: There were no log delivery attempts since the config was created. * `SUCCEEDED`: The latest attempt of log delivery has succeeded completely. * `USER_FAILURE`: The latest attempt of log delivery failed because of misconfiguration of customer provided permissions on role or storage. * `SYSTEM_FAILURE`: The latest attempt of log delivery failed because of an Databricks internal error. Contact support if it doesn't go away soon. * `NOT_FOUND`: The log delivery status as the configuration has been disabled since the release of this feature or there are no workspaces in the account.
const DeliveryStatusCreated DeliveryStatus = `CREATED`
There were no log delivery attempts since the config was created.
const DeliveryStatusNotFound DeliveryStatus = `NOT_FOUND`
The log delivery status as the configuration has been disabled since the release of this feature or there are no workspaces in the account.
const DeliveryStatusSucceeded DeliveryStatus = `SUCCEEDED`
The latest attempt of log delivery has succeeded completely.
const DeliveryStatusSystemFailure DeliveryStatus = `SYSTEM_FAILURE`
The latest attempt of log delivery failed because of an <Databricks> internal error. Contact support if it doesn't go away soon.
const DeliveryStatusUserFailure DeliveryStatus = `USER_FAILURE`
The latest attempt of log delivery failed because of misconfiguration of customer provided permissions on role or storage.
func (*DeliveryStatus) Set ¶ added in v0.2.0
func (f *DeliveryStatus) Set(v string) error
Set raw string value and validate it against allowed values
func (*DeliveryStatus) String ¶ added in v0.2.0
func (f *DeliveryStatus) String() string
String representation for fmt.Print
func (*DeliveryStatus) Type ¶ added in v0.2.0
func (f *DeliveryStatus) Type() string
Type always returns DeliveryStatus to satisfy [pflag.Value] interface
type DownloadRequest ¶
type DownloadRequest struct { // Format: `YYYY-MM`. Last month to return billable usage logs for. This // field is required. EndMonth string `json:"-" url:"end_month"` // Specify whether to include personally identifiable information in the // billable usage logs, for example the email addresses of cluster creators. // Handle this information with care. Defaults to false. PersonalData bool `json:"-" url:"personal_data,omitempty"` // Format: `YYYY-MM`. First month to return billable usage logs for. This // field is required. StartMonth string `json:"-" url:"start_month"` ForceSendFields []string `json:"-" url:"-"` }
Return billable usage logs
func (DownloadRequest) MarshalJSON ¶ added in v0.23.0
func (s DownloadRequest) MarshalJSON() ([]byte, error)
func (*DownloadRequest) UnmarshalJSON ¶ added in v0.23.0
func (s *DownloadRequest) UnmarshalJSON(b []byte) error
type DownloadResponse ¶ added in v0.23.0
type DownloadResponse struct {
Contents io.ReadCloser `json:"-"`
}
type Filter ¶ added in v0.57.0
type Filter struct { // The policy creator user id to be filtered on. If unspecified, all // policies will be returned. CreatorUserId int64 `json:"creator_user_id,omitempty" url:"creator_user_id,omitempty"` // The policy creator user name to be filtered on. If unspecified, all // policies will be returned. CreatorUserName string `json:"creator_user_name,omitempty" url:"creator_user_name,omitempty"` // The partial name of policies to be filtered on. If unspecified, all // policies will be returned. PolicyName string `json:"policy_name,omitempty" url:"policy_name,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Structured representation of a filter to be applied to a list of policies. All specified filters will be applied in conjunction.
func (Filter) MarshalJSON ¶ added in v0.57.0
func (*Filter) UnmarshalJSON ¶ added in v0.57.0
type GetBillingUsageDashboardRequest ¶ added in v0.44.0
type GetBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all // workspaces in the account. DashboardType UsageDashboardType `json:"-" url:"dashboard_type,omitempty"` // The workspace ID of the workspace in which the usage dashboard is // created. WorkspaceId int64 `json:"-" url:"workspace_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Get usage dashboard
func (GetBillingUsageDashboardRequest) MarshalJSON ¶ added in v0.44.0
func (s GetBillingUsageDashboardRequest) MarshalJSON() ([]byte, error)
func (*GetBillingUsageDashboardRequest) UnmarshalJSON ¶ added in v0.44.0
func (s *GetBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error
type GetBillingUsageDashboardResponse ¶ added in v0.44.0
type GetBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. DashboardId string `json:"dashboard_id,omitempty"` // The URL of the usage dashboard. DashboardUrl string `json:"dashboard_url,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (GetBillingUsageDashboardResponse) MarshalJSON ¶ added in v0.44.0
func (s GetBillingUsageDashboardResponse) MarshalJSON() ([]byte, error)
func (*GetBillingUsageDashboardResponse) UnmarshalJSON ¶ added in v0.44.0
func (s *GetBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error
type GetBudgetConfigurationRequest ¶ added in v0.44.0
type GetBudgetConfigurationRequest struct { // The budget configuration ID BudgetId string `json:"-" url:"-"` }
Get budget
type GetBudgetConfigurationResponse ¶ added in v0.44.0
type GetBudgetConfigurationResponse struct {
Budget *BudgetConfiguration `json:"budget,omitempty"`
}
type GetBudgetPolicyRequest ¶ added in v0.57.0
type GetBudgetPolicyRequest struct { // The Id of the policy. PolicyId string `json:"-" url:"-"` }
Get a budget policy
type GetLogDeliveryRequest ¶
type GetLogDeliveryRequest struct { // Databricks log delivery configuration ID LogDeliveryConfigurationId string `json:"-" url:"-"` }
Get log delivery configuration
type LimitConfig ¶ added in v0.58.0
type LimitConfig struct { }
The limit configuration of the policy. Limit configuration provide a budget policy level cost control by enforcing the limit.
type ListBudgetConfigurationsRequest ¶ added in v0.44.0
type ListBudgetConfigurationsRequest struct { // A page token received from a previous get all budget configurations call. // This token can be used to retrieve the subsequent page. Requests first // page if absent. PageToken string `json:"-" url:"page_token,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Get all budgets
func (ListBudgetConfigurationsRequest) MarshalJSON ¶ added in v0.44.0
func (s ListBudgetConfigurationsRequest) MarshalJSON() ([]byte, error)
func (*ListBudgetConfigurationsRequest) UnmarshalJSON ¶ added in v0.44.0
func (s *ListBudgetConfigurationsRequest) UnmarshalJSON(b []byte) error
type ListBudgetConfigurationsResponse ¶ added in v0.44.0
type ListBudgetConfigurationsResponse struct { Budgets []BudgetConfiguration `json:"budgets,omitempty"` // Token which can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no subsequent budgets. NextPageToken string `json:"next_page_token,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (ListBudgetConfigurationsResponse) MarshalJSON ¶ added in v0.44.0
func (s ListBudgetConfigurationsResponse) MarshalJSON() ([]byte, error)
func (*ListBudgetConfigurationsResponse) UnmarshalJSON ¶ added in v0.44.0
func (s *ListBudgetConfigurationsResponse) UnmarshalJSON(b []byte) error
type ListBudgetPoliciesRequest ¶ added in v0.57.0
type ListBudgetPoliciesRequest struct { // A filter to apply to the list of policies. FilterBy *Filter `json:"-" url:"filter_by,omitempty"` // The maximum number of budget policies to return. If unspecified, at most // 100 budget policies will be returned. The maximum value is 1000; values // above 1000 will be coerced to 1000. PageSize int `json:"-" url:"page_size,omitempty"` // A page token, received from a previous `ListServerlessPolicies` call. // Provide this to retrieve the subsequent page. If unspecified, the first // page will be returned. // // When paginating, all other parameters provided to // `ListServerlessPoliciesRequest` must match the call that provided the // page token. PageToken string `json:"-" url:"page_token,omitempty"` // The sort specification. SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
List policies
func (ListBudgetPoliciesRequest) MarshalJSON ¶ added in v0.57.0
func (s ListBudgetPoliciesRequest) MarshalJSON() ([]byte, error)
func (*ListBudgetPoliciesRequest) UnmarshalJSON ¶ added in v0.57.0
func (s *ListBudgetPoliciesRequest) UnmarshalJSON(b []byte) error
type ListBudgetPoliciesResponse ¶ added in v0.57.0
type ListBudgetPoliciesResponse struct { // A token that can be sent as `page_token` to retrieve the next page. If // this field is omitted, there are no subsequent pages. NextPageToken string `json:"next_page_token,omitempty"` Policies []BudgetPolicy `json:"policies,omitempty"` // A token that can be sent as `page_token` to retrieve the previous page. // In this field is omitted, there are no previous pages. PreviousPageToken string `json:"previous_page_token,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
A list of policies.
func (ListBudgetPoliciesResponse) MarshalJSON ¶ added in v0.57.0
func (s ListBudgetPoliciesResponse) MarshalJSON() ([]byte, error)
func (*ListBudgetPoliciesResponse) UnmarshalJSON ¶ added in v0.57.0
func (s *ListBudgetPoliciesResponse) UnmarshalJSON(b []byte) error
type ListLogDeliveryRequest ¶
type ListLogDeliveryRequest struct { // Filter by credential configuration ID. CredentialsId string `json:"-" url:"credentials_id,omitempty"` // Filter by status `ENABLED` or `DISABLED`. Status LogDeliveryConfigStatus `json:"-" url:"status,omitempty"` // Filter by storage configuration ID. StorageConfigurationId string `json:"-" url:"storage_configuration_id,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Get all log delivery configurations
func (ListLogDeliveryRequest) MarshalJSON ¶ added in v0.23.0
func (s ListLogDeliveryRequest) MarshalJSON() ([]byte, error)
func (*ListLogDeliveryRequest) UnmarshalJSON ¶ added in v0.23.0
func (s *ListLogDeliveryRequest) UnmarshalJSON(b []byte) error
type LogDeliveryAPI ¶
type LogDeliveryAPI struct {
// contains filtered or unexported fields
}
These APIs manage log delivery configurations for this account. The two supported log types for this API are _billable usage logs_ and _audit logs_. This feature is in Public Preview. This feature works with all account ID types.
Log delivery works with all account types. However, if your account is on the E2 version of the platform or on a select custom plan that allows multiple workspaces per account, you can optionally configure different storage destinations for each workspace. Log delivery status is also provided to know the latest status of log delivery attempts. The high-level flow of billable usage delivery:
1. **Create storage**: In AWS, create a new AWS S3 bucket with a specific bucket policy. Using Databricks APIs, call the Account API to create a [storage configuration object](:method:Storage/Create) that uses the bucket name. 2. **Create credentials**: In AWS, create the appropriate AWS IAM role. For full details, including the required IAM role policies and trust relationship, see Billable usage log delivery. Using Databricks APIs, call the Account API to create a [credential configuration object](:method:Credentials/Create) that uses the IAM role"s ARN. 3. **Create log delivery configuration**: Using Databricks APIs, call the Account API to [create a log delivery configuration](:method:LogDelivery/Create) that uses the credential and storage configuration objects from previous steps. You can specify if the logs should include all events of that log type in your account (_Account level_ delivery) or only events for a specific set of workspaces (_workspace level_ delivery). Account level log delivery applies to all current and future workspaces plus account level logs, while workspace level log delivery solely delivers logs related to the specified workspaces. You can create multiple types of delivery configurations per account.
For billable usage delivery: * For more information about billable usage logs, see Billable usage log delivery. For the CSV schema, see the Usage page. * The delivery location is `<bucket-name>/<prefix>/billable-usage/csv/`, where `<prefix>` is the name of the optional delivery path prefix you set up during log delivery configuration. Files are named `workspaceId=<workspace-id>-usageMonth=<month>.csv`. * All billable usage logs apply to specific workspaces (_workspace level_ logs). You can aggregate usage for your entire account by creating an _account level_ delivery configuration that delivers logs for all current and future workspaces in your account. * The files are delivered daily by overwriting the month's CSV file for each workspace.
For audit log delivery: * For more information about about audit log delivery, see Audit log delivery, which includes information about the used JSON schema. * The delivery location is `<bucket-name>/<delivery-path-prefix>/workspaceId=<workspaceId>/date=<yyyy-mm-dd>/auditlogs_<internal-id>.json`. Files may get overwritten with the same content multiple times to achieve exactly-once delivery. * If the audit log delivery configuration included specific workspace IDs, only _workspace-level_ audit logs for those workspaces are delivered. If the log delivery configuration applies to the entire account (_account level_ delivery configuration), the audit log delivery includes workspace-level audit logs for all workspaces in the account as well as account-level audit logs. See Audit log delivery for details. * Auditable events are typically available in logs within 15 minutes.
func NewLogDelivery ¶
func NewLogDelivery(client *client.DatabricksClient) *LogDeliveryAPI
func (*LogDeliveryAPI) Create ¶
func (a *LogDeliveryAPI) Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error)
Example (LogDelivery) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } bucket, err := a.Storage.Create(ctx, provisioning.CreateStorageConfigurationRequest{ StorageConfigurationName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), RootBucketInfo: provisioning.RootBucketInfo{ BucketName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", bucket) creds, err := a.Credentials.Create(ctx, provisioning.CreateCredentialRequest{ CredentialsName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), AwsCredentials: provisioning.CreateCredentialAwsCredentials{ StsRole: &provisioning.CreateCredentialStsRole{ RoleArn: os.Getenv("TEST_LOGDELIVERY_ARN"), }, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", creds) created, err := a.LogDelivery.Create(ctx, billing.WrappedCreateLogDeliveryConfiguration{ LogDeliveryConfiguration: &billing.CreateLogDeliveryConfigurationParams{ ConfigName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), CredentialsId: creds.CredentialsId, StorageConfigurationId: bucket.StorageConfigurationId, LogType: billing.LogTypeAuditLogs, OutputFormat: billing.OutputFormatJson, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", created) // cleanup err = a.Storage.DeleteByStorageConfigurationId(ctx, bucket.StorageConfigurationId) if err != nil { panic(err) } err = a.Credentials.DeleteByCredentialsId(ctx, creds.CredentialsId) if err != nil { panic(err) } err = a.LogDelivery.PatchStatus(ctx, billing.UpdateLogDeliveryConfigurationStatusRequest{ LogDeliveryConfigurationId: created.LogDeliveryConfiguration.ConfigId, Status: billing.LogDeliveryConfigStatusDisabled, }) if err != nil { panic(err) }
Output:
func (*LogDeliveryAPI) Get ¶
func (a *LogDeliveryAPI) Get(ctx context.Context, request GetLogDeliveryRequest) (*WrappedLogDeliveryConfiguration, error)
Example (LogDelivery) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } bucket, err := a.Storage.Create(ctx, provisioning.CreateStorageConfigurationRequest{ StorageConfigurationName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), RootBucketInfo: provisioning.RootBucketInfo{ BucketName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", bucket) creds, err := a.Credentials.Create(ctx, provisioning.CreateCredentialRequest{ CredentialsName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), AwsCredentials: provisioning.CreateCredentialAwsCredentials{ StsRole: &provisioning.CreateCredentialStsRole{ RoleArn: os.Getenv("TEST_LOGDELIVERY_ARN"), }, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", creds) created, err := a.LogDelivery.Create(ctx, billing.WrappedCreateLogDeliveryConfiguration{ LogDeliveryConfiguration: &billing.CreateLogDeliveryConfigurationParams{ ConfigName: fmt.Sprintf("sdk-%x", time.Now().UnixNano()), CredentialsId: creds.CredentialsId, StorageConfigurationId: bucket.StorageConfigurationId, LogType: billing.LogTypeAuditLogs, OutputFormat: billing.OutputFormatJson, }, }) if err != nil { panic(err) } logger.Infof(ctx, "found %v", created) byId, err := a.LogDelivery.GetByLogDeliveryConfigurationId(ctx, created.LogDeliveryConfiguration.ConfigId) if err != nil { panic(err) } logger.Infof(ctx, "found %v", byId) // cleanup err = a.Storage.DeleteByStorageConfigurationId(ctx, bucket.StorageConfigurationId) if err != nil { panic(err) } err = a.Credentials.DeleteByCredentialsId(ctx, creds.CredentialsId) if err != nil { panic(err) } err = a.LogDelivery.PatchStatus(ctx, billing.UpdateLogDeliveryConfigurationStatusRequest{ LogDeliveryConfigurationId: created.LogDeliveryConfiguration.ConfigId, Status: billing.LogDeliveryConfigStatusDisabled, }) if err != nil { panic(err) }
Output:
func (*LogDeliveryAPI) GetByConfigName ¶
func (a *LogDeliveryAPI) GetByConfigName(ctx context.Context, name string) (*LogDeliveryConfiguration, error)
GetByConfigName calls LogDeliveryAPI.LogDeliveryConfigurationConfigNameToConfigIdMap and returns a single LogDeliveryConfiguration.
Returns an error if there's more than one LogDeliveryConfiguration with the same .ConfigName.
Note: All LogDeliveryConfiguration instances are loaded into memory before returning matching by name.
This method is generated by Databricks SDK Code Generator.
func (*LogDeliveryAPI) GetByLogDeliveryConfigurationId ¶
func (a *LogDeliveryAPI) GetByLogDeliveryConfigurationId(ctx context.Context, logDeliveryConfigurationId string) (*WrappedLogDeliveryConfiguration, error)
Get log delivery configuration.
Gets a Databricks log delivery configuration object for an account, both specified by ID.
func (*LogDeliveryAPI) List ¶ added in v0.24.0
func (a *LogDeliveryAPI) List(ctx context.Context, request ListLogDeliveryRequest) listing.Iterator[LogDeliveryConfiguration]
Get all log delivery configurations.
Gets all Databricks log delivery configurations associated with an account specified by ID.
func (*LogDeliveryAPI) ListAll ¶
func (a *LogDeliveryAPI) ListAll(ctx context.Context, request ListLogDeliveryRequest) ([]LogDeliveryConfiguration, error)
Get all log delivery configurations.
Gets all Databricks log delivery configurations associated with an account specified by ID.
Example (LogDelivery) ¶
ctx := context.Background() a, err := databricks.NewAccountClient() if err != nil { panic(err) } all, err := a.LogDelivery.ListAll(ctx, billing.ListLogDeliveryRequest{}) if err != nil { panic(err) } logger.Infof(ctx, "found %v", all)
Output:
func (*LogDeliveryAPI) LogDeliveryConfigurationConfigNameToConfigIdMap ¶
func (a *LogDeliveryAPI) LogDeliveryConfigurationConfigNameToConfigIdMap(ctx context.Context, request ListLogDeliveryRequest) (map[string]string, error)
LogDeliveryConfigurationConfigNameToConfigIdMap calls LogDeliveryAPI.ListAll and creates a map of results with LogDeliveryConfiguration.ConfigName as key and LogDeliveryConfiguration.ConfigId as value.
Returns an error if there's more than one LogDeliveryConfiguration with the same .ConfigName.
Note: All LogDeliveryConfiguration instances are loaded into memory before creating a map.
This method is generated by Databricks SDK Code Generator.
func (*LogDeliveryAPI) PatchStatus ¶
func (a *LogDeliveryAPI) PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error
type LogDeliveryConfigStatus ¶
type LogDeliveryConfigStatus string
Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed.
const LogDeliveryConfigStatusDisabled LogDeliveryConfigStatus = `DISABLED`
const LogDeliveryConfigStatusEnabled LogDeliveryConfigStatus = `ENABLED`
func (*LogDeliveryConfigStatus) Set ¶ added in v0.2.0
func (f *LogDeliveryConfigStatus) Set(v string) error
Set raw string value and validate it against allowed values
func (*LogDeliveryConfigStatus) String ¶ added in v0.2.0
func (f *LogDeliveryConfigStatus) String() string
String representation for fmt.Print
func (*LogDeliveryConfigStatus) Type ¶ added in v0.2.0
func (f *LogDeliveryConfigStatus) Type() string
Type always returns LogDeliveryConfigStatus to satisfy [pflag.Value] interface
type LogDeliveryConfiguration ¶
type LogDeliveryConfiguration struct { // The Databricks account ID that hosts the log delivery configuration. AccountId string `json:"account_id,omitempty"` // Databricks log delivery configuration ID. ConfigId string `json:"config_id,omitempty"` // The optional human-readable name of the log delivery configuration. // Defaults to empty. ConfigName string `json:"config_name,omitempty"` // Time in epoch milliseconds when the log delivery configuration was // created. CreationTime int64 `json:"creation_time,omitempty"` // The ID for a method:credentials/create that represents the AWS IAM role // with policy and trust relationship as described in the main billable // usage documentation page. See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html CredentialsId string `json:"credentials_id,omitempty"` // The optional delivery path prefix within Amazon S3 storage. Defaults to // empty, which means that logs are delivered to the root of the bucket. // This must be a valid S3 object key. This must not start or end with a // slash character. DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` // This field applies only if `log_type` is `BILLABLE_USAGE`. This is the // optional start month and year for delivery, specified in `YYYY-MM` // format. Defaults to current year and month. `BILLABLE_USAGE` logs are not // available for usage before March 2019 (`2019-03`). DeliveryStartTime string `json:"delivery_start_time,omitempty"` // Databricks log delivery status. LogDeliveryStatus *LogDeliveryStatus `json:"log_delivery_status,omitempty"` // Log delivery type. Supported values are: // // * `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the // CSV schema, see the [View billable usage]. // // * `AUDIT_LOGS` — Configure [audit log delivery]. For the JSON schema, // see [Configure audit logging] // // [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html // [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html LogType LogType `json:"log_type,omitempty"` // The file type of log delivery. // // * If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the // CSV (comma-separated values) format is supported. For the schema, see the // [View billable usage] * If `log_type` is `AUDIT_LOGS`, this value must be // `JSON`. Only the JSON (JavaScript Object Notation) format is supported. // For the schema, see the [Configuring audit logs]. // // [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html OutputFormat OutputFormat `json:"output_format,omitempty"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. Status LogDeliveryConfigStatus `json:"status,omitempty"` // The ID for a method:storage/create that represents the S3 bucket with // bucket policy as described in the main billable usage documentation page. // See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html StorageConfigurationId string `json:"storage_configuration_id,omitempty"` // Time in epoch milliseconds when the log delivery configuration was // updated. UpdateTime int64 `json:"update_time,omitempty"` // Optional filter that specifies workspace IDs to deliver logs for. By // default the workspace filter is empty and log delivery applies at the // account level, delivering workspace-level logs for all workspaces in your // account, plus account level logs. You can optionally set this field to an // array of workspace IDs (each one is an `int64`) to which log delivery // should apply, in which case only workspace-level logs relating to the // specified workspaces are delivered. If you plan to use different log // delivery configurations for different workspaces, set this field // explicitly. Be aware that delivery configurations mentioning specific // workspaces won't apply to new workspaces created in the future, and // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (LogDeliveryConfiguration) MarshalJSON ¶ added in v0.23.0
func (s LogDeliveryConfiguration) MarshalJSON() ([]byte, error)
func (*LogDeliveryConfiguration) UnmarshalJSON ¶ added in v0.23.0
func (s *LogDeliveryConfiguration) UnmarshalJSON(b []byte) error
type LogDeliveryInterface ¶ added in v0.29.0
type LogDeliveryInterface interface { // Create a new log delivery configuration. // // Creates a new Databricks log delivery configuration to enable delivery of the // specified type of logs to your storage location. This requires that you // already created a [credential object](:method:Credentials/Create) (which // encapsulates a cross-account service IAM role) and a [storage configuration // object](:method:Storage/Create) (which encapsulates an S3 bucket). // // For full details, including the required IAM role policies and bucket // policies, see [Deliver and access billable usage logs] or [Configure audit // logging]. // // **Note**: There is a limit on the number of log delivery configurations // available per account (each limit applies separately to each log type // including billable usage and audit logs). You can create a maximum of two // enabled account-level delivery configurations (configurations without a // workspace filter) per type. Additionally, you can create two enabled // workspace-level delivery configurations per workspace for each log type, // which means that the same workspace ID can occur in the workspace filter for // no more than two delivery configurations per log type. // // You cannot delete a log delivery configuration, but you can disable it (see // [Enable or disable log delivery // configuration](:method:LogDelivery/PatchStatus)). // // [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [Deliver and access billable usage logs]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error) // Get log delivery configuration. // // Gets a Databricks log delivery configuration object for an account, both // specified by ID. Get(ctx context.Context, request GetLogDeliveryRequest) (*WrappedLogDeliveryConfiguration, error) // Get log delivery configuration. // // Gets a Databricks log delivery configuration object for an account, both // specified by ID. GetByLogDeliveryConfigurationId(ctx context.Context, logDeliveryConfigurationId string) (*WrappedLogDeliveryConfiguration, error) // Get all log delivery configurations. // // Gets all Databricks log delivery configurations associated with an account // specified by ID. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListLogDeliveryRequest) listing.Iterator[LogDeliveryConfiguration] // Get all log delivery configurations. // // Gets all Databricks log delivery configurations associated with an account // specified by ID. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListLogDeliveryRequest) ([]LogDeliveryConfiguration, error) // LogDeliveryConfigurationConfigNameToConfigIdMap calls [LogDeliveryAPI.ListAll] and creates a map of results with [LogDeliveryConfiguration].ConfigName as key and [LogDeliveryConfiguration].ConfigId as value. // // Returns an error if there's more than one [LogDeliveryConfiguration] with the same .ConfigName. // // Note: All [LogDeliveryConfiguration] instances are loaded into memory before creating a map. // // This method is generated by Databricks SDK Code Generator. LogDeliveryConfigurationConfigNameToConfigIdMap(ctx context.Context, request ListLogDeliveryRequest) (map[string]string, error) // GetByConfigName calls [LogDeliveryAPI.LogDeliveryConfigurationConfigNameToConfigIdMap] and returns a single [LogDeliveryConfiguration]. // // Returns an error if there's more than one [LogDeliveryConfiguration] with the same .ConfigName. // // Note: All [LogDeliveryConfiguration] instances are loaded into memory before returning matching by name. // // This method is generated by Databricks SDK Code Generator. GetByConfigName(ctx context.Context, name string) (*LogDeliveryConfiguration, error) // Enable or disable log delivery configuration. // // Enables or disables a log delivery configuration. Deletion of delivery // configurations is not supported, so disable log delivery configurations that // are no longer needed. Note that you can't re-enable a delivery configuration // if this would violate the delivery configuration limits described under // [Create log delivery](:method:LogDelivery/Create). PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error }
type LogDeliveryService ¶
type LogDeliveryService interface { // Create a new log delivery configuration. // // Creates a new Databricks log delivery configuration to enable delivery of // the specified type of logs to your storage location. This requires that // you already created a [credential object](:method:Credentials/Create) // (which encapsulates a cross-account service IAM role) and a [storage // configuration object](:method:Storage/Create) (which encapsulates an S3 // bucket). // // For full details, including the required IAM role policies and bucket // policies, see [Deliver and access billable usage logs] or [Configure // audit logging]. // // **Note**: There is a limit on the number of log delivery configurations // available per account (each limit applies separately to each log type // including billable usage and audit logs). You can create a maximum of two // enabled account-level delivery configurations (configurations without a // workspace filter) per type. Additionally, you can create two enabled // workspace-level delivery configurations per workspace for each log type, // which means that the same workspace ID can occur in the workspace filter // for no more than two delivery configurations per log type. // // You cannot delete a log delivery configuration, but you can disable it // (see [Enable or disable log delivery // configuration](:method:LogDelivery/PatchStatus)). // // [Configure audit logging]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [Deliver and access billable usage logs]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error) // Get log delivery configuration. // // Gets a Databricks log delivery configuration object for an account, both // specified by ID. Get(ctx context.Context, request GetLogDeliveryRequest) (*WrappedLogDeliveryConfiguration, error) // Get all log delivery configurations. // // Gets all Databricks log delivery configurations associated with an // account specified by ID. // // Use ListAll() to get all LogDeliveryConfiguration instances List(ctx context.Context, request ListLogDeliveryRequest) (*WrappedLogDeliveryConfigurations, error) // Enable or disable log delivery configuration. // // Enables or disables a log delivery configuration. Deletion of delivery // configurations is not supported, so disable log delivery configurations // that are no longer needed. Note that you can't re-enable a delivery // configuration if this would violate the delivery configuration limits // described under [Create log delivery](:method:LogDelivery/Create). PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error }
These APIs manage log delivery configurations for this account. The two supported log types for this API are _billable usage logs_ and _audit logs_. This feature is in Public Preview. This feature works with all account ID types.
Log delivery works with all account types. However, if your account is on the E2 version of the platform or on a select custom plan that allows multiple workspaces per account, you can optionally configure different storage destinations for each workspace. Log delivery status is also provided to know the latest status of log delivery attempts. The high-level flow of billable usage delivery:
1. **Create storage**: In AWS, create a new AWS S3 bucket with a specific bucket policy. Using Databricks APIs, call the Account API to create a [storage configuration object](:method:Storage/Create) that uses the bucket name. 2. **Create credentials**: In AWS, create the appropriate AWS IAM role. For full details, including the required IAM role policies and trust relationship, see Billable usage log delivery. Using Databricks APIs, call the Account API to create a [credential configuration object](:method:Credentials/Create) that uses the IAM role"s ARN. 3. **Create log delivery configuration**: Using Databricks APIs, call the Account API to [create a log delivery configuration](:method:LogDelivery/Create) that uses the credential and storage configuration objects from previous steps. You can specify if the logs should include all events of that log type in your account (_Account level_ delivery) or only events for a specific set of workspaces (_workspace level_ delivery). Account level log delivery applies to all current and future workspaces plus account level logs, while workspace level log delivery solely delivers logs related to the specified workspaces. You can create multiple types of delivery configurations per account.
For billable usage delivery: * For more information about billable usage logs, see Billable usage log delivery. For the CSV schema, see the Usage page. * The delivery location is `<bucket-name>/<prefix>/billable-usage/csv/`, where `<prefix>` is the name of the optional delivery path prefix you set up during log delivery configuration. Files are named `workspaceId=<workspace-id>-usageMonth=<month>.csv`. * All billable usage logs apply to specific workspaces (_workspace level_ logs). You can aggregate usage for your entire account by creating an _account level_ delivery configuration that delivers logs for all current and future workspaces in your account. * The files are delivered daily by overwriting the month's CSV file for each workspace.
For audit log delivery: * For more information about about audit log delivery, see Audit log delivery, which includes information about the used JSON schema. * The delivery location is `<bucket-name>/<delivery-path-prefix>/workspaceId=<workspaceId>/date=<yyyy-mm-dd>/auditlogs_<internal-id>.json`. Files may get overwritten with the same content multiple times to achieve exactly-once delivery. * If the audit log delivery configuration included specific workspace IDs, only _workspace-level_ audit logs for those workspaces are delivered. If the log delivery configuration applies to the entire account (_account level_ delivery configuration), the audit log delivery includes workspace-level audit logs for all workspaces in the account as well as account-level audit logs. See Audit log delivery for details. * Auditable events are typically available in logs within 15 minutes.
type LogDeliveryStatus ¶
type LogDeliveryStatus struct { // The UTC time for the latest log delivery attempt. LastAttemptTime string `json:"last_attempt_time,omitempty"` // The UTC time for the latest successful log delivery. LastSuccessfulAttemptTime string `json:"last_successful_attempt_time,omitempty"` // Informative message about the latest log delivery attempt. If the log // delivery fails with USER_FAILURE, error details will be provided for // fixing misconfigurations in cloud permissions. Message string `json:"message,omitempty"` // The status string for log delivery. Possible values are: * `CREATED`: // There were no log delivery attempts since the config was created. * // `SUCCEEDED`: The latest attempt of log delivery has succeeded completely. // * `USER_FAILURE`: The latest attempt of log delivery failed because of // misconfiguration of customer provided permissions on role or storage. * // `SYSTEM_FAILURE`: The latest attempt of log delivery failed because of an // Databricks internal error. Contact support if it doesn't go away soon. * // `NOT_FOUND`: The log delivery status as the configuration has been // disabled since the release of this feature or there are no workspaces in // the account. Status DeliveryStatus `json:"status,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
Databricks log delivery status.
func (LogDeliveryStatus) MarshalJSON ¶ added in v0.23.0
func (s LogDeliveryStatus) MarshalJSON() ([]byte, error)
func (*LogDeliveryStatus) UnmarshalJSON ¶ added in v0.23.0
func (s *LogDeliveryStatus) UnmarshalJSON(b []byte) error
type LogType ¶
type LogType string
Log delivery type. Supported values are:
* `BILLABLE_USAGE` — Configure billable usage log delivery. For the CSV schema, see the View billable usage.
* `AUDIT_LOGS` — Configure audit log delivery. For the JSON schema, see Configure audit logging
const LogTypeAuditLogs LogType = `AUDIT_LOGS`
const LogTypeBillableUsage LogType = `BILLABLE_USAGE`
type OutputFormat ¶
type OutputFormat string
The file type of log delivery.
* If `log_type` is `BILLABLE_USAGE`, this value must be `CSV`. Only the CSV (comma-separated values) format is supported. For the schema, see the View billable usage * If `log_type` is `AUDIT_LOGS`, this value must be `JSON`. Only the JSON (JavaScript Object Notation) format is supported. For the schema, see the Configuring audit logs.
const OutputFormatCsv OutputFormat = `CSV`
const OutputFormatJson OutputFormat = `JSON`
func (*OutputFormat) Set ¶ added in v0.2.0
func (f *OutputFormat) Set(v string) error
Set raw string value and validate it against allowed values
func (*OutputFormat) String ¶ added in v0.2.0
func (f *OutputFormat) String() string
String representation for fmt.Print
func (*OutputFormat) Type ¶ added in v0.2.0
func (f *OutputFormat) Type() string
Type always returns OutputFormat to satisfy [pflag.Value] interface
type PatchStatusResponse ¶ added in v0.34.0
type PatchStatusResponse struct { }
type SortSpec ¶ added in v0.57.0
type SortSpec struct { // Whether to sort in descending order. Descending bool `json:"descending,omitempty" url:"descending,omitempty"` // The filed to sort by Field SortSpecField `json:"field,omitempty" url:"field,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (SortSpec) MarshalJSON ¶ added in v0.57.0
func (*SortSpec) UnmarshalJSON ¶ added in v0.57.0
type SortSpecField ¶ added in v0.57.0
type SortSpecField string
const SortSpecFieldPolicyName SortSpecField = `POLICY_NAME`
func (*SortSpecField) Set ¶ added in v0.57.0
func (f *SortSpecField) Set(v string) error
Set raw string value and validate it against allowed values
func (*SortSpecField) String ¶ added in v0.57.0
func (f *SortSpecField) String() string
String representation for fmt.Print
func (*SortSpecField) Type ¶ added in v0.57.0
func (f *SortSpecField) Type() string
Type always returns SortSpecField to satisfy [pflag.Value] interface
type UpdateBudgetConfigurationBudget ¶ added in v0.44.0
type UpdateBudgetConfigurationBudget struct { // Databricks account ID. AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` // Databricks budget configuration ID. BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` // Human-readable name of budget configuration. Max Length: 128 DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. Filter *BudgetConfigurationFilter `json:"filter,omitempty"` ForceSendFields []string `json:"-" url:"-"` }
func (UpdateBudgetConfigurationBudget) MarshalJSON ¶ added in v0.44.0
func (s UpdateBudgetConfigurationBudget) MarshalJSON() ([]byte, error)
func (*UpdateBudgetConfigurationBudget) UnmarshalJSON ¶ added in v0.44.0
func (s *UpdateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error
type UpdateBudgetConfigurationRequest ¶ added in v0.44.0
type UpdateBudgetConfigurationRequest struct { // The updated budget. This will overwrite the budget specified by the // budget ID. Budget UpdateBudgetConfigurationBudget `json:"budget"` // The Databricks budget configuration ID. BudgetId string `json:"-" url:"-"` }
type UpdateBudgetConfigurationResponse ¶ added in v0.44.0
type UpdateBudgetConfigurationResponse struct { // The updated budget. Budget *BudgetConfiguration `json:"budget,omitempty"` }
type UpdateBudgetPolicyRequest ¶ added in v0.57.0
type UpdateBudgetPolicyRequest struct { // DEPRECATED. This is redundant field as LimitConfig is part of the // BudgetPolicy LimitConfig *LimitConfig `json:"-" url:"limit_config,omitempty"` // Contains the BudgetPolicy details. Policy *BudgetPolicy `json:"policy,omitempty"` // The Id of the policy. This field is generated by Databricks and globally // unique. PolicyId string `json:"-" url:"-"` }
Update a budget policy
type UpdateLogDeliveryConfigurationStatusRequest ¶
type UpdateLogDeliveryConfigurationStatusRequest struct { // Databricks log delivery configuration ID LogDeliveryConfigurationId string `json:"-" url:"-"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. Status LogDeliveryConfigStatus `json:"status"` }
type UsageDashboardType ¶ added in v0.44.0
type UsageDashboardType string
const UsageDashboardTypeUsageDashboardTypeGlobal UsageDashboardType = `USAGE_DASHBOARD_TYPE_GLOBAL`
const UsageDashboardTypeUsageDashboardTypeWorkspace UsageDashboardType = `USAGE_DASHBOARD_TYPE_WORKSPACE`
func (*UsageDashboardType) Set ¶ added in v0.44.0
func (f *UsageDashboardType) Set(v string) error
Set raw string value and validate it against allowed values
func (*UsageDashboardType) String ¶ added in v0.44.0
func (f *UsageDashboardType) String() string
String representation for fmt.Print
func (*UsageDashboardType) Type ¶ added in v0.44.0
func (f *UsageDashboardType) Type() string
Type always returns UsageDashboardType to satisfy [pflag.Value] interface
type UsageDashboardsAPI ¶ added in v0.44.0
type UsageDashboardsAPI struct {
// contains filtered or unexported fields
}
These APIs manage usage dashboards for this account. Usage dashboards enable you to gain insights into your usage with pre-built dashboards: visualize breakdowns, analyze tag attributions, and identify cost drivers.
func NewUsageDashboards ¶ added in v0.44.0
func NewUsageDashboards(client *client.DatabricksClient) *UsageDashboardsAPI
func (*UsageDashboardsAPI) Create ¶ added in v0.44.0
func (a *UsageDashboardsAPI) Create(ctx context.Context, request CreateBillingUsageDashboardRequest) (*CreateBillingUsageDashboardResponse, error)
func (*UsageDashboardsAPI) Get ¶ added in v0.44.0
func (a *UsageDashboardsAPI) Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error)
type UsageDashboardsInterface ¶ added in v0.44.0
type UsageDashboardsInterface interface { // Create new usage dashboard. // // Create a usage dashboard specified by workspaceId, accountId, and dashboard // type. Create(ctx context.Context, request CreateBillingUsageDashboardRequest) (*CreateBillingUsageDashboardResponse, error) // Get usage dashboard. // // Get a usage dashboard specified by workspaceId, accountId, and dashboard // type. Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error) }
type UsageDashboardsService ¶ added in v0.44.0
type UsageDashboardsService interface { // Create new usage dashboard. // // Create a usage dashboard specified by workspaceId, accountId, and // dashboard type. Create(ctx context.Context, request CreateBillingUsageDashboardRequest) (*CreateBillingUsageDashboardResponse, error) // Get usage dashboard. // // Get a usage dashboard specified by workspaceId, accountId, and dashboard // type. Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error) }
These APIs manage usage dashboards for this account. Usage dashboards enable you to gain insights into your usage with pre-built dashboards: visualize breakdowns, analyze tag attributions, and identify cost drivers.
type WrappedCreateLogDeliveryConfiguration ¶
type WrappedCreateLogDeliveryConfiguration struct {
LogDeliveryConfiguration *CreateLogDeliveryConfigurationParams `json:"log_delivery_configuration,omitempty"`
}
type WrappedLogDeliveryConfiguration ¶
type WrappedLogDeliveryConfiguration struct {
LogDeliveryConfiguration *LogDeliveryConfiguration `json:"log_delivery_configuration,omitempty"`
}
type WrappedLogDeliveryConfigurations ¶
type WrappedLogDeliveryConfigurations struct {
LogDeliveryConfigurations []LogDeliveryConfiguration `json:"log_delivery_configurations,omitempty"`
}