approval_requests

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package approval_requests manages and retrieves approval requests in the Enterprise Cloud.

Example to List approval requests

allPages, err := approval_requests.List(client).AllPages()
if err != nil {
	panic(err)
}

allApprovalRequests, err := approval_requests.ExtractApprovalRequests(allPages)
if err != nil {
	panic(err)
}

for _, approvalRequest := range allApprovalRequests {
	fmt.Printf("%+v\n", approvalRequest)
}

Example to Get an approval requests

requestID := "02471b45-3de0-4fc8-8469-a7cc52c378df"

approvalRequest, err := approval_requests.Get(client, requestID).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", approvalRequest)

Example to Update an approval request

requestID := "02471b45-3de0-4fc8-8469-a7cc52c378df"
updateOpts := approval_requests.UpdateOpts{
	Status: "approved",
}

result := approval_requests.Update(client, requestID, updateOpts)
if result.Err != nil {
	panic(result.Err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractApprovalRequestsInto

func ExtractApprovalRequestsInto(r pagination.Page, v interface{}) error

ExtractApprovalRequestsInto interprets the results of a single page from a List() call, producing a slice of Approval Request entities.

func List

func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List retrieves a list of approval requests.

Types

type Action

type Action struct {
	Service string `json:"service"`
	Region  string `json:"region"`
	APIPath string `json:"api_path"`
	Method  string `json:"method"`
	// Basically JSON is passed to Action.Body,
	// but depending on the value of the service, it may be a String, so it is set to interface{}.
	// If service is "provider-connectivity", body's type is JSON.
	// If service is "network", body's type is String.
	Body interface{} `json:"body"`
}

type ApprovalRequest

type ApprovalRequest struct {
	RequestID         string        `json:"request_id"`
	ExternalRequestID string        `json:"external_request_id"`
	ApproverType      string        `json:"approver_type"`
	ApproverID        string        `json:"approver_id"`
	RequestUserID     string        `json:"request_user_id"`
	Service           string        `json:"service"`
	Actions           []Action      `json:"actions"`
	Descriptions      []Description `json:"descriptions"`
	RequestUser       interface{}   `json:"request_user"`
	Approver          bool          `json:"approver"`
	ApprovalDeadLine  interface{}   `json:"approval_deadline"`
	ApprovalExpire    interface{}   `json:"approval_expire"`
	RegisteredTime    interface{}   `json:"registered_time"`
	UpdatedTime       interface{}   `json:"updated_time"`
	Status            string        `json:"status"`
}

ApprovalRequest represents an ECL SSS Approval Request.

func ExtractApprovalRequests

func ExtractApprovalRequests(r pagination.Page) ([]ApprovalRequest, error)

ExtractApprovalRequests returns a slice of approval requests contained in a single page of results.

type ApprovalRequestPage

type ApprovalRequestPage struct {
	pagination.LinkedPageBase
}

ApprovalRequestPage is a single page of approval request results.

func (ApprovalRequestPage) IsEmpty

func (r ApprovalRequestPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of approval requests contains any results.

type Description

type Description struct {
	Lang string `json:"lang"`
	Text string `json:"text"`
}

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as an approval request.

func Get

func Get(client *eclcloud.ServiceClient, name string) (r GetResult)

Get retrieves details of an approval request.

func (GetResult) Extract

func (r GetResult) Extract() (*ApprovalRequest, error)

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	Status  string `q:"status"`
	Service string `q:"service"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the approval request attributes you want to see returned.

func (ListOpts) ToApprovalRequestListQuery

func (opts ListOpts) ToApprovalRequestListQuery() (string, error)

ToApprovalRequestListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToApprovalRequestListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type UpdateOpts

type UpdateOpts struct {
	Status string `json:"status" required:"true"`
}

UpdateOpts represents parameters to update an approval request.

func (UpdateOpts) ToResourceUpdateMap

func (opts UpdateOpts) ToResourceUpdateMap() (map[string]interface{}, error)

ToResourceUpdateMap formats a UpdateOpts to update approval request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToResourceUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult is the result of an Update request. Call its Extract method to interpret it as an approval request.

func Update

func Update(client *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update modifies the attributes of an approval request.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*ApprovalRequest, error)

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis
sss approval request unit tests
sss approval request unit tests

Jump to

Keyboard shortcuts

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