Documentation ¶
Index ¶
- func Delete(client *edgecloud.ServiceClient, id int) (r tasks.Result)
- func ExtractProjectsInto(r pagination.Page, v interface{}) error
- func List(c *edgecloud.ServiceClient) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type GetResult
- type Project
- type ProjectPage
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(client *edgecloud.ServiceClient, id int) (r tasks.Result)
Delete a project
func ExtractProjectsInto ¶
func ExtractProjectsInto(r pagination.Page, v interface{}) error
func List ¶
func List(c *edgecloud.ServiceClient) pagination.Pager
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.
type CreateOptsBuilder ¶
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 ¶
func Create(c *edgecloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new project using the values provided.
func (CreateResult) Extract ¶
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 *edgecloud.ServiceClient, id int) (r GetResult)
Get retrieves a specific project based on its unique ID.
func (GetResult) Extract ¶
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 edgecloud.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.
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.
type UpdateOptsBuilder ¶
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 ¶
func Update(c *edgecloud.ServiceClient, id int, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates an existing project using the values provided.
func (UpdateResult) Extract ¶
Extract is a function that accepts a result and extracts a project resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error