bamboo

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentAssignment

type AgentAssignment struct {
	ExecutorType   string `json:"executorType"`
	ExecutorId     int64  `json:"executorId"`
	ExecutableId   int64  `json:"executableId"`
	ExecutableType string `json:"executableType"`
}

type AgentAssignmentRequest

type AgentAssignmentRequest struct {
	ExecutorType   string `json:"executorType"`
	ExecutorId     int64  `json:"executorId"`
	EntityId       int64  `json:"entityId"`
	AssignmentType string `json:"assignmentType"`
}

type AgentAssignmentService

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

func (*AgentAssignmentService) Create

func (service *AgentAssignmentService) Create(request AgentAssignmentRequest) error

func (*AgentAssignmentService) Delete

func (service *AgentAssignmentService) Delete(request AgentAssignmentRequest) error

func (*AgentAssignmentService) Read

func (service *AgentAssignmentService) Read(request AgentQuery) (*[]AgentAssignment, error)

type AgentQuery

type AgentQuery struct {
	ExecutorType string `json:"executorType"`
	ExecutorId   int64  `json:"executorId"`
}

type Client

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

Client represents the primary entry point for interacting with the Bamboo services. It contains service handlers for the project, deployment, repository and user services.

func NewBambooClient

func NewBambooClient(transport transport.PayloadTransport) *Client

NewBambooClient constructs and returns a new instance of the Client type. The function takes a transport payload that is used to facilitate the underlying communication with the Bamboo services. It initializes each of the service handlers with this transport payload.

func (*Client) AgentAssignmentService

func (client *Client) AgentAssignmentService() *AgentAssignmentService

func (*Client) DeploymentService

func (client *Client) DeploymentService() *DeploymentService

DeploymentService is a getter method that returns the deployment service handler from the Bamboo client. It provides access to deployment services like initiating a deployment, fetching deployment info and more.

func (*Client) PlanService

func (client *Client) PlanService() *PlanService

func (*Client) ProjectService

func (client *Client) ProjectService() *ProjectService

ProjectService is a getter method that returns the project service handler from the Bamboo client. It allows accessibility to the project services like creating, updating, or deleting a project.

func (*Client) RepositoryService

func (client *Client) RepositoryService() *RepositoryService

RepositoryService is a getter method that returns the repository service handler from the Bamboo client. It lets you interact with repository services such as creating, updating, or deleting a repository.

func (*Client) UserService

func (client *Client) UserService() *UserService

UserService is a getter method that returns the user service handler from the Bamboo client. It opens up access to user related services like creating a user, updating user info, or deleting a user.

type CreateDeployment

type CreateDeployment struct {
	Name         string `json:"name,omitempty"`
	PlanKey      Key    `json:"planKey,omitempty"`
	Description  string `json:"description,omitempty"`
	PublicAccess bool   `json:"publicAccess,omitempty"`
}

CreateDeployment struct defines the blueprint for creating a new deployment. Name: the deployment's human-readable display name. PlanKey: a unique ID (key) that identifies the associated build plan. Description: a brief overview of what the deployment is all about. PublicAccess: a flag indicating whether the deployment should be accessible to the public.

type CreatePlan

type CreatePlan struct {
	PlanKey    string
	Name       string
	ProjectKey string
}

type CreateProject

type CreateProject struct {
	Name         string `json:"name,omitempty"`
	Key          string `json:"key,omitempty"`
	Description  string `json:"description,omitempty"`
	PublicAccess bool   `json:"publicAccess,omitempty"`
}

CreateProject is a structure that holds the necessary information need to create a new Bamboo project. This includes properties like Name, Key, Description, and PublicAccess.

type CreateProjectRepository

type CreateProjectRepository struct {
	Project          string
	Name             string
	ProjectKey       string
	RepositorySlug   string
	RepositoryBranch string
	ServerId         string
	ServerName       string
	CloneUrl         string
}

CreateProjectRepository holds the data necessary to create a new repository.

type CreateRepository

type CreateRepository struct {
	Name             string
	ProjectKey       string
	RepositorySlug   string
	RepositoryBranch string
	ServerId         string
	ServerName       string
	CloneUrl         string
}

CreateRepository holds the data necessary to create a new repository.

type CurrentUser

type CurrentUser struct {
	Name     string `json:"name,omitempty"`
	FullName string `json:"fullName,omitempty"`
	Email    string `json:"email,omitempty"`
}

CurrentUser represents the current authenticated user in the system. It includes basic details like name, full name, and email.

type Deployment

type Deployment struct {
	ID                     int           `json:"id,omitempty"`
	Name                   string        `json:"name,omitempty"`
	PlanKey                Key           `json:"planKey,omitempty"`
	Description            string        `json:"description,omitempty"`
	Environments           []Environment `json:"environments,omitempty"`
	RepositorySpecsManaged bool          `json:"repositorySpecsManaged,omitempty"`
}

Deployment struct is an overall view of a single deployment with all necessary details. ID: the unique ID of this deployment. Name: the readable name of this deployment. PlanKey: the unique key that linked to the execution plan of this deployment. Description: Detail information about this deployment. Environments: a list of environment settings associated with this deployment. RepositorySpecsManaged: a flag that shows whether repository settings are managed automatically.

type DeploymentEntity

type DeploymentEntity struct {
	Id          string `json:"id,omitempty"`
	Key         string `json:"key,omitempty"`
	ProjectName string `json:"projectName,omitempty"`
	Description string `json:"description,omitempty"`
}

DeploymentEntity struct is the search entity from DeploymentItem with some extra information. Id: the unique ID of this entity. Key: the unique key of this entity. ProjectName: the name of the project this deployment entity is attached to. Description: A brief description of this entity.

type DeploymentItem

type DeploymentItem struct {
	Id           string           `json:"id,omitempty"`
	Type         string           `json:"type,omitempty"`
	SearchEntity DeploymentEntity `json:"searchEntity,omitempty"`
}

DeploymentItem struct represents a single deployment item in a paginated list response. Id: the unique ID of this deployment. Type: the type of this entity (we don't know the specific types from this code). SearchEntity: detailed information about the deployment.

type DeploymentList

type DeploymentList struct {
	Start     int              `json:"start-index,omitempty"`
	MaxResult int              `json:"max-result,omitempty"`
	Results   []DeploymentItem `json:"searchResults,omitempty"`
}

DeploymentList struct represents a paginated response of deployments from an API. Start: the starting index of the list. MaxResult: the maximum number of results that can be returned. Results: slice of deployment data (DeploymentItem) returned by the search query.

type DeploymentService

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

DeploymentService contains our transport method (transport.PayloadTransport). DeploymentService is used to send requests related to the various operations on Deployment instances.

func (*DeploymentService) AddSpecRepositories

func (service *DeploymentService) AddSpecRepositories(deploymentId int, repositoryId int) (*Repository, error)

The AddSpecRepositories function adds a spec Repository to a Deployment using provided Deployment and Repository IDs.

func (*DeploymentService) Create

func (service *DeploymentService) Create(request CreateDeployment) (*Deployment, error)

The Create function allows creating a new Deployment instance using provided request data. Specifically, it sends an HTTP PUT request to the Deployment endpoint.

func (*DeploymentService) Delete

func (service *DeploymentService) Delete(deploymentId int) error

The Delete function deletes a Deployment instance using its id.

func (*DeploymentService) FindAvailableGroup added in v1.3.13

func (service *DeploymentService) FindAvailableGroup(deploymentId int, groupName string) (*GroupPermission, error)

func (*DeploymentService) FindAvailableUser added in v1.3.13

func (service *DeploymentService) FindAvailableUser(deploymentId int, username string) (*UserPermission, error)

func (*DeploymentService) GetSpecRepositories

func (service *DeploymentService) GetSpecRepositories(deploymentId int) ([]Repository, error)

The GetSpecRepositories function retrieves the spec repository for a given Deployment id.

func (*DeploymentService) Read

func (service *DeploymentService) Read(deploymentName string) (*Deployment, error)

The Read function retrieves a Deployment instance's data using the provided Deployment name.

func (*DeploymentService) ReadPermissions

func (service *DeploymentService) ReadPermissions(deploymentID int) (*ObjectPermission, error)

ReadPermissions function, reading permissions of a deployment, grouping them by users, groups and roles.

func (*DeploymentService) ReadWithId

func (service *DeploymentService) ReadWithId(deploymentId int) (*Deployment, error)

The ReadWithId function retrieves a Deployment instance's data using its ID.

func (*DeploymentService) RemoveSpecRepositories

func (service *DeploymentService) RemoveSpecRepositories(deploymentId int, repositoryId int) error

The RemoveSpecRepositories function removes a spec Repository from the Deployment using the provided Deployment and Repository IDs.

func (*DeploymentService) UpdateGroupPermissions

func (service *DeploymentService) UpdateGroupPermissions(deploymentId int, group string, newPermissions []string) error

UpdateGroupPermissions function, updates group permissions of a deployment.

func (*DeploymentService) UpdateRolePermissions

func (service *DeploymentService) UpdateRolePermissions(deploymentId int, role string, newPermissions []string) error

UpdateRolePermissions function, updates role permissions of a deployment.

func (*DeploymentService) UpdateUserPermissions

func (service *DeploymentService) UpdateUserPermissions(deploymentId int, username string, newPermissions []string) error

UpdateUserPermissions function, updates user permissions of a deployment.

func (*DeploymentService) UpdateWithId

func (service *DeploymentService) UpdateWithId(deploymentId int, request UpdateDeployment) (*Deployment, error)

The UpdateWithId function updates an existing Deployment instance's data using its id and provided request data.

type Environment

type Environment struct {
	ID          int    `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Environment struct represents each environment within a deployment setting. ID: the unique identifier of this environment within the deployment. Name: the Display name of this environment. Description: More detail about what this environment is and why it exists.

type Group

type Group struct {
	Name string `json:"name,omitempty"`
}

Group represents a user group in the system. Groups are typically used for managing a collection of users with common characteristics or permissions.

type GroupPermission

type GroupPermission struct {
	Name        string   `json:"name,omitempty"`        // Name of the group.
	Editable    bool     `json:"editable,omitempty"`    // Indicates if the permission is editable.
	Permissions []string `json:"permissions,omitempty"` // List of permissions.
}

GroupPermission struct represents a group's permissions.

func (*GroupPermission) DeltaPermissions

func (g *GroupPermission) DeltaPermissions(newPermissions []string) ([]string, []string)

DeltaPermissions compares current permissions with new ones, returning additions and removals.

type GroupPermissionResponse

type GroupPermissionResponse struct {
	Start   int               `json:"start,omitempty"`   // Starting index of the result set.
	Limit   int               `json:"limit,omitempty"`   // Limit on the number of results.
	Results []GroupPermission `json:"results,omitempty"` // Actual group permissions.
}

GroupPermissionResponse struct represents the response format for group permissions.

func (*GroupPermissionResponse) Find

func (permissions *GroupPermissionResponse) Find(groupName string) PermissionsComparator

Find locates a group by name and returns it as a PermissionsComparator.

type GroupResponse

type GroupResponse struct {
	Results []Group `json:"results,omitempty"`
}

GroupResponse is used to encapsulate a response containing multiple groups. It is often used in API responses where a list of groups is returned.

type Key

type Key struct {
	Key string `json:"key"`
}

Key struct defines our key data type, which seems to represent some sort of unique ID.

type ObjectPermission

type ObjectPermission struct {
	Groups []GroupPermission
	Users  []UserPermission
	Roles  []RolePermission
}

ObjectPermission struct holds permission data for groups, users, and roles.

type PermissionResponse

type PermissionResponse interface {
	Find(key string) PermissionsComparator
}

PermissionResponse interface defines a method for finding a PermissionsComparator based on a key.

type PermissionsComparator

type PermissionsComparator interface {
	DeltaPermissions(permissions []string) ([]string, []string)
}

PermissionsComparator interface defines a method for comparing permissions.

type PermissionsHelper

type PermissionsHelper struct {
	Transport   transport.PayloadTransport
	Url         string
	Permissions []string
}

PermissionsHelper is a struct that assists in managing permissions. It uses a transport layer for API communications and maintains a URL and a list of permissions.

func (PermissionsHelper) AddPermissions

func (helper PermissionsHelper) AddPermissions() error

AddPermissions sends a PUT request to add permissions. If there are permissions to add, it returns the result of the transport operation, otherwise nil.

func (PermissionsHelper) ReadGroupPermissions

func (helper PermissionsHelper) ReadGroupPermissions() (*GroupPermissionResponse, error)

ReadGroupPermissions fetches group permissions and returns them in a GroupPermissionResponse struct. It returns an error if the operation fails.

func (PermissionsHelper) ReadRolePermissions

func (helper PermissionsHelper) ReadRolePermissions() (*RolePermissionResponse, error)

ReadRolePermissions works similarly to ReadGroupPermissions but for role permissions.

func (PermissionsHelper) ReadUserPermissions

func (helper PermissionsHelper) ReadUserPermissions() (*UserPermissionResponse, error)

ReadUserPermissions works similarly to ReadGroupPermissions but for user permissions.

func (PermissionsHelper) RemovePermissions

func (helper PermissionsHelper) RemovePermissions() error

RemovePermissions sends a DELETE request to remove permissions. If there are permissions to remove, it returns the result of the transport operation, otherwise nil.

type Plan

type Plan struct {
	ProjectKey  string `json:"projectKey,omitempty"`
	ProjectName string `json:"projectName,omitempty"`
	Description string `json:"description,omitempty"`
	Id          int64  `json:"id,omitempty"`
	Key         string `json:"key,omitempty"`
	ShortKey    string `json:"shortKey,omitempty"`
	ShortName   string `json:"shortName,omitempty"`
	Name        string `json:"name,omitempty"`
}

Plan is a structure that represents a Bamboo build plan -- a collection of related build jobs. This includes properties like ProjectKey, ProjectName, Description, Key, ShortName, and Name.

type PlanService

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

func (*PlanService) Create

func (service *PlanService) Create(request CreatePlan) (*Plan, error)

func (*PlanService) Delete

func (service *PlanService) Delete(planKey string) error

func (*PlanService) Read

func (service *PlanService) Read(planKey string) (*Plan, error)

The ReadPlan function fetches the details of a plan given its key. A plan in Bamboo defines a single build, including source code repository, optional triggers, commands to execute, and test results to collect.

type Project

type Project struct {
	Key         string `json:"key,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Project is a structure representing a Bamboo project as returned by the API. This includes properties like Key, Name, and Description.

type ProjectRepositoryList

type ProjectRepositoryList struct {
	Start     int          `json:"start-index,omitempty"`
	MaxResult int          `json:"max-result,omitempty"`
	Results   []Repository `json:"results,omitempty"`
}

type ProjectService

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

ProjectService is a key struct in this package. This struct holds a client that sends HTTP requests and receives HTTP responses. We will use instances of ProjectService to perform operations on Bamboo servers.

func (*ProjectService) AddSpecRepositories

func (service *ProjectService) AddSpecRepositories(projectKey string, repositoryId int) (*Repository, error)

The AddSpecRepositories function adds a new repository to a given project. It sends a POST request to add a new repository to a project and returns the repository if addition is successful.

func (*ProjectService) Create

func (service *ProjectService) Create(request CreateProject) (*Project, error)

The Create function allows us to create a new project in Bamboo. It receives project data as input and returns the newly created project if everything goes okay.

func (*ProjectService) Delete

func (service *ProjectService) Delete(projectKey string) error

Delete is another method on ProjectService. It sends a DELETE request to delete the project specified by the provided projectKey. It returns error (if any) that occurred during the deletion.

func (*ProjectService) DeleteVariables

func (service *ProjectService) DeleteVariables(projectKey string, key string) error

func (*ProjectService) FindAvailableGroup added in v1.3.13

func (service *ProjectService) FindAvailableGroup(projectKey string, groupName string) (*GroupPermission, error)

func (*ProjectService) FindAvailableUser added in v1.3.13

func (service *ProjectService) FindAvailableUser(projectKey string, username string) (*UserPermission, error)

func (*ProjectService) GetSpecRepositories

func (service *ProjectService) GetSpecRepositories(projectKey string) ([]Repository, error)

The GetSpecRepositories function fetches the repositories of a given project. It sends a GET request to fetch the repositories and returns them if everything works out.

func (*ProjectService) GetVariables

func (service *ProjectService) GetVariables(projectKey string, key string) (string, error)

func (*ProjectService) PutVariables

func (service *ProjectService) PutVariables(projectKey string, key string, value string) error

func (*ProjectService) Read

func (service *ProjectService) Read(projectKey string) (*Project, error)

The Read function fetches the details of a project given its key.

func (*ProjectService) ReadPermissions

func (service *ProjectService) ReadPermissions(projectKey string) (*ObjectPermission, error)

ReadPermissions reads the permissions for a project.

func (*ProjectService) RemoveSpecRepositories

func (service *ProjectService) RemoveSpecRepositories(projectKey string, repositoryId int) error

The RemoveSpecRepositories function removes a repository from a given project. It sends a DELETE request to remove a repository from a project and returns an error if the operation is unsuccessful.

func (*ProjectService) Update

func (service *ProjectService) Update(projectKey string, update UpdateProject) (*Project, error)

Update is a method on the ProjectService struct. It sends a PUT request to update the project. projectKey is a unique identifier for a project and update is the data that needs to be updated. The function will return the updated project or any error occurred during the process.

func (*ProjectService) UpdateGroupPermissions

func (service *ProjectService) UpdateGroupPermissions(projectKey string, groupName string, newPermissions []string) error

UpdateGroupPermissions updates the group permissions.

func (*ProjectService) UpdateRolePermissions

func (service *ProjectService) UpdateRolePermissions(projectKey string, role string, newPermissions []string) error

UpdateRolePermissions updates the permissions of a role.

func (*ProjectService) UpdateUserPermissions

func (service *ProjectService) UpdateUserPermissions(projectKey string, username string, newPermissions []string) error

UpdateUserPermissions updates the permissions of a user.

type Repository

type Repository struct {
	ID         int    `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	RssEnabled bool   `json:"rssEnabled,omitempty"`
}

Repository is a struct that holds information related to a single Bamboo repository. Each repository is identified by a unique 'ID', 'Name' field is the name given to that repository and 'RssEnabled' indicates whether RSS feed option is enabled or not for that repository.

type RepositoryList

type RepositoryList struct {
	Start     int          `json:"start-index,omitempty"`
	MaxResult int          `json:"max-result,omitempty"`
	Results   []Repository `json:"searchResults,omitempty"`
}

RepositoryList is a struct that holds information about a list of repositories in Bamboo. It is especially useful in managing queries related to multiple repositories at once. Not all repositories will be returned when queried; the 'Start' parameter helps us by defining where to start indexing from, and 'MaxResult' defines the maximum number of repository results we want to fetch.

type RepositoryService

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

RepositoryService is a struct that provides methods to interact with repositories. It contains a transport mechanism for API calls.

func (*RepositoryService) AddAccessor

func (service *RepositoryService) AddAccessor(repositoryId int, accessorId int) (*Repository, error)

AddAccessor adds an accessor (another repository) to a specific repository. It returns the updated repository or nil if the operation is not successful.

func (*RepositoryService) Create

func (service *RepositoryService) Create(create CreateRepository) (int, error)

Create initializes a new repository with the specified parameters. It returns the created repository's ID or an error if the creation fails.

func (*RepositoryService) CreateProject

func (service *RepositoryService) CreateProject(create CreateProjectRepository) (int, error)

func (*RepositoryService) Delete added in v1.3.17

func (service *RepositoryService) Delete(repositoryId int) error

func (*RepositoryService) DeleteProject added in v1.3.17

func (service *RepositoryService) DeleteProject(project string, repositoryId int) error

func (*RepositoryService) EnableCI

func (service *RepositoryService) EnableCI(repositoryId int, enableCi bool) error

EnableCI enables or disables Continuous Integration (CI) for a specified repository.

func (*RepositoryService) FindAvailableGroup added in v1.3.13

func (service *RepositoryService) FindAvailableGroup(repositoryId int, groupName string) (*GroupPermission, error)

func (*RepositoryService) FindAvailableUser added in v1.3.13

func (service *RepositoryService) FindAvailableUser(repositoryId int, username string) (*UserPermission, error)

func (*RepositoryService) Read

func (service *RepositoryService) Read(name string) (*Repository, error)

Read searches for and retrieves a repository by its name. It returns the found repository or nil if no repository is found.

func (*RepositoryService) ReadAccessor

func (service *RepositoryService) ReadAccessor(repositoryId int) ([]Repository, error)

ReadAccessor retrieves a list of repositories that a specific repository has access to.

func (*RepositoryService) ReadPermissions

func (service *RepositoryService) ReadPermissions(repositoryId int) (*ObjectPermission, error)

ReadPermissions retrieves permissions for a specific repository. It combines group, user, and role permissions into a single ObjectPermission.

func (*RepositoryService) ReadProject

func (service *RepositoryService) ReadProject(project string, name string) (*Repository, error)

func (*RepositoryService) RemoveAccessor

func (service *RepositoryService) RemoveAccessor(repositoryId int, accessorId int) error

RemoveAccessor removes an accessor (another repository) from a specific repository.

func (*RepositoryService) ScanCI

func (service *RepositoryService) ScanCI(repositoryId int) error

func (*RepositoryService) Update

func (service *RepositoryService) Update(repositoryId int, request CreateRepository) error

func (*RepositoryService) UpdateGroupPermissions

func (service *RepositoryService) UpdateGroupPermissions(repositoryId int, group string, newPermissions []string) error

UpdateGroupPermissions updates the permissions of a group within a repository. It handles the addition and removal of permissions based on the current state and the desired new permissions.

func (*RepositoryService) UpdateProject

func (service *RepositoryService) UpdateProject(repositoryId int, request CreateProjectRepository) error

func (*RepositoryService) UpdateRolePermissions

func (service *RepositoryService) UpdateRolePermissions(repositoryId int, role string, newPermissions []string) error

UpdateRolePermissions updates the permissions of a role within a repository. It follows the same pattern as updating group and user permissions.

func (*RepositoryService) UpdateUserPermissions

func (service *RepositoryService) UpdateUserPermissions(repositoryId int, username string, newPermissions []string) error

UpdateUserPermissions updates the permissions of a user within a repository. Similar to UpdateGroupPermissions, it handles the changes based on current and new permissions.

type RolePermission

type RolePermission struct {
	Name        string   `json:"name,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

RolePermission struct represents a role's permissions.

func (*RolePermission) DeltaPermissions

func (u *RolePermission) DeltaPermissions(newPermissions []string) ([]string, []string)

DeltaPermissions compares current permissions with new ones, returning additions and removals.

type RolePermissionResponse

type RolePermissionResponse struct {
	Start   int              `json:"start,omitempty"`
	Limit   int              `json:"limit,omitempty"`
	Results []RolePermission `json:"results,omitempty"`
}

RolePermissionResponse struct represents the response format for role permissions.

func (*RolePermissionResponse) Find

func (permissions *RolePermissionResponse) Find(roleName string) PermissionsComparator

Find locates a role by name and returns it as a PermissionsComparator.

type UpdateDeployment

type UpdateDeployment struct {
	Name        string `json:"name,omitempty"`
	PlanKey     Key    `json:"planKey,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateDeployment struct shares similar fields with CreateDeployment, but it's for updating an existing deployment rather than creating a new one.

type UpdateProject

type UpdateProject struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateProject is a structure that holds information needed to update an existing Bamboo project. This includes properties like Name and Description.

type User

type User struct {
	Name string `json:"name,omitempty"`
}

User represents a user in the system. It is a simpler structure compared to CurrentUser, containing only the name.

type UserPermission

type UserPermission struct {
	Name        string   `json:"name,omitempty"`
	FullName    string   `json:"fullName,omitempty"`
	Email       string   `json:"email,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

UserPermission struct represents a user's permissions.

func (*UserPermission) DeltaPermissions

func (u *UserPermission) DeltaPermissions(newPermissions []string) ([]string, []string)

DeltaPermissions compares current permissions with new ones, returning additions and removals.

type UserPermissionResponse

type UserPermissionResponse struct {
	Start   int              `json:"start,omitempty"`
	Limit   int              `json:"limit,omitempty"`
	Results []UserPermission `json:"results,omitempty"`
}

UserPermissionResponse struct represents the response format for user permissions.

func (*UserPermissionResponse) Find

func (permissions *UserPermissionResponse) Find(userName string) PermissionsComparator

Find locates a user by name and returns it as a PermissionsComparator.

type UserResponse

type UserResponse struct {
	Results []User `json:"results,omitempty"`
}

UserResponse is used to encapsulate a response containing multiple users. It is typically used in API responses where a list of users is returned.

type UserService

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

UserService struct represents a service to interact with user-related functionalities. It uses a PayloadTransport from the transport package for API communication.

func NewUserService added in v1.3.13

func NewUserService(transport transport.PayloadTransport) *UserService

func (*UserService) CurrentUser

func (service *UserService) CurrentUser() (*CurrentUser, error)

CurrentUser retrieves the current user's information. It returns a pointer to a CurrentUser object or an error.

func (*UserService) FindGroup

func (service *UserService) FindGroup(group string) (*Group, error)

FindGroup searches for a group by its name. It returns a pointer to a Group object or an error.

func (*UserService) FindUser

func (service *UserService) FindUser(user string) (*User, error)

FindUser searches for a user by their username. It returns a pointer to a User object or an error.

func (*UserService) LookupGroup added in v1.3.13

func (service *UserService) LookupGroup(group string) bool

func (*UserService) LookupUser added in v1.3.13

func (service *UserService) LookupUser(user string) bool

func (*UserService) ValidateGroup added in v1.3.13

func (service *UserService) ValidateGroup(group string)

func (*UserService) ValidateUser added in v1.3.13

func (service *UserService) ValidateUser(user string)

type Variable

type Variable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type XFormPayload added in v1.3.17

type XFormPayload struct {
	Data string
}

XYamlPayload struct represents a payload with YAML data. It is intended to be used with API requests or responses where the data content is in YAML format.

func (*XFormPayload) Accept added in v1.3.17

func (m *XFormPayload) Accept() string

Accept returns the MIME type that this payload expects to receive. Here, it is set to 'application/json', indicating that the payload expects to receive JSON-formatted data.

func (*XFormPayload) Content added in v1.3.17

func (m *XFormPayload) Content() ([]byte, error)

Content returns the payload data as a byte slice and an error. In this implementation, it simply converts the YAML string to a byte slice and returns no error.

func (*XFormPayload) ContentMust added in v1.3.17

func (m *XFormPayload) ContentMust() []byte

ContentMust returns the payload data as a byte slice. This method is a 'must' version, meaning it assumes the operation will always succeed and does not return an error.

func (*XFormPayload) ContentType added in v1.3.17

func (m *XFormPayload) ContentType() string

ContentType returns the MIME type of the content this payload contains. In this case, it returns 'application/x-yaml', indicating the content type is YAML.

type XYamlPayload

type XYamlPayload struct {
	Data string
}

XYamlPayload struct represents a payload with YAML data. It is intended to be used with API requests or responses where the data content is in YAML format.

func (*XYamlPayload) Accept

func (m *XYamlPayload) Accept() string

Accept returns the MIME type that this payload expects to receive. Here, it is set to 'application/json', indicating that the payload expects to receive JSON-formatted data.

func (*XYamlPayload) Content

func (m *XYamlPayload) Content() ([]byte, error)

Content returns the payload data as a byte slice and an error. In this implementation, it simply converts the YAML string to a byte slice and returns no error.

func (*XYamlPayload) ContentMust

func (m *XYamlPayload) ContentMust() []byte

ContentMust returns the payload data as a byte slice. This method is a 'must' version, meaning it assumes the operation will always succeed and does not return an error.

func (*XYamlPayload) ContentType

func (m *XYamlPayload) ContentType() string

ContentType returns the MIME type of the content this payload contains. In this case, it returns 'application/x-yaml', indicating the content type is YAML.

Jump to

Keyboard shortcuts

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