users

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(i interface{}) bool

Types

type APIKey

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

	resources.Resource
}

APIKey represents an API key.

func NewAPIKey

func NewAPIKey(purpose string, userID string) *APIKey

NewAPIKey initializes an API key with a purpose.

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 *APIKey) (*APIKey, 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 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,omitempty"`
	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,omitempty"`
	DisplayName         string     `json:"DisplayName,omitempty"`
	EmailAddress        string     `json:"EmailAddress,omitempty"`
	Identities          []Identity `json:"Identities,omitempty"`
	IsActive            bool       `json:"IsActive,omitempty"`
	IsRequestor         bool       `json:"IsRequestor,omitempty"`
	IsService           bool       `json:"IsService,omitempty"`
	Password            string     `json:"Password,omitempty" validate:"max=20"`
	Username            string     `json:"Username,omitempty"`

	resources.Resource
}

User represents a user in Octopus.

func NewUser

func NewUser(username string, displayName string) *User

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

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

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

Add creates a new user.

func (*UserService) Get

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.

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

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.

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

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

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

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