projects

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *gcorecloud.ServiceClient, id int) (r tasks.Result)

Delete a project

func ExtractProjectsInto

func ExtractProjectsInto(r pagination.Page, v interface{}) error

Types

type CreateOpts

type CreateOpts struct {
	ClientID    int                `json:"client_id,omitempty"`
	State       types.ProjectState `json:"state,omitempty"`
	Name        string             `json:"name" required:"true" validate:"required"`
	Description string             `json:"description,omitempty"`
}

CreateOpts represents options used to create a project.

func (CreateOpts) ToProjectCreateMap

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

ToProjectCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToProjectCreateMap() (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 represents the result of a create operation. Call its Extract method to interpret it as a Project.

func Create

Create accepts a CreateOpts struct and creates a new project using the values provided.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Project, error)

Extract is a function that accepts a result and extracts a project resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Project.

func Get

func Get(c *gcorecloud.ServiceClient, id int) (r GetResult)

Get retrieves a specific project based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Project, error)

Extract is a function that accepts a result and extracts a project resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type Project

type Project struct {
	ID          int                       `json:"id"`
	ClientID    int                       `json:"client_id"`
	Name        string                    `json:"name"`
	Description string                    `json:"description"`
	State       types.ProjectState        `json:"state"`
	TaskID      *string                   `json:"task_id"`
	CreatedAt   gcorecloud.JSONRFC3339NoZ `json:"created_at"`
}

Project represents a project structure.

func ExtractProjects

func ExtractProjects(r pagination.Page) ([]Project, error)

ExtractProject accepts a Page struct, specifically a ProjectPage struct, and extracts the elements into a slice of Project structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *gcorecloud.ServiceClient) ([]Project, error)

ListAll is a convenience function that returns all projects.

type ProjectPage

type ProjectPage struct {
	pagination.LinkedPageBase
}

ProjectPage is the page returned by a pager when traversing over a collection of projects.

func (ProjectPage) IsEmpty

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

IsEmpty checks whether a ProjectPage struct is empty.

func (ProjectPage) NextPageURL

func (r ProjectPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of projects has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type UpdateOpts

type UpdateOpts struct {
	Name        string `json:"name,omitempty" validate:"required_without_all=Description"`
	Description string `json:"description,omitempty" validate:"required_without_all=Name"`
}

UpdateOpts represents options used to update a project.

func (UpdateOpts) ToProjectUpdateMap

func (opts UpdateOpts) ToProjectUpdateMap() (map[string]interface{}, error)

ToProjectUpdateMap builds a request body from UpdateOpts.

func (UpdateOpts) Validate

func (opts UpdateOpts) Validate() error

Validate

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToProjectUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Project.

func Update

Update accepts a UpdateOpts struct and updates an existing project using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Project, error)

Extract is a function that accepts a result and extracts a project resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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