licenses

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package licenses manages and retrieves license in the Enterprise Cloud Dedicated Hypervisor Service.

Example to List Licenses

listOpts := licenses.ListOpts{
	LicenseType: "vCenter Server 6.x Standard",
}

allPages, err := licenses.List(dhClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allLicenses, err := licenses.ExtractLicenses(allPages)
if err != nil {
	panic(err)
}

for _, license := range allLicenses {
	fmt.Printf("%+v\n", license)
}

Example to Create a License

createOpts := licenses.CreateOpts{
	LicenseType: "vCenter Server 6.x Standard",
}

result := licenses.Create(dhClient, createOpts)
if result.Err != nil {
	panic(result.Err)
}

Example to Delete a license

licenseID := "02471b45-3de0-4fc8-8469-a7cc52c378df"

result := licenses.Delete(dhClient, licenseID)
if result.Err != nil {
	panic(result.Err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List retrieves a list of Licenses.

Types

type CreateOpts

type CreateOpts struct {
	LicenseType string `json:"license_type"`
}

CreateOpts provides options used to create a License.

func (CreateOpts) ToResourceCreateMap

func (opts CreateOpts) ToResourceCreateMap() (map[string]interface{}, error)

ToResourceCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToResourceCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult is the response from a Create operation. Call its Extract method to interpret it as a License.

func Create

func Create(client *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create creates a new License.

func (CreateResult) ExtractLicenseInfo

func (r CreateResult) ExtractLicenseInfo() (*License, error)

ExtractLicenseInfo interprets any commonResult as a License.

type DeleteResult

type DeleteResult struct {
	eclcloud.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

func Delete

func Delete(client *eclcloud.ServiceClient, id string) (r DeleteResult)

Delete deletes a License.

type License

type License struct {
	ID           string     `json:"id"`
	Key          string     `json:"key"`
	AssignedFrom time.Time  `json:"assigned_from"`
	ExpiresAt    *time.Time `json:"expires_at"`
	LicenseType  string     `json:"license_type"`
}

License represents guest image license key information.

func ExtractLicenses

func ExtractLicenses(r pagination.Page) ([]License, error)

ExtractLicenses returns a slice of Licenses contained in a single page of results.

type LicensePage

type LicensePage struct {
	pagination.LinkedPageBase
}

LicensePage is a single page of License results.

func (LicensePage) IsEmpty

func (r LicensePage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of Licenses contains any results.

type ListOpts

type ListOpts struct {
	LicenseType string `q:"license_type"`
}

ListOpts provides options to filter the List results.

func (ListOpts) ToResourceListQuery

func (opts ListOpts) ToResourceListQuery() (string, error)

ToResourceListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToResourceListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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