client

package
v0.0.0-...-ca1ed16 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegionNameMapping = map[string]string{
	"eu-north-1":     "Stockholm",
	"ap-south-1":     "Mumbai",
	"eu-west-3":      "Paris",
	"eu-west-2":      "London",
	"eu-west-1":      "Ireland",
	"ap-northeast-2": "Seoul",
	"ap-northeast-1": "Tokyo",
	"sa-east-1":      "São Paulo",
	"ca-central-1":   "Canada(Central)",
	"ap-southeast-1": "Singapore",
	"ap-southeast-2": "Sydney",
	"eu-central-1":   "Frankfurt",
	"us-east-1":      "N. Virginia",
	"us-east-2":      "Ohio",
	"us-west-1":      "N. California",
	"us-west-2":      "Oregon",
}

Functions

func GetAccountAlias

func GetAccountAlias(cfg aws.Config) (string, error)

GetAccountAlias returns account alias

func GetAllRegions

func GetAllRegions() ([]string, error)

GetAllRegions will returns all regions

func GetAwsSession

func GetAwsSession(region string) aws.Config

GetAwsSession creates new session for AWS

func GetEC2ClientFn

func GetEC2ClientFn(cfg aws.Config) *ec2.Client

GetEC2ClientFn creates ec2 client

func GetIAMClientFn

func GetIAMClientFn(cfg aws.Config) *iam.Client

GetIAMClientFn creates iam client

func GetRDSClientFn

func GetRDSClientFn(cfg aws.Config) *rds.Client

GetRDSClientFn creates rds client

func GetRegionName

func GetRegionName(regionID string) (*string, error)

GetRegionName returns exact name of region

func GetRoute53ClientFn

func GetRoute53ClientFn(cfg aws.Config) *route53.Client

GetRoute53ClientFn creates route53 client

func GetS3ClientFn

func GetS3ClientFn(cfg aws.Config) *s3.Client

GetS3ClientFn creates s3 client

func GetSTSClientFn

func GetSTSClientFn(cfg aws.Config) *sts.Client

GetSTSClientFn creates a new STS Client

Types

type BucketPolicy

type BucketPolicy struct {
	Version   string      `json:"Version"`
	Statement []Statement `json:"Statement"`
}

type Client

type Client interface {
	GetResourceName() string
	SetAlias(*string)
	Scan() ([]resource.Resource, error)
}

func ChooseResourceClient

func ChooseResourceClient(resource string, h Helper) (Client, error)

ChooseResourceClient selects resource client from the list

func CreateResourceClient

func CreateResourceClient(provider, resource, region string) (Client, error)

CreateResourceClient creates a new client fro redhawk

func NewEC2Client

func NewEC2Client(cfg aws.Config, helper Helper) (Client, error)

NewEC2Client creates EC2Client resource with ec2 client

func NewIAMClient

func NewIAMClient(cfg aws.Config, _ Helper) (Client, error)

NewIAMClient creates IAMClient

func NewRDSClient

func NewRDSClient(cfg aws.Config, helper Helper) (Client, error)

NewRDSClient creates a RDSClient

func NewRoute53Client

func NewRoute53Client(cfg aws.Config, _ Helper) (Client, error)

NewRoute53Client creates a Route53Client

func NewS3Client

func NewS3Client(cfg aws.Config, helper Helper) (Client, error)

NewS3Client creates S3Client

func NewSGClient

func NewSGClient(cfg aws.Config, _ Helper) (Client, error)

NewSGClient creates a SGClient

type EC2Client

type EC2Client struct {
	Resource string
	Client   *ec2.Client
	Region   string
	Alias    *string
}

func (*EC2Client) GetEC2Instances

func (e *EC2Client) GetEC2Instances(original []types.Reservation, nextToken *string) ([]types.Reservation, error)

GetEC2Instances get all instances in the account

func (*EC2Client) GetResourceName

func (e *EC2Client) GetResourceName() string

GetResourceName returns resource name of client

func (*EC2Client) Scan

func (e *EC2Client) Scan() ([]resource.Resource, error)

Scan scans all data

func (*EC2Client) SetAlias

func (e *EC2Client) SetAlias(alias *string)

SetAlias sets alias

type Helper

type Helper struct {
	Provider string
	Resource string
	Region   string
}

type IAMClient

type IAMClient struct {
	Resource string
	Alias    *string
	Client   *iam.Client
}

func (IAMClient) GetAccessKeys

func (i IAMClient) GetAccessKeys(user string) ([]types.AccessKeyMetadata, error)

GetAccessKeys returns all access keys of user

func (*IAMClient) GetGroupList

func (i *IAMClient) GetGroupList() ([]types.Group, error)

GetGroupList returns all IAM group list

func (*IAMClient) GetGroupPolicies

func (i *IAMClient) GetGroupPolicies(group string) ([]types.AttachedPolicy, error)

GetGroupPolicies returns policies of group

func (*IAMClient) GetLastAccessKeyUsed

func (i *IAMClient) GetLastAccessKeyUsed(accessKey *string) (*types.AccessKeyLastUsed, error)

GetLastAccessKeyUsed returns lastly used date of access key

func (*IAMClient) GetMFADevices

func (i *IAMClient) GetMFADevices(user string) ([]types.MFADevice, error)

GetMFADevices returns all MFA devices

func (IAMClient) GetResourceName

func (i IAMClient) GetResourceName() string

GetResourceName returns resource name of client

func (*IAMClient) GetRoleList

func (i *IAMClient) GetRoleList() ([]types.Role, error)

GetRoleList returns all IAM role list

func (*IAMClient) GetUserList

func (i *IAMClient) GetUserList() ([]types.User, error)

GetUserList returns all IAM User list

func (*IAMClient) GetUserListInGroup

func (i *IAMClient) GetUserListInGroup(group string) ([]types.User, error)

GetUserListInGroup returns user list of group

func (*IAMClient) Scan

func (i *IAMClient) Scan() ([]resource.Resource, error)

Scan scans all data

func (*IAMClient) ScanGroup

func (i *IAMClient) ScanGroup() ([]resource.Resource, map[string][]string, error)

ScanGroup scans all IAM group

func (*IAMClient) ScanRole

func (i *IAMClient) ScanRole() ([]resource.Resource, error)

ScanRole scans all IAM group

func (*IAMClient) ScanUser

func (i *IAMClient) ScanUser(userGroupMap map[string][]string) ([]resource.Resource, error)

ScanUser scans all IAM group

func (*IAMClient) SetAlias

func (i *IAMClient) SetAlias(alias *string)

SetAlias sets alias

type PolicyDocument

type PolicyDocument struct {
	Version   string
	Statement []StatementEntry
}

type Principal

type Principal struct {
	Service   interface{}
	Federated interface{}
}

type RDSClient

type RDSClient struct {
	Resource string
	Client   *rds.Client
	Alias    *string
}

func (*RDSClient) GetRDSClusterList

func (r *RDSClient) GetRDSClusterList() ([]types.DBCluster, error)

GetRDSClusterList returns all DB clusters list in the account

func (*RDSClient) GetRDSInfo

func (r *RDSClient) GetRDSInfo(identifier string) (*types.DBInstance, error)

GetRDSInfo returns DB instance information

func (*RDSClient) GetResourceName

func (r *RDSClient) GetResourceName() string

GetResourceName returns resource name of client

func (*RDSClient) Scan

func (r *RDSClient) Scan() ([]resource.Resource, error)

Scan scans all data

func (*RDSClient) SetAlias

func (r *RDSClient) SetAlias(alias *string)

SetAlias sets alias

type Route53Client

type Route53Client struct {
	Resource string
	Client   *route53.Client
	Alias    *string
}

func (*Route53Client) GetResourceName

func (r *Route53Client) GetResourceName() string

GetResourceName returns resource name of client

func (*Route53Client) GetRoute53HostedZones

func (r *Route53Client) GetRoute53HostedZones() ([]types.HostedZone, error)

GetRoute53HostedZones get all hosted zones in the account

func (*Route53Client) GetRoute53List

func (r *Route53Client) GetRoute53List() ([]types.ResourceRecordSet, error)

GetRoute53List get all record set in the account

func (*Route53Client) Scan

func (r *Route53Client) Scan() ([]resource.Resource, error)

Scan scans all data

func (*Route53Client) SetAlias

func (r *Route53Client) SetAlias(alias *string)

SetAlias sets alias

type S3Client

type S3Client struct {
	Resource string
	Client   *s3.Client
	Alias    *string
}

func (*S3Client) GetBucketList

func (s *S3Client) GetBucketList() ([]types.Bucket, error)

GetSGList returns all security group list in the account

func (*S3Client) GetBucketLocation

func (s *S3Client) GetBucketLocation(bucket string) (*string, error)

GetBucketLocation returns region of bucket

func (*S3Client) GetBucketLogging

func (s *S3Client) GetBucketLogging(bucket string) (*types.LoggingEnabled, error)

GetBucketLogging returns a bucket logging configuration

func (*S3Client) GetBucketPolicy

func (s *S3Client) GetBucketPolicy(bucket string) (*string, error)

GetBucketPolicy returns a bucket policy

func (*S3Client) GetResourceName

func (s *S3Client) GetResourceName() string

GetResourceName returns resource name of client

func (*S3Client) Scan

func (s *S3Client) Scan() ([]resource.Resource, error)

Scan scans all data

func (*S3Client) SetAlias

func (s *S3Client) SetAlias(alias *string)

SetAlias sets alias

type SGClient

type SGClient struct {
	Resource string
	Client   *ec2.Client
	Alias    *string
}

func (SGClient) GetResourceName

func (s SGClient) GetResourceName() string

GetResourceName returns resource name of client

func (*SGClient) GetSGList

func (s *SGClient) GetSGList() ([]types.SecurityGroup, error)

GetSGList returns all security group list in the account

func (*SGClient) Scan

func (s *SGClient) Scan() ([]resource.Resource, error)

Scan scans all data

func (*SGClient) SetAlias

func (s *SGClient) SetAlias(alias *string)

SetAlias sets alias

type STSClient

type STSClient struct {
	Client *sts.Client
}

func NewSTSClient

func NewSTSClient(cfg aws.Config) (*STSClient, error)

NewSTSClient creates a STSClients

func (STSClient) CheckWhoIam

func (s STSClient) CheckWhoIam() (*string, error)

CheckWhoIam calls get-caller-identity and print the result

type Statement

type Statement struct {
	Effect    string      `json:"Effect"`
	Principal interface{} `json:"Principal"`
	Action    interface{} `json:"Action"`
	Resource  interface{} `json:"Resource"`
}

type StatementEntry

type StatementEntry struct {
	Effect    string
	Principal *Principal
	Resource  interface{}
}

Jump to

Keyboard shortcuts

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