client

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(text string) error

NewError returns an error that formats as the given text.

Types

type AWSEventRemoveConfig added in v0.0.36

type AWSEventRemoveConfig struct {
	StackName      string   `json:"stackName"`
	TopicName      string   `json:"topicName"`
	Regions        []string `json:"regions"`
	ArnType        string   `json:"arnType"`
	CloudAccountID string   `json:"cloudAccountId"`
}

AWSEventRemoveConfig contains info needed for AWS event stream removal

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"`
}

AWSEventStreamConfig contains info needed for AWS event stream setup

type Auth

type Auth struct {
	RefreshToken string
}

Auth struct for API and secret key

func (*Auth) SignRequest

func (a *Auth) SignRequest(req *http.Request) error

SignRequest method to sign all requests

type AzureEventRemoveConfig added in v0.0.36

type AzureEventRemoveConfig struct {
	SubscriptionID    string `json:"subscriptionId"`
	ResourceGroup     string `json:"resourceGroup"`
	WebhookServiceURI string `json:"webhookServiceUri"`
}

AzureEventRemoveConfig contains info needed for Azure event stream removal

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"`
}

AzureEventStreamConfig contains info needed for Azure event stream setup

type Client

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

Client struct

func MakeClient

func MakeClient(refreshToken, endpoint string) (*Client, error)

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) DeleteCloudAccountByID

func (c *Client) DeleteCloudAccountByID(ctx context.Context, cloudID string) error

DeleteCloudAccountByID method to delete cloud 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, cloudID string) (*CloudAccount, error)

GetCloudAccountByID method getting cloud account by user ID

func (*Client) GetCloudAccounts

func (c *Client) GetCloudAccounts(ctx context.Context) ([]*CloudAccount, error)

GetCloudAccounts method for cloud command

func (*Client) GetRemoveConfig added in v0.0.23

func (c *Client) GetRemoveConfig(ctx context.Context, 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, cloudID string) (*EventStreamConfig, error)

GetSetupConfig get the config for event stream setup from secure state

func (*Client) ReValidateRole added in v0.0.27

func (c *Client) ReValidateRole(ctx context.Context, cloudID string) (*RoleReValidationResult, error)

ReValidateRole checks role validation and re-validate it

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"`
	ID        string `json:"_id"`
	AccountID string `json:"accountId"`
	CloudInfo
}

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"`
	CSPProjectID        string   `json:"cspProjectId"`
}

CloudInfo listed all info of cloud accounts

type CreateCloudAccountInput added in v0.0.20

type CreateCloudAccountInput struct {
	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
	CSPProjectID   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 Interceptor

type Interceptor func(*http.Request) error

Interceptor is a generic request interceptor, useful for modifying or canceling the request.

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 RoleCreationInfo added in v0.0.21

type RoleCreationInfo struct {
	AwsAccount string
	ExternalID string
	RoleName   string
	Policy     string
}

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 UpdateCloudAccountInput added in v0.0.27

type UpdateCloudAccountInput struct {
	CreateCloudAccountInput
	CloudID string
}

UpdateCloudAccountInput is the info needed for update cloud account

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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