groups

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	UserIds    []string `json:"userIds,omitempty"`
	GroupNames []string `json:"groupNames,omitempty"`
}

Request :

Request struct to build the required post parameters.

Fields:

UserIds: usernames of the users you want to add to a single group.
GroupNames: names of the groups you want to add a single user to.

func (*Request) AddGroupToUser

func (r *Request) AddGroupToUser(c *sa.Client, groupID string, userID string) (*Response, error)

AddGroupToUser :

Helper function for making user posts to add a single group to a single single.

Parameters:

[Required] r: should be empty for this call.
[Required] c: passing in the client containing authorization and host information.
[Required] groupid: the name of the group to add a user to.
[Required] userID: the username of the user to add to a group.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

func (*Request) AddGroupToUsers

func (r *Request) AddGroupToUsers(c *sa.Client, groupID string, users []string) (*Response, error)

AddGroupToUsers :

Helper function for making user posts to add a single group to multiple users.

Parameters:

[Required] r: should be empty for this call.
[Required] c: passing in the client containing authorization and host information.
[Required] groupID: the name of the group to add to each user.
[Required] users: a string slice of usernames to add to the group.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

func (*Request) AddUserToGroup

func (r *Request) AddUserToGroup(c *sa.Client, userID string, groupID string) (*Response, error)

AddUserToGroup :

Helper function for making user posts to add a single user to a single group.

Parameters:

[Required] r: should be empty for this call.
[Required] c: passing in the client containing authorization and host information.
[Required] userID: the username of the user to add to a group.
[Required] groupid: the name of the group to add a user to.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.\

func (*Request) AddUserToGroups

func (r *Request) AddUserToGroups(c *sa.Client, userID string, groups []string) (*Response, error)

AddUserToGroups :

Helper function for making user posts to add a single user to multiple groups.

Parameters:

[Required] r: should be empty for this call.
[Required] c: passing in the client containing authorization and host information.
[Required] userID: the username of the user to add to multiple groups.
[Required] groups: a string slice of group names to add the user to.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

func (*Request) Post

func (r *Request) Post(c *sa.Client, endpoint string) (*Response, error)

Post :

Executes a post to the users or groups endpoint.

Parameters:

[Required] r: should have all required fields of the struct populated before using.
[Required] c: passing in the client containing authorization and host information.
[Required] endpoint: the endpoint perform the post to.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

type Response

type Response struct {
	Status       string              `json:"status"`
	Message      string              `json:"message"`
	Failures     map[string][]string `json:"failures,omitempty"`
	RawJSON      string              `json:"-"`
	HTTPResponse *http.Response      `json:"-"`
}

Response :

Response struct that will be populated after the post request.

func (*Response) IsSignatureValid added in v1.1.0

func (r *Response) IsSignatureValid(c *sa.Client) (bool, error)

IsSignatureValid :

Helper function to validate the SecureAuth Response signature in X-SA-SIGNATURE

Parameters:

[Required] r: response struct with HTTPResponse
[Required] c: passing in the client with application id and key

Returns:

bool: if true, computed signature matches X-SA-SIGNATURE. if false, computed signature does not match.
error: If an error is encountered, bool will be false and the error must be handled.

Jump to

Keyboard shortcuts

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