client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL                 = "https://cloud.tenable.com"
	BaseUsersPath           = "/users"
	UserPath                = "/users/%s" // uses user id
	ListGroupsPath          = "/groups"
	ListGroupMembersPath    = "/groups/%s/users"
	UserGroupMembershipPath = "/groups/%s/users/%s"
	UserRolePath            = "/access-control/v1/users/%s/roles" // uses user uuid, not id
	RolesPath               = "/access-control/v1/roles"
	PermissionsPath         = "/api/v3/access-control/permissions"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	ID            int    `json:"id,omitempty"`
	UUID          string `json:"uuid,omitempty"`
	Name          string `json:"name,omitempty"`
	Permissions   int    `json:"permissions,omitempty"`
	UsersCount    int    `json:"users_count,omitempty"`
	ContainerUUID string `json:"container_uuid,omitempty"`
}

type GroupsResponse

type GroupsResponse struct {
	Groups []Group `json:"groups"`
}

type NewUser

type NewUser struct {
	Username string `json:"username,omitempty"`
	// The initial password for the user.
	// Passwords must be at least 12 characters long and contain:
	// at least one uppercase letter, one lowercase letter, one number,
	// and one special character symbol.
	Password    string `json:"password,omitempty"`
	Email       string `json:"email,omitempty"`
	Name        string `json:"name,omitempty"`
	Permissions int    `json:"permissions,omitempty"`
}

type Permission

type Permission struct {
	UUID      uuid.UUID       `json:"permission_uuid,omitempty"`
	Name      string          `json:"name,omitempty"`
	Actions   []string        `json:"actions,omitempty"`
	Objects   []TenableObject `json:"objects,omitempty"`
	Subjects  []TenableObject `json:"subjects,omitempty"`
	CreatedAt int64           `json:"created_at,omitempty"`
	CreatedBy string          `json:"created_by,omitempty"`
	UpdatedAt int64           `json:"updated_at,omitempty"`
	UpdatedBy string          `json:"updated_by,omitempty"`
}

type PermissionUpdateBody

type PermissionUpdateBody struct {
	Name     string          `json:"name,omitempty"`
	Actions  []string        `json:"actions,omitempty"`
	Objects  []TenableObject `json:"objects,omitempty"`
	Subjects []TenableObject `json:"subjects,omitempty"`
}

type PermissionsList

type PermissionsList struct {
	Permissions []Permission `json:"permissions,omitempty"`
}

type ReqOpt

type ReqOpt func(reqURL *url.URL)

type Role

type Role struct {
	UUID uuid.UUID `json:"uuid,omitempty"`
	Name string    `json:"name,omitempty"`
}

type RoleDetails added in v0.0.2

type RoleDetails struct {
	UUID        uuid.UUID `json:"uuid,omitempty"`
	Name        string    `json:"name,omitempty"`
	Permissions []string  `json:"role_permission_strings,omitempty"`
	Description string    `json:"description,omitempty"`
	Type        string    `json:"type,omitempty"`
	Status      string    `json:"status,omitempty"`
}

type RolesResponse

type RolesResponse struct {
	Roles []User `json:"roles"`
}

type TenableObject

type TenableObject struct {
	Type string    `json:"type,omitempty"`
	UUID uuid.UUID `json:"uuid,omitempty"`
	Name string    `json:"name,omitempty"`
}

type TenableVMClient

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

func NewClient

func NewClient(ctx context.Context, accessKey, secretKey string) (*TenableVMClient, error)

func (*TenableVMClient) CreateUser

func (c *TenableVMClient) CreateUser(ctx context.Context, newUser NewUser) (*User, error)

func (*TenableVMClient) CreateUserGroupMembership

func (c *TenableVMClient) CreateUserGroupMembership(ctx context.Context, groupId string, userId string, add bool) error

func (*TenableVMClient) DeleteUser added in v0.0.3

func (c *TenableVMClient) DeleteUser(ctx context.Context, userId string) error

https://developer.tenable.com/reference/users-delete

func (*TenableVMClient) DeleteUserGroupMembership

func (c *TenableVMClient) DeleteUserGroupMembership(ctx context.Context, groupId string, userId string) error

func (*TenableVMClient) DisableUser added in v0.0.3

func (c *TenableVMClient) DisableUser(ctx context.Context, userId string) (*User, error)

https://developer.tenable.com/reference/users-enabled

func (*TenableVMClient) EnableUser added in v0.0.3

func (c *TenableVMClient) EnableUser(ctx context.Context, userId string) (*User, error)

https://developer.tenable.com/reference/users-enabled

func (*TenableVMClient) GetGroupMembers

func (c *TenableVMClient) GetGroupMembers(ctx context.Context, groupId string) ([]User, annotations.Annotations, error)

func (*TenableVMClient) GetGroups

func (*TenableVMClient) GetPermissionDetails

func (c *TenableVMClient) GetPermissionDetails(ctx context.Context, uuid string) (*Permission, error)

func (*TenableVMClient) GetRoles added in v0.0.2

func (*TenableVMClient) GetUserDetails

func (c *TenableVMClient) GetUserDetails(ctx context.Context, userId string) (*User, error)

func (*TenableVMClient) GetUserRoles

func (c *TenableVMClient) GetUserRoles(ctx context.Context, userUUID string) (*UserRole, error)

func (*TenableVMClient) GetUsers

API pagination support is limited to specific endpoints. As per documentation https://developer.tenable.com/reference/users-list does not include pagination.

func (*TenableVMClient) ListPermissions

func (c *TenableVMClient) ListPermissions(ctx context.Context) ([]Permission, annotations.Annotations, error)

func (*TenableVMClient) UpdatePermission

func (c *TenableVMClient) UpdatePermission(ctx context.Context, updatedPermission *Permission) error

func (*TenableVMClient) UpdateUser

func (c *TenableVMClient) UpdateUser(ctx context.Context, userId string, body UserUpdateReqBody) (*User, error)

func (*TenableVMClient) UpdateUserRoles

func (c *TenableVMClient) UpdateUserRoles(ctx context.Context, userUUID string, roleUUID string) (*UserRole, error)

type User

type User struct {
	ID            int      `json:"id,omitempty"`
	UUID          string   `json:"uuid,omitempty"`
	Username      string   `json:"username,omitempty"`
	Email         string   `json:"email,omitempty"`
	Name          string   `json:"name,omitempty"`
	LastLogin     int64    `json:"lastlogin,omitempty"`
	Enabled       bool     `json:"enabled,omitempty"`
	Permissions   int      `json:"permissions,omitempty"`
	ContainerUUID string   `json:"container_uuid,omitempty"`
	RbacRoles     []Role   `json:"rbac_roles,omitempty"`
	Roles         []string `json:"roles,omitempty"`
	GroupUUIDs    []string `json:"group_uuids,omitempty"`
}

type UserEnabledReqBody added in v0.0.3

type UserEnabledReqBody struct {
	Enabled bool `json:"enabled"`
}

type UserRole

type UserRole struct {
	ContainerUUID string   `json:"container_uuid,omitempty"`
	UserUUID      string   `json:"user_uuid,omitempty"`
	RolesUUID     []string `json:"role_uuids,omitempty"`
}

type UserRoleReqBody

type UserRoleReqBody struct {
	RolesUUIDs []string `json:"role_uuids,omitempty"`
}

type UserUpdateReqBody

type UserUpdateReqBody struct {
	Name        string `json:"name,omitempty"`
	Permissions int    `json:"permissions,omitempty"`
	Email       string `json:"email,omitempty"`
	Enabled     bool   `json:"enabled,omitempty"`
}

type UsersResponse

type UsersResponse struct {
	Users []User `json:"users"`
}

Jump to

Keyboard shortcuts

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