budgetadjustment

package
v0.89.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package budgetadjustment defines BudgetAdjustment object definitions. BudgetAdjustment is under development and not yet available for use.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BudgetAdjustment

type BudgetAdjustment struct {
	APIVersion manifest.Version `json:"apiVersion"`
	Kind       manifest.Kind    `json:"kind"`
	Metadata   Metadata         `json:"metadata"`
	Spec       Spec             `json:"spec"`

	Organization   string `json:"organization,omitempty"`
	ManifestSource string `json:"manifestSrc,omitempty"`
}

BudgetAdjustment represents a object for manipulating budget adjustments.

Example
package main

import (
	"context"
	"log"
	"time"

	"github.com/nobl9/nobl9-go/internal/examples"
	"github.com/nobl9/nobl9-go/manifest"
	"github.com/nobl9/nobl9-go/manifest/v1alpha/budgetadjustment"
)

func main() {
	// Create the object:
	budgetAdjustment := budgetadjustment.New(
		budgetadjustment.Metadata{
			Name:        "budget-adjustment",
			DisplayName: "My budget adjustment",
		},
		budgetadjustment.Spec{
			Description:     "Example budget adjustment",
			FirstEventStart: time.Date(2024, 2, 5, 5, 0, 0, 0, time.UTC),
			Duration:        "1h",
			Rrule:           "FREQ=WEEKLY;INTERVAL=1",
			Filters: budgetadjustment.Filters{
				SLOs: []budgetadjustment.SLORef{
					{
						Name:    "slo-name",
						Project: "default",
					},
				},
			},
		},
	)
	// Verify the object:
	if err := budgetAdjustment.Validate(); err != nil {
		log.Fatalf("budget adjustment validation failed, err: %v", err)
	}
	// Apply the object:
	client := examples.GetOfflineEchoClient()
	if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{budgetAdjustment}); err != nil {
		log.Fatalf("failed to apply alert method, err: %v", err)
	}
}
Output:

apiVersion: n9/v1alpha
kind: BudgetAdjustment
metadata:
  name: budget-adjustment
  displayName: My budget adjustment
spec:
  description: Example budget adjustment
  firstEventStart: 2024-02-05T05:00:00Z
  duration: 1h
  rrule: FREQ=WEEKLY;INTERVAL=1
  filters:
    slos:
    - name: slo-name
      project: default

func New

func New(metadata Metadata, spec Spec) BudgetAdjustment

func (BudgetAdjustment) GetKind

func (b BudgetAdjustment) GetKind() manifest.Kind

func (BudgetAdjustment) GetManifestSource

func (b BudgetAdjustment) GetManifestSource() string

func (BudgetAdjustment) GetName

func (b BudgetAdjustment) GetName() string

func (BudgetAdjustment) GetOrganization

func (b BudgetAdjustment) GetOrganization() string

func (BudgetAdjustment) GetValidator added in v0.82.0

func (b BudgetAdjustment) GetValidator() govy.Validator[BudgetAdjustment]

func (BudgetAdjustment) GetVersion

func (b BudgetAdjustment) GetVersion() manifest.Version

func (BudgetAdjustment) SetManifestSource

func (b BudgetAdjustment) SetManifestSource(src string) manifest.Object

func (BudgetAdjustment) SetOrganization

func (b BudgetAdjustment) SetOrganization(org string) manifest.Object

func (BudgetAdjustment) Validate

func (b BudgetAdjustment) Validate() error

type Filters

type Filters struct {
	SLOs []SLORef `json:"slos"`
}

type Metadata

type Metadata struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName,omitempty"`
}

type SLORef

type SLORef struct {
	Name    string `json:"name"`
	Project string `json:"project"`
}

type Spec

type Spec struct {
	Description     string    `json:"description,omitempty"`
	FirstEventStart time.Time `json:"firstEventStart"`
	Duration        string    `json:"duration"`
	Rrule           string    `json:"rrule,omitempty"`
	Filters         Filters   `json:"filters"`
}

Spec represents content of BudgetAdjustment's Spec.

Jump to

Keyboard shortcuts

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