Documentation ¶
Overview ¶
Copyright © 2018 Zechen Jiang <zechen@cloudcoreo.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2018 Zechen Jiang <zechen@cloudcoreo.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func NewError(text string) error
- type AWSEventRemoveConfig
- type AWSEventStreamConfig
- type Auth
- type AzureEventRemoveConfig
- type AzureEventStreamConfig
- type Client
- func (c *Client) CreateCloudAccount(ctx context.Context, input *CreateCloudAccountInput) (*CloudAccount, error)
- func (c *Client) CreateTeam(ctx context.Context, teamName, teamDescription string) (*Team, error)
- func (c *Client) CreateToken(ctx context.Context, name, description string) (*Token, error)
- func (c *Client) DeleteCloudAccountByID(ctx context.Context, teamID, cloudID string) error
- func (c *Client) DeleteTokenByID(ctx context.Context, tokenID string) error
- func (c *Client) Do(ctx context.Context, method, path string, body io.Reader, obj interface{}) error
- func (c *Client) GetCloudAccountByID(ctx context.Context, teamID, cloudID string) (*CloudAccount, error)
- func (c *Client) GetCloudAccounts(ctx context.Context, teamID string) ([]*CloudAccount, error)
- func (c *Client) GetRemoveConfig(ctx context.Context, teamID, cloudID string) (*EventRemoveConfig, error)
- func (c *Client) GetRoleCreationInfo(ctx context.Context, input *CreateCloudAccountInput) (*RoleCreationInfo, error)
- func (c *Client) GetSetupConfig(ctx context.Context, teamID, cloudID string) (*EventStreamConfig, error)
- func (c *Client) GetTeamByID(ctx context.Context, teamID string) (*Team, error)
- func (c *Client) GetTeams(ctx context.Context) ([]*Team, error)
- func (c *Client) GetTokenByID(ctx context.Context, tokenID string) (*Token, error)
- func (c *Client) GetTokens(ctx context.Context) ([]*Token, error)
- func (c *Client) GetUser(ctx context.Context) (*User, error)
- func (c *Client) ReValidateRole(ctx context.Context, teamID, cloudID string) (*RoleReValidationResult, error)
- func (c *Client) ShowResultObject(ctx context.Context, teamID, cloudID, level, provider string, retry uint) ([]*ResultObjectWrapper, error)
- func (c *Client) ShowResultRule(ctx context.Context, teamID, cloudID, level, provider string) ([]*ResultRule, error)
- func (c *Client) UpdateCloudAccount(ctx context.Context, input *UpdateCloudAccountInput) (*CloudAccount, error)
- type CloudAccount
- type CloudInfo
- type CloudPayLoad
- type CreateCloudAccountInput
- type EventRemoveConfig
- type EventStreamConfig
- type Info
- type Interceptor
- type Link
- type Option
- type ResultObject
- type ResultObjectWrapper
- type ResultRule
- type ResultRuleWrapper
- type RoleCreationInfo
- type RoleReValidationResult
- type Team
- type TeamInfo
- type TeamInfoWrapper
- type Token
- type UpdateCloudAccountInput
- type User
- type ViolatingRules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AWSEventRemoveConfig ¶ added in v0.0.36
type AWSEventStreamConfig ¶ added in v0.0.31
type AWSEventStreamConfig struct { TemplateURL string `json:"templateURL"` TopicName string `json:"topicName"` StackName string `json:"stackName"` DevtimeQueueArn string `json:"devtimeQueueArn"` Version string `json:"version"` MonitorRule string `json:"monitorRule"` Regions []string `json:"regions"` }
type AzureEventRemoveConfig ¶ added in v0.0.36
type AzureEventStreamConfig ¶ added in v0.0.31
type AzureEventStreamConfig struct { SubscriptionID string `json:"subscriptionId"` ActionDeployFile string `json:"actionDeployFile"` AlertDeployFile string `json:"alertDeployFile"` WebhookServiceUri string `json:"webhookServiceUri"` ResourceGroup string `json:"resourceGroup"` ActionDeploymentName string `json:"actionDeploymentName"` AlertDeploymentName string `json:"alertDeploymentName"` ActionGroup string `json:"actionGroup"` ActionGroupShort string `json:"actionGroupShort"` WebhookReceiverName string `json:"webhookReceiverName"` AlertName string `json:"alertName"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func MakeClient ¶
MakeClient make client
func (*Client) CreateCloudAccount ¶
func (c *Client) CreateCloudAccount(ctx context.Context, input *CreateCloudAccountInput) (*CloudAccount, error)
CreateCloudAccount method to create a cloud object
func (*Client) CreateTeam ¶ added in v0.0.7
CreateTeam method to create a new team
func (*Client) CreateToken ¶
CreateToken method to create a token object
func (*Client) DeleteCloudAccountByID ¶
DeleteCloudAccountByID method to delete cloud object
func (*Client) DeleteTokenByID ¶
DeleteTokenByID method to delete token object
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, method, path string, body io.Reader, obj interface{}) error
Do performs an HTTP request with a given context - the response will be decoded into obj.
func (*Client) GetCloudAccountByID ¶
func (c *Client) GetCloudAccountByID(ctx context.Context, teamID, cloudID string) (*CloudAccount, error)
GetCloudAccountByID method getting cloud account by user ID
func (*Client) GetCloudAccounts ¶
GetCloudAccounts method for cloud command
func (*Client) GetRemoveConfig ¶ added in v0.0.23
func (c *Client) GetRemoveConfig(ctx context.Context, teamID, cloudID string) (*EventRemoveConfig, error)
GetRemoveConfig get the config for event stream removal from secure state
func (*Client) GetRoleCreationInfo ¶ added in v0.0.21
func (c *Client) GetRoleCreationInfo(ctx context.Context, input *CreateCloudAccountInput) (*RoleCreationInfo, error)
GetRoleCreationInfo returns the configuration for creating a new role
func (*Client) GetSetupConfig ¶ added in v0.0.20
func (c *Client) GetSetupConfig(ctx context.Context, teamID, cloudID string) (*EventStreamConfig, error)
GetSetupConfig get the config for event stream setup from secure state
func (*Client) GetTeamByID ¶
GetTeamByID method to get Team info object by team ID
func (*Client) GetTokenByID ¶
GetTokenByID method for token command
func (*Client) ReValidateRole ¶ added in v0.0.27
func (c *Client) ReValidateRole(ctx context.Context, teamID, cloudID string) (*RoleReValidationResult, error)
ReValidateRole checks role validation and re-validate it
func (*Client) ShowResultObject ¶ added in v0.0.19
func (c *Client) ShowResultObject(ctx context.Context, teamID, cloudID, level, provider string, retry uint) ([]*ResultObjectWrapper, error)
ShowResultObject shows violated objects. If the filter condition (teamID, cloudID in this case) is valid, objects will be filtered. Otherwise return all violation objects under this user account.
func (*Client) ShowResultRule ¶ added in v0.0.19
func (c *Client) ShowResultRule(ctx context.Context, teamID, cloudID, level, provider string) ([]*ResultRule, error)
ShowResultRule show violated rules. If the filter condition (teamID, cloudID in this case) is valid, rules will be filtered. Otherwise return all violation rules under this user account.
func (*Client) UpdateCloudAccount ¶ added in v0.0.27
func (c *Client) UpdateCloudAccount(ctx context.Context, input *UpdateCloudAccountInput) (*CloudAccount, error)
UpdateCloudAccount updates cloud account
type CloudAccount ¶
type CloudAccount struct { RoleID string `json:"roleId"` RoleName string `json:"roleName"` Links []Link `json:"links"` ID string `json:"id"` AccountID string `json:"accountId"` CloudPayLoad }
CloudAccount Information
type CloudInfo ¶ added in v0.0.27
type CloudInfo struct { Name string `json:"name,omitempty"` Arn string `json:"arn,omitempty"` ScanEnabled bool `json:"scanEnabled"` ScanInterval string `json:"scanInterval"` ScanRegion string `json:"scanRegion"` ExternalID string `json:"externalId,omitempty"` IsDraft bool `json:"isDraft"` Provider string `json:"provider"` Email string `json:"email,omitempty"` UserName string `json:"username,omitempty"` Environment []string `json:"environment,omitempty"` KeyValue string `json:"key,omitempty"` ApplicationID string `json:"appId,omitempty"` DirectoryID string `json:"directoryId,omitempty"` SubscriptionID string `json:"subscriptionId,omitempty"` Tags []string `json:"tags,omitempty"` IsValid bool `json:"isValid"` LastValidationCheck string `json:"lastValidationCheck"` }
type CloudPayLoad ¶ added in v0.0.20
CloudPayLoad ...
type CreateCloudAccountInput ¶ added in v0.0.20
type CreateCloudAccountInput struct { TeamID string CloudName string RoleName string ExternalID string RoleArn string Policy string IsDraft bool Email string UserName string Environment string ScanEnabled bool Provider string KeyValue string ApplicationID string DirectoryID string SubscriptionID string Tags string }
CreateCloudAccountInput for function CreateCloudAccount
type EventRemoveConfig ¶ added in v0.0.23
type EventRemoveConfig struct { AWSEventRemoveConfig AzureEventRemoveConfig Provider string `json:"provider"` }
EventRemoveConfig for event stream removal
type EventStreamConfig ¶ added in v0.0.20
type EventStreamConfig struct { AWSEventStreamConfig AzureEventStreamConfig Provider string `json:"provider"` }
EventStreamConfig for event stream setup
type Info ¶ added in v0.0.19
type Info struct { SuggestedAction string `json:"suggested_action"` Link string `json:"link"` Description string `json:"description"` DisplayName string `json:"display_name"` Level string `json:"level"` Service string `json:"service"` Name string `json:"name"` Region string `json:"region"` IncludeViolationsInCount bool `json:"include_violations_in_count"` TimeStamp string `json:"timestamp"` }
Info is the struct for rule_report
type Interceptor ¶
Interceptor is a generic request interceptor, useful for modifying or canceling the request.
type Link ¶
type Link struct { Ref string `json:"ref"` Method string `json:"method"` Href string `json:"href"` }
Link struct
type Option ¶
type Option func(*clientOptions)
Option type
func WithInterceptor ¶
func WithInterceptor(ci Interceptor) Option
WithInterceptor returns a ClientOption for adding an interceptor to a Client.
type ResultObject ¶ added in v0.0.19
type ResultObject struct { ID string `json:"id"` Info Info `json:"rule_report"` TInfo TeamInfo `json:"team"` RiskScore int `json:"riskScore"` }
The ResultObject struct decodes json file returned by webapp
type ResultObjectWrapper ¶ added in v0.0.24
type ResultObjectWrapper struct { AccountName string `json:"accountName,omitempty"` AccountNumber string `json:"accountNumber,omitempty"` TotalItems int `json:"totalItems"` Objects []*ResultObject `json:"violations"` ScrollID string `json:"scrollId,omitempty"` }
ResultObjectWrapper contains an object array and number of total items
type ResultRule ¶ added in v0.0.19
type ResultRule struct { ID string `json:"id"` Info Info `json:"info"` TInfo []TeamInfoWrapper `json:"teamAndPlan"` CInfo []string `json:"accounts"` Object int `json:"objects"` }
ResultRule struct decodes json file returned by webapp
type ResultRuleWrapper ¶ added in v0.0.28
type ResultRuleWrapper struct {
ViolatingRules ViolatingRules `json:"result"`
}
type RoleCreationInfo ¶ added in v0.0.21
RoleCreationInfo contains the info required for role creation
type RoleReValidationResult ¶ added in v0.0.27
type RoleReValidationResult struct { Message string `json:"message"` IsValid bool `json:"isValid"` }
RoleReValidationResult is the result for role re-validation
type Team ¶
type Team struct { TeamName string `json:"teamName"` OwnerID string `json:"ownerId"` TeamIcon string `json:"teamIcon"` TeamDescription string `json:"teamDescription"` Default bool `json:"default"` Links []Link `json:"links"` ID string `json:"id"` }
Team for team information
type TeamInfoWrapper ¶ added in v0.0.24
type TeamInfoWrapper struct {
TeamInfo *TeamInfo `json:"team"`
}
TeamInfoWrapper is a wrapper for team Info
type Token ¶
type Token struct { Name string `json:"name"` Description string `json:"description"` CreationDate time.Time `json:"creationDate"` Links []Link `json:"links"` ID string `json:"id"` }
Token struct
type UpdateCloudAccountInput ¶ added in v0.0.27
type UpdateCloudAccountInput struct { CreateCloudAccountInput CloudId string }
UpdateCloudAccountInput is the info needed for update cloud account
type User ¶
type User struct { Username string `json:"username"` Email string `json:"email"` GravatarIconURL string `json:"gravatarIconUrl"` CreatedAt time.Time `json:"createdAt"` DefaultTeamID string `json:"defaultTeamId"` Links []Link `json:"links"` ID string `json:"id"` }
User struct for api payload
type ViolatingRules ¶ added in v0.0.38
type ViolatingRules struct {
Rules []*ResultRule `json:"violatingRules"`
}