users

package
v2.41.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByID added in v2.33.0

func DeleteByID(client newclient.Client, id string) error

DeleteByID deletes the resource that matches the space ID and input ID.

func Get added in v2.33.0

func Get(client newclient.Client, spaceID string, usersQuery UsersQuery) (*resources.Resources[*User], error)

Get returns a collection of users based on the criteria defined by its input query parameter. If an error occurs, an empty collection is returned along with the associated error.

func IsNil

func IsNil(i interface{}) bool

Types

type APIKey

type APIKey struct {
	APIKey  *APIKeyStruct `json:"ApiKey,omitempty"`
	Created *time.Time    `json:"Created,omitempty"`
	Purpose string        `json:"Purpose,omitempty"`
	UserID  string        `json:"UserId,omitempty"`
	Expires *time.Time    `json:"Expires,omitempty"`

	resources.Resource
}

APIKey represents an API key returned from a GET request

type APIKeyStruct added in v2.34.0

type APIKeyStruct struct {
	HasValue bool   `json:"HasValue"`
	NewValue string `json:"NewValue,omitempty"`
	Hint     string `json:"Hint"`
}

type APIQuery

type APIQuery struct {
	Skip int `uri:"skip,omitempty" url:"skip,omitempty"`
	Take int `uri:"take,omitempty" url:"take,omitempty"`
}

type ApiKeyService

type ApiKeyService struct {
	services.Service
}

ApiKeyService handles communication with API key-related methods of the Octopus API.

func NewAPIKeyService

func NewAPIKeyService(sling *sling.Sling, uriTemplate string) *ApiKeyService

NewAPIKeyService returns an ApiKeyService with a preconfigured client.

func (*ApiKeyService) Create

func (s *ApiKeyService) Create(apiKey *CreateAPIKey) (*CreateAPIKey, error)

Create generates a new API key for the specified user ID. The API key returned in the result must be saved by the caller, as it cannot be retrieved subsequently from the Octopus server.

func (*ApiKeyService) GetByID

func (s *ApiKeyService) GetByID(userID string, apiKeyID string) (*APIKey, error)

GetByID the API key that belongs to the user by its ID.

func (*ApiKeyService) GetByUserID

func (s *ApiKeyService) GetByUserID(userID string) ([]*APIKey, error)

GetByUserID lists all API keys for a user, returning the most recent results first.

type CreateAPIKey added in v2.34.0

type CreateAPIKey struct {
	APIKey  string     `json:"ApiKey,omitempty"`
	Created *time.Time `json:"Created,omitempty"`
	Purpose string     `json:"Purpose,omitempty"`
	UserID  string     `json:"UserId,omitempty"`
	Expires *time.Time `json:"Expires,omitempty"`

	resources.Resource
}

CreateAPIKey represents an API key when creating a new API key (POST)

func NewAPIKey

func NewAPIKey(purpose string, userID string) *CreateAPIKey

NewAPIKey initializes an API key with a purpose.

type ExternalUserSearchQuery

type ExternalUserSearchQuery struct {
	PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"`
}

type Identity

type Identity struct {
	Claims               map[string]IdentityClaim `json:"Claims,omitempty"`
	IdentityProviderName string                   `json:"IdentityProviderName,omitempty"`
}

type IdentityClaim

type IdentityClaim struct {
	IsIdentifyingClaim bool   `json:"IsIdentifyingClaim"`
	Value              string `json:"Value,omitempty"`
}

type SignInQuery

type SignInQuery struct {
	ReturnURL string `uri:"returnUrl,omitempty" url:"returnUrl,omitempty"`
}

type User

type User struct {
	CanPasswordBeEdited bool       `json:"CanPasswordBeEdited"`
	DisplayName         string     `json:"DisplayName,omitempty"`
	EmailAddress        string     `json:"EmailAddress,omitempty"`
	Identities          []Identity `json:"Identities,omitempty"`
	IsActive            bool       `json:"IsActive"`
	IsRequestor         bool       `json:"IsRequestor"`
	IsService           bool       `json:"IsService"`
	Password            string     `json:"Password,omitempty" validate:"max=20"`
	Username            string     `json:"Username,omitempty"`

	resources.Resource
}

User represents a user in Octopus.

func Add added in v2.33.0

func Add(client newclient.Client, user *User) (*User, error)

Add creates a new user.

func GetByID added in v2.33.0

func GetByID(client newclient.Client, id string) (*User, error)

GetByID returns the user that matches the input ID. If one cannot be found, it returns nil and an error.

func NewUser

func NewUser(username string, displayName string) *User

NewUser initializes a user with an username and a display name.

func Update added in v2.33.0

func Update(client newclient.Client, user *User) (*User, error)

Update modifies a user based on the one provided as input.

type UserAuthentication

type UserAuthentication struct {
	AuthenticationProviders             []authentication.AuthenticationProviderElement
	CanCurrentUserEditIdentitiesForUser bool
	Links                               map[string]string
}

UserAuthentication represents enabled authentication providers and whether the current user can edit logins for the given user.

type UserQuery

type UserQuery struct {
	IncludeSystem bool     `uri:"includeSystem,omitempty" url:"includeSystem,omitempty"`
	Spaces        []string `uri:"spaces,omitempty" url:"spaces,omitempty"`
}

type UserService

type UserService struct {
	services.CanDeleteService
	// contains filtered or unexported fields
}

func NewUserService

func NewUserService(
	sling *sling.Sling,
	uriTemplate string,
	apiKeysPath string,
	authenticateOctopusIDPath string,
	currentUserPath string,
	externalUserSearchPath string,
	registerPath string,
	signInPath string,
	signOutPath string,
	userAuthenticationPath string,
	userIdentityMetadataPath string) *UserService

func (*UserService) Add deprecated

func (s *UserService) Add(user *User) (*User, error)

Add creates a new user.

Deprecated: Use users.Add

func (*UserService) Get deprecated

func (s *UserService) Get(usersQuery UsersQuery) (*resources.Resources[*User], error)

Get returns a collection of users based on the criteria defined by its input query parameter. If an error occurs, an empty collection is returned along with the associated error.

Deprecated: Use users.Get

func (*UserService) GetAPIKeyByID

func (s *UserService) GetAPIKeyByID(user *User, apiKeyID string) (*APIKey, error)

func (*UserService) GetAPIKeys

func (s *UserService) GetAPIKeys(user *User, apiQuery ...APIQuery) (*resources.Resources[*APIKey], error)

func (*UserService) GetAll

func (s *UserService) GetAll() ([]*User, error)

GetAll returns all users. If none can be found or an error occurs, it returns an empty collection.

func (*UserService) GetAuthentication

func (s *UserService) GetAuthentication() (*UserAuthentication, error)

func (*UserService) GetAuthenticationByUser

func (s *UserService) GetAuthenticationByUser(user *User) (*UserAuthentication, error)

func (*UserService) GetByID deprecated

func (s *UserService) GetByID(id string) (*User, error)

GetByID returns the user that matches the input ID. If one cannot be found, it returns nil and an error.

Deprecated: Use users.GetByID

func (*UserService) GetMe

func (s *UserService) GetMe() (*User, error)

GetMe returns the user associated with the key used to invoke this API.

func (*UserService) GetPermissions

func (s *UserService) GetPermissions(user *User, userQuery ...UserQuery) (*permissions.UserPermissionSet, error)

func (*UserService) GetPermissionsConfiguration

func (s *UserService) GetPermissionsConfiguration(user *User, userQuery ...UserQuery) (*permissions.UserPermissionSet, error)

func (*UserService) GetSpaces

func (s *UserService) GetSpaces(user *User) ([]*spaces.Space, error)

func (*UserService) GetTeams

func (s *UserService) GetTeams(user *User, userQuery ...UserQuery) (*[]permissions.ProjectedTeamReferenceDataItem, error)

func (*UserService) Update deprecated

func (s *UserService) Update(user *User) (*User, error)

Update modifies a user based on the one provided as input.

Deprecated: Use users.Update

type UsersQuery

type UsersQuery struct {
	Filter string   `uri:"filter,omitempty" url:"filter,omitempty"`
	IDs    []string `uri:"ids,omitempty" url:"ids,omitempty"`
	Skip   int      `uri:"skip,omitempty" url:"skip,omitempty"`
	Take   int      `uri:"take,omitempty" url:"take,omitempty"`
}

Jump to

Keyboard shortcuts

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