cedarcore

package
v0.0.0-...-b3f093e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEuaIDFilter

func WithEuaIDFilter(euaUserId string) systemSummaryParamFilterOpt

WithEuaIDFilter sets given EUA onto the params

func WithSubSystems

func WithSubSystems(cedarSystemId string) systemSummaryParamFilterOpt

WithSubSystems sets given cedar system ID as the parent system for which we are looking for sub-systems

Types

type Client

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

Client represents a connection to the CEDAR Core API

func NewClient

func NewClient(ctx context.Context, cedarHost string, cedarAPIKey string, cedarAPIVersion string, cacheRefreshTime time.Duration, mockEnabled bool) *Client

NewClient builds the type that holds a connection to the CEDAR Core API

func (*Client) GetAuthorityToOperate

func (c *Client) GetAuthorityToOperate(ctx context.Context, cedarSystemID string) ([]*models.CedarAuthorityToOperate, error)

GetAuthorityToOperate makes a GET call to the /authority_to_operate endpoint

func (*Client) GetBudgetBySystem

func (c *Client) GetBudgetBySystem(ctx context.Context, cedarSystemID string) ([]*models.CedarBudget, error)

GetBudgetBySystem queries CEDAR for budget information associated with a particular system, taking the version-independent ID of a system

func (*Client) GetBudgetSystemCostBySystem

func (c *Client) GetBudgetSystemCostBySystem(ctx context.Context, cedarSystemID string) (*models.CedarBudgetSystemCost, error)

GetBudgetSystemCostBySystem queries CEDAR for budget system cost information associated with a particular system, taking the version-independent ID of a system.

NOTE: This function sorts the data returned by CEDAR to ensure ordering by descending FiscalYear

func (*Client) GetBusinessOwnerRolesBySystem

func (c *Client) GetBusinessOwnerRolesBySystem(ctx context.Context, cedarSystemID string) ([]*models.CedarRole, error)

GetBusinessOwnerRolesBySystem makes a GET call to the /role endpoint using a system ID and a business owner role type ID

func (*Client) GetContractBySystem

func (c *Client) GetContractBySystem(ctx context.Context, cedarSystemID string) ([]*models.CedarContract, error)

GetContractBySystem queries CEDAR for contract information associated with a particular system, taking the version-independent ID of a system

func (*Client) GetDeployments

func (c *Client) GetDeployments(ctx context.Context, cedarSystemID string, optionalParams *GetDeploymentsOptionalParams) ([]*models.CedarDeployment, error)

GetDeployments makes a GET call to the /deployment endpoint

func (*Client) GetExchangesBySystem

func (c *Client) GetExchangesBySystem(ctx context.Context, cedarSystemID string) ([]*models.CedarExchange, error)

GetExchangesBySystem fetches a list of CEDAR exchange records for a given system

func (*Client) GetRoleTypes

func (c *Client) GetRoleTypes(ctx context.Context) ([]*models.CedarRoleType, error)

GetRoleTypes queries CEDAR for the list of supported role types

func (*Client) GetRolesBySystem

func (c *Client) GetRolesBySystem(ctx context.Context, cedarSystemID string, roleTypeID *string) ([]*models.CedarRole, error)

GetRolesBySystem makes a GET call to the /role endpoint using a system ID and an optional role type ID we don't currently have a use case for querying /role by role ID, so that's not implemented

func (*Client) GetSoftwareProductsBySystem

func (c *Client) GetSoftwareProductsBySystem(ctx context.Context, cedarSystemID string) (*models.CedarSoftwareProducts, error)

GetSoftwareProductsBySystem queries CEDAR for software product/tooling information associated with a particular system, taking the version-independent ID of a system

func (*Client) GetSystem

func (c *Client) GetSystem(ctx context.Context, systemID string) (*models.CedarSystem, error)

GetSystem retrieves a CEDAR system by ID (IctObjectID), by first checking the cache, then if it is not found, repopulating the cache and checking one more time.

func (*Client) GetSystemDetail

func (c *Client) GetSystemDetail(ctx context.Context, cedarSystemID string) (*models.CedarSystemDetails, error)

GetSystemDetail makes a GET call to the /system/detail/{id} endpoint

func (*Client) GetSystemSummary

func (c *Client) GetSystemSummary(ctx context.Context, tryCache bool, opts ...systemSummaryParamFilterOpt) ([]*models.CedarSystem, error)

GetSystemSummary makes a GET call to the /system/summary endpoint If `tryCache` is true and `euaUserID` is nil, we will try to hit the cache. Otherwise, we will make an API call as we cannot filter on EUA on our end

func (*Client) GetThreat

func (c *Client) GetThreat(ctx context.Context, cedarSystemID string) ([]*models.CedarThreat, error)

GetThreat makes a GET call to the /threat endpoint

func (*Client) GetURLsForSystem

func (c *Client) GetURLsForSystem(ctx context.Context, cedarSystemID string) ([]*models.CedarURL, error)

GetURLsForSystem queries CEDAR for URLs associated with a particular system, taking the version-independent ID of a system

Note: CEDAR's /url/{id} endpoint theoretically supports querying for URLs associated with any sort of CEDAR object; however, this method assumes that the parameter is a version-independent system ID. If we need to look up URLs based on something other than systems, we will need to create another method.

func (*Client) SetRolesForUser

func (c *Client) SetRolesForUser(ctx context.Context, cedarSystemID string, euaUserID string, desiredRoleTypeIDs []string) (*SetRoleResponseMetadata, error)

SetRolesForUser sets the desired roles for a user on a given system to *exactly* the requested role types, adding and deleting role assignments in CEDAR as necessary

type GetDeploymentsOptionalParams

type GetDeploymentsOptionalParams struct {
	DeploymentType *string
	State          *string
	Status         *string
}

GetDeploymentsOptionalParams represents the optional parameters that can be used to filter deployments when searching through the CEDAR API

type SetRoleResponseMetadata

type SetRoleResponseMetadata struct {
	DidAdd              bool
	DidDelete           bool
	RoleTypeNamesBefore []string
	RoleTypeNamesAfter  []string
	SystemName          string
}

SetRoleResponseMetadata contains metadata about the role assignment operation

Jump to

Keyboard shortcuts

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