iam

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() (*Client, error)

NewClient creates a new IAM client.

func (*Client) CreateLocalUser

func (c *Client) CreateLocalUser(user LocalUser) (*UserClient, error)

CreateLocalUser creates a new local user in the system.

Parameters:

user - The LocalUser struct containing the details of the user to be created.

Returns:

*User - A pointer to the created User struct.
error - An error if the creation or validation fails, otherwise nil.

func (*Client) CreateSAMLUser

func (c *Client) CreateSAMLUser(user SAMLUser) (*UserClient, error)

CreateSAMLUser creates a new SAML user in the system. It takes a SAMLUser object as input and returns a pointer to the created User object and an error, if any.

Parameters:

  • user: SAMLUser object containing the details of the user to be created.

Returns:

  • *User: Pointer to the created User object.
  • error: Error, if any occurred during the creation process.

func (*Client) GetUser

func (c *Client) GetUser(nameOrID string) (*UserClient, error)

GetUser retrieves a user by their name or ID. GetUser permit to retrieve a local or SAML user by their name or ID.

Parameters:

  • nameOrID: The name or ID of the user to retrieve.

Returns:

  • A pointer to the User object if found, or an error if any issues occur during the process.

type LocalUser

type LocalUser struct {
	User `validate:"required"`

	// REQUIRED: The password of the user.
	Password string `validate:"required,min=6"`
}

type SAMLUser

type SAMLUser struct {
	User `validate:"required"`
}

type User

type User struct {
	// REQUIRED: The name of the user.
	Name     string `validate:"required,disallow_upper,disallow_space"`
	RoleName string `validate:"required"`

	// OPTIONAL
	Description     string `validate:"omitempty"`
	FullName        string `validate:"omitempty"`
	Email           string `validate:"omitempty,email"`
	Telephone       string `validate:"omitempty"`
	Enabled         bool
	DeployedVMQuota int // 0 means unlimited
	StoredVMQuota   int // 0 means unlimited

	// READ-ONLY
	ID   string
	Type UserType
}

func (User) GetRoleName

func (u User) GetRoleName() string

GetRoleName returns the role name of the user.

type UserClient

type UserClient struct {

	// Data
	User User
	// contains filtered or unexported fields
}

func (*UserClient) ChangePassword

func (u *UserClient) ChangePassword(password string) error

ChangePassword changes the password of a user.

func (*UserClient) Delete

func (u *UserClient) Delete(takeOwnership bool) error

Delete deletes a user from the system.

func (*UserClient) Disable

func (u *UserClient) Disable() error

Disable disables a user if it was enabled. Fails otherwise.

func (*UserClient) Enable

func (u *UserClient) Enable() error

Enable enables a user if it was disabled. Fails otherwise.

func (*UserClient) Unlock

func (u *UserClient) Unlock() error

Unlock unlocks a user if it was locked. Fails otherwise.

func (*UserClient) Update

func (u *UserClient) Update() error

Update updates the user information in the system. Returns an error if the update operation fails.

type UserType

type UserType string

UserType is a type of user.

const (
	// UserTypeLocal is the type of the user.
	UserTypeLocal UserType = govcd.OrgUserProviderIntegrated
	// UserTypeSAML is the type of the user.
	UserTypeSAML UserType = govcd.OrgUserProviderSAML
)

Directories

Path Synopsis
Package mock_iam is a generated GoMock package.
Package mock_iam is a generated GoMock package.

Jump to

Keyboard shortcuts

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