projects

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateProjectRequest

type CreateProjectRequest struct {
	Name     string            `json:"name"`
	ParentID string            `json:"containerParentId"`
	Members  []ProjectMember   `json:"members"`
	Labels   map[string]string `json:"labels"`
}

CreateProjectRequest is the structure representing the request body for creating a project

type MandatoryLabels

type MandatoryLabels struct {
	BillingReference string `json:"billingReference"`
	Scope            string `json:"scope"`
}

MandatoryLabels represent the project's mandatory labels

func (*MandatoryLabels) ToMap

func (m *MandatoryLabels) ToMap() map[string]string

type Parent

type Parent struct {
	ID          string `json:"id"`
	ContainerID string `json:"containerId"` // User friendly container ID
	Type        string `json:"type"`        // ORGANIZATION or FOLDER
}

Parent represents a project's parent details

type ProjectMember

type ProjectMember struct {
	Role    string `json:"role"`
	Subject string `json:"subject"` // email address
}

ProjectMember is the structure representing a member of a project role can be one of "project.owner" "project.member" "project.admin" "project.auditor" the subject is the email address

type ProjectResponse

type ProjectResponse struct {
	Name           string            `json:"name"`
	Parent         Parent            `json:"parent"`
	ContainerID    string            `json:"containerId"` // Globally unique, user friendly identifier
	ProjectID      string            `json:"projectId"`   // Legacy identifier
	LifecycleState string            `json:"lifecycleState"`
	Labels         map[string]string `json:"labels"`
	UpdateTime     string            `json:"updateTime"`
	CreationTime   string            `json:"creationTime"`
}

ProjectResponse is the structure representing the server response for a project

type ProjectsResponse

type ProjectsResponse struct {
	Iteams []ProjectResponse `json:"items"`
	Offset int               `json:"offset"`
	Limit  int               `json:"limit"`
}

ProjectsResponse is the List (get all) projects response from the API

type ProjectsService

type ProjectsService common.Service

ProjectsService is the service that handles CRUD functionality for STACKIT projects

func New

New returns a new handler for the service

func (*ProjectsService) Create

func (svc *ProjectsService) Create(ctx context.Context, parentContainerID, projectName string, labels map[string]string, members ...ProjectMember) (res ProjectResponse, w *wait.Handler, err error)

Create creates a new STACKIT project See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/post-projects

func (*ProjectsService) Delete

func (svc *ProjectsService) Delete(ctx context.Context, containerID string) (w *wait.Handler, err error)

Delete deletes a project by ID See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/delete-projects-containerId

func (*ProjectsService) Get

func (svc *ProjectsService) Get(ctx context.Context, containerID string) (res ProjectResponse, err error)

Get returns the project by id See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/get-projects-containerId

func (*ProjectsService) GetLifecycleState

func (svc *ProjectsService) GetLifecycleState(ctx context.Context, containerID string) (string, error)

GetLifecycleState returns the project state See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/get-projects-containerId

func (*ProjectsService) List

func (svc *ProjectsService) List(ctx context.Context, containerParentID string, filters map[string]string, containerIDs ...string) (res ProjectsResponse, err error)

List returns a list of projects if containerParentID == "" at least one containerID needs to be specified (and vice versa) See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/get-all-projects

func (*ProjectsService) Update

func (svc *ProjectsService) Update(ctx context.Context, containerParentID, containerID, name string, labels map[string]string) (res ProjectResponse, err error)

Update updates an existing STACKIT project See also https://api.stackit.schwarz/resource-management/openapi.v2.html#operation/patch-projects-containerId

func (*ProjectsService) ValidateCreateData

func (svc *ProjectsService) ValidateCreateData(name string, labels map[string]string, members []ProjectMember) error

ValidateCreateData validates the data required for creating a project

func (*ProjectsService) ValidateList

func (svc *ProjectsService) ValidateList(containerParentID string, containerIDs []string, offset, limit, creationTime string) error

ValidateList validates the filters & container information required for listing projects

func (*ProjectsService) ValidateUpdateData

func (svc *ProjectsService) ValidateUpdateData(containerID, containerParentID, name string, labels map[string]string) error

ValidateUpdateData validates the data required for updating a project

type UpdateProjectRequest

type UpdateProjectRequest struct {
	Name              string            `json:"name"`
	ContainerParentID string            `json:"containerParentId"`
	Labels            map[string]string `json:"labels"`
}

UpdateProjectRequest is the update request structure

Jump to

Keyboard shortcuts

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