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 Auth
- 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) 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) ShowResultObject(ctx context.Context, teamID, cloudID, level string) ([]*ResultObject, error)
- func (c *Client) ShowResultRule(ctx context.Context, teamID, cloudID, level string) ([]*ResultRule, error)
- type CloudAccount
- type CloudAccountInfo
- type CloudPayLoad
- type CreateCloudAccountInput
- type EventStreamConfig
- type Info
- type Interceptor
- type Link
- type Option
- type ResultObject
- type ResultRule
- type Team
- type TeamInfo
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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) 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) ShowResultObject ¶ added in v0.0.19
func (c *Client) ShowResultObject(ctx context.Context, teamID, cloudID, level string) ([]*ResultObject, 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 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.
type CloudAccount ¶
type CloudAccount struct { TeamID string `json:"teamId"` Name string `json:"name"` RoleID string `json:"roleId"` RoleName string `json:"roleName"` Links []Link `json:"links"` ID string `json:"id"` }
CloudAccount Information
type CloudAccountInfo ¶ added in v0.0.19
CloudAccountInfo records the info of a cloud account
type CloudPayLoad ¶ added in v0.0.20
type CloudPayLoad struct { Name string `json:"name"` Arn string `json:"arn"` ScanEnabled bool `json:"scanEnabled"` ScanInterval string `json:"scanInterval"` ScanRegion string `json:"scanRegion"` ExternalID string `json:"externalId"` IsDraft bool `json:"isDraft"` Provider string `json:"provider"` }
CloudPayLoad ...
type CreateCloudAccountInput ¶ added in v0.0.20
type CreateCloudAccountInput struct { TeamID string AccessKeyID string SecretAccessKey string CloudName string RoleName string ExternalID string RoleArn string AwsProfile string AwsProfilePath string Policy string }
CreateCloudAccountInput for function CreateCloudAccount
type EventStreamConfig ¶ added in v0.0.20
type EventStreamConfig 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"` }
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"` CInfo CloudAccountInfo `json:"cloud_account"` RunID string `json:"run_id"` }
The ResultObject struct decodes json file returned by webapp
type ResultRule ¶ added in v0.0.19
type ResultRule struct { ID string `json:"id"` Info Info `json:"info"` TInfo []TeamInfo `json:"teams"` CInfo []CloudAccountInfo `json:"accounts"` Object int `json:"objects"` }
ResultRule struct decodes json file returned by webapp
type Team ¶
type Team struct { TeamName string `json:"teamName"` OwnerID string `json:"ownerId"` TeamIcon string `json:"teamIcon"` TeamDescription interface{} `json:"teamDescription"` Default bool `json:"default"` Links []Link `json:"links"` ID string `json:"id"` }
Team for team information
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 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