quotas

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package quotas is deprecated. Use quota manager instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProjectQuota

type ProjectQuota struct {
	// ID is a project unique id.
	ID string `json:"-"`

	// ProjectQuotas contains project's quota information.
	ProjectQuotas []Quota `json:"-"`
}

ProjectQuota represents quota information of a single project.

type ProjectsQuotas

type ProjectsQuotas struct {
	// ProjectQuotas represents slice of ProjectQuotas.
	ProjectQuotas []*ProjectQuota `json:"-"`
}

ProjectsQuotas represents quotas for different projects.

func (*ProjectsQuotas) UnmarshalJSON

func (result *ProjectsQuotas) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom unmarshalling method for the ProjectsQuotas type.

We need it to work with a JSON structure that the Resell v2 API responses with:

"quotas": {
    "6d23928357bb4e0eb302794bc57fb8fd": {
        "compute_cores": [
            {
               "region": "ru-1",
               "used": 2,
               "value": 10,
               "zone": "ru-1b"
            },
            ...
        ]
    },
    ...
}

type Quota

type Quota struct {
	// Name is a resource human-readable name.
	Name string `json:"-"`

	// ResourceQuotasEntities contains information about quotas of a single billing resource in different locations.
	ResourceQuotasEntities []ResourceQuotaEntity `json:"-"`
}

Quota represents a quota information for a single billing resource.

type ResourceQuotaEntity

type ResourceQuotaEntity struct {
	// Region contains the quota region data.
	Region string `json:"region"`

	// Zone contains the quota zone data.
	Zone string `json:"zone"`

	// Value contans value of resource quota in the specific region and zone.
	// It represents a free quota value if used with the GetFree request.
	Value int `json:"value"`

	// Used contains quantity of a used quota in the specific region and zone.
	Used int `json:"used"`
}

ResourceQuotaEntity represents a single entity of the resource quota data in the specific region and zone.

type ResourcesQuotas

type ResourcesQuotas struct {
	// Quotas represents slice of Quotas.
	Quotas []*Quota `json:"-"`
}

ResourcesQuotas represents quotas for different resources.

func (*ResourcesQuotas) UnmarshalJSON

func (result *ResourcesQuotas) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom unmarshalling method for the ResourcesQuotas type.

We need it to work with a JSON structure that the Resell v2 API responses with:

"quotas": {
    "compute_cores": [
        {
            "region": "ru-2",
            "value": 200,
            "zone": "ru-2a"
        },
        ...
    ],
    ...
}

Jump to

Keyboard shortcuts

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