clients

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package clients holds client libraries used by security automation Cloud Functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SamplesFromDomain

func SamplesFromDomain(domain string) ([]string, error)

SamplesFromDomain returns a slice of hashes associated with a domain name.

Types

type BigQuery

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

BigQuery client.

func NewBigQuery

func NewBigQuery(ctx context.Context, authFile, projectID string) (*BigQuery, error)

NewBigQuery returns the BigQuery client.

func (*BigQuery) DatasetMetadata

func (bq *BigQuery) DatasetMetadata(ctx context.Context, projectID, datasetID string) (*bigquery.DatasetMetadata, error)

DatasetMetadata fetches the metadata for the dataset.

func (*BigQuery) OverwriteDatasetMetadata

func (bq *BigQuery) OverwriteDatasetMetadata(ctx context.Context, projectID, datasetID string, dm bigquery.DatasetMetadataToUpdate) (*bigquery.DatasetMetadata, error)

OverwriteDatasetMetadata modifies specific Dataset metadata fields. This method ignores the existing metadata state (and possibly overwrites other updates) by doing a "blind write". See https://godoc.org/cloud.google.com/go/bigquery#Dataset.Update for details.

type CloudResourceManager

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

CloudResourceManager client.

func NewCloudResourceManager

func NewCloudResourceManager(ctx context.Context, authFile string) (*CloudResourceManager, error)

NewCloudResourceManager returns and initalizes the Cloud Resource Manager client.

func (*CloudResourceManager) GetAncestry

func (c *CloudResourceManager) GetAncestry(ctx context.Context, projectID string) (*crm.GetAncestryResponse, error)

GetAncestry returns the ancestry for the given project.

func (*CloudResourceManager) GetOrganization

func (c *CloudResourceManager) GetOrganization(ctx context.Context, name string) (*crm.Organization, error)

GetOrganization returns the organization info by resource name.

func (*CloudResourceManager) GetPolicyOrganization

func (c *CloudResourceManager) GetPolicyOrganization(ctx context.Context, name string) (*crm.Policy, error)

GetPolicyOrganization returns the IAM policy for the given organization resource.

func (*CloudResourceManager) GetPolicyProject

func (c *CloudResourceManager) GetPolicyProject(ctx context.Context, projectID string) (*crm.Policy, error)

GetPolicyProject returns the IAM policy for the given project resource.

func (*CloudResourceManager) SetPolicyOrganization

func (c *CloudResourceManager) SetPolicyOrganization(ctx context.Context, name string, p *crm.Policy) (*crm.Policy, error)

SetPolicyOrganization sets an IAM policy for the given organization resource.

func (*CloudResourceManager) SetPolicyProject

func (c *CloudResourceManager) SetPolicyProject(ctx context.Context, projectID string, p *crm.Policy) (*crm.Policy, error)

SetPolicyProject sets an IAM policy for the given project resource.

func (*CloudResourceManager) SetPolicyProjectWithMask

func (c *CloudResourceManager) SetPolicyProjectWithMask(ctx context.Context, projectID string, p *crm.Policy, updateField ...string) (*crm.Policy, error)

SetPolicyProjectWithMask sets an IAM policy for the given project resource.

type CloudSQL

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

CloudSQL client.

func NewCloudSQL

func NewCloudSQL(ctx context.Context, authFile string) (*CloudSQL, error)

NewCloudSQL returns and initializes a Cloud SQL client.

func (*CloudSQL) InstanceDetails

func (s *CloudSQL) InstanceDetails(ctx context.Context, projectID string, instance string) (*sqladmin.DatabaseInstance, error)

InstanceDetails gets detail from a instance in a project

func (*CloudSQL) PatchInstance

func (s *CloudSQL) PatchInstance(ctx context.Context, projectID, instance string, databaseInstance *sqladmin.DatabaseInstance) (*sqladmin.Operation, error)

PatchInstance updates partialy a Cloud SQL instance.

func (*CloudSQL) UpdateUser

func (s *CloudSQL) UpdateUser(ctx context.Context, projectID, instance, host, name string, user *sqladmin.User) (*sqladmin.Operation, error)

UpdateUser updates a given user.

func (*CloudSQL) WaitSQL

func (s *CloudSQL) WaitSQL(projectID string, op *sqladmin.Operation) []error

WaitSQL will wait for the global operation to complete.

type Compute

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

Compute client.

func NewCompute

func NewCompute(ctx context.Context, authFile string) (*Compute, error)

NewCompute returns and initializes a Compute client.

func (*Compute) CreateSnapshot

func (c *Compute) CreateSnapshot(ctx context.Context, projectID, zone, disk string, rb *compute.Snapshot) (*compute.Operation, error)

CreateSnapshot creates a snapshot of a specified persistent disk.

func (*Compute) DeleteAccessConfig

func (c *Compute) DeleteAccessConfig(ctx context.Context, project, zone, instance, accessConfig, networkInterface string) (*compute.Operation, error)

DeleteAccessConfig deletes an access config from an instance's network interface.

func (*Compute) DeleteDiskSnapshot

func (c *Compute) DeleteDiskSnapshot(ctx context.Context, project, snapshot string) (*compute.Operation, error)

DeleteDiskSnapshot deletes the given snapshot from the project.

func (*Compute) DeleteFirewallRule

func (c *Compute) DeleteFirewallRule(ctx context.Context, projectID string, rule string) (*compute.Operation, error)

DeleteFirewallRule deletes the firewall rule for the given project.

func (*Compute) DeleteInstance

func (c *Compute) DeleteInstance(ctx context.Context, projectID, zone, instance string) (*compute.Operation, error)

DeleteInstance deletes a given instance in given zone.

func (*Compute) DiskInsert

func (c *Compute) DiskInsert(ctx context.Context, projectID, zone string, disk *compute.Disk) (*compute.Operation, error)

DiskInsert creates a new disk in the project.

func (*Compute) FirewallRule

func (c *Compute) FirewallRule(ctx context.Context, projectID string, ruleID string) (*compute.Firewall, error)

FirewallRule get the details of a firewall rule

func (*Compute) GetInstance

func (c *Compute) GetInstance(ctx context.Context, project, zone, instance string) (*compute.Instance, error)

GetInstance returns the specified compute instance resource.

func (*Compute) InsertFirewallRule

func (c *Compute) InsertFirewallRule(ctx context.Context, projectID string, fw *compute.Firewall) (*compute.Operation, error)

InsertFirewallRule inserts a new firewall rule.

func (*Compute) ListDisks

func (c *Compute) ListDisks(ctx context.Context, projectID, zone string) (*compute.DiskList, error)

ListDisks returns a list of disk for a given project.

func (*Compute) ListProjectSnapshots

func (c *Compute) ListProjectSnapshots(ctx context.Context, projectID string) (*compute.SnapshotList, error)

ListProjectSnapshots returns a list of snapshot reousrces for a given project.

func (*Compute) PatchFirewallRule

func (c *Compute) PatchFirewallRule(ctx context.Context, projectID string, rule string, rb *compute.Firewall) (*compute.Operation, error)

PatchFirewallRule updates the firewall rule for the given project.

func (*Compute) SetLabels

func (c *Compute) SetLabels(ctx context.Context, projectID, resource string, rb *compute.GlobalSetLabelsRequest) (*compute.Operation, error)

SetLabels sets labels on a snapshot.

func (*Compute) StartInstance

func (c *Compute) StartInstance(ctx context.Context, projectID, zone, instance string) (*compute.Operation, error)

StartInstance starts a given instance in given zone.

func (*Compute) StopInstance

func (c *Compute) StopInstance(ctx context.Context, projectID, zone, instance string) (*compute.Operation, error)

StopInstance instance command to some instance/zone

func (*Compute) WaitGlobal

func (c *Compute) WaitGlobal(project string, op *compute.Operation) []error

WaitGlobal will wait for the global operation to complete.

func (*Compute) WaitZone

func (c *Compute) WaitZone(project, zone string, op *compute.Operation) []error

WaitZone will wait for the zonal operation to complete.

type Container

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

Container client.

func NewContainer

func NewContainer(ctx context.Context, authFile string) (*Container, error)

NewContainer returns and initializes a Container client.

func (*Container) UpdateAddonsConfig

func (c *Container) UpdateAddonsConfig(ctx context.Context, projectID, zone, clusterID string, conf *container.SetAddonsConfigRequest) (*container.Operation, error)

UpdateAddonsConfig updates the addons configuration of a given cluster.

type DomainReport

type DomainReport struct {
	Samples []Sample `json:"detected_communicating_samples"`
}

DomainReport holds a subset of fields returned in a domain request.

type Logger

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

Logger client.

func NewLogger

func NewLogger(ctx context.Context, authFile string) (*Logger, error)

NewLogger initializes and returns a Logger struct.

func (*Logger) Close

func (l *Logger) Close()

Close buffer and send messages to stackdriver

func (*Logger) Debug

func (l *Logger) Debug(message string, a ...interface{})

Debug sends a message to the logger using debug as the severity.

func (*Logger) Error

func (l *Logger) Error(message string, a ...interface{})

Error sends a message to the logger using error as the severity.

func (*Logger) Info

func (l *Logger) Info(message string, a ...interface{})

Info sends a message to the logger using info as the severity.

func (*Logger) Warning

func (l *Logger) Warning(message string, a ...interface{})

Warning sends a message to the logger using warning as the severity.

type PagerDuty

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

PagerDuty client.

func NewPagerDuty

func NewPagerDuty(apiKey string) *PagerDuty

NewPagerDuty returns a PagerDuty client initialized.

func (*PagerDuty) CreateIncident

func (p *PagerDuty) CreateIncident(from, serviceID, title, body string) (*pagerduty.Incident, error)

CreateIncident will create a new incident.

type PubSub

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

PubSub client.

func NewPubSub

func NewPubSub(ctx context.Context, authFile, projectID string) (*PubSub, error)

NewPubSub returns the PubSub client.

func (*PubSub) Publish

func (p *PubSub) Publish(ctx context.Context, topic *pubsub.Topic, message *pubsub.Message) (string, error)

Publish will publish a message to a PubSub topic.

func (*PubSub) Topic

func (p *PubSub) Topic(id string) *pubsub.Topic

Topic returns a reference to a topic.

type Sample

type Sample struct {
	SHA256 string `json:"sha256"`
}

Sample holds a subset of fields returned in a sample request.

type SecurityCommandCenter

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

SecurityCommandCenter client.

func NewSecurityCommandCenter

func NewSecurityCommandCenter(ctx context.Context, authFile string) (*SecurityCommandCenter, error)

NewSecurityCommandCenter returns and initializes a SecurityCommandCenter client.

func (*SecurityCommandCenter) AddSecurityMarks

AddSecurityMarks adds security mark to a finding or asset.

func (*SecurityCommandCenter) UpdateFinding

func (s *SecurityCommandCenter) UpdateFinding(ctx context.Context, request *sccpb.UpdateFindingRequest) (*sccpb.Finding, error)

UpdateFinding updates a finding in SCC.

type SendGrid

type SendGrid struct {
	Service SendGridClient
}

SendGrid client.

func NewSendGridClient

func NewSendGridClient(apiKey string) *SendGrid

NewSendGridClient returns and initializes the SendGrid client.

func (*SendGrid) Send

func (s *SendGrid) Send(subject, from, body string, to []string) (*rest.Response, error)

Send email SendGrid.

type SendGridClient

type SendGridClient interface {
	Send(mail *mail.SGMailV3) (*rest.Response, error)
}

SendGridClient client provider -------------------------------------------------/

type Storage

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

Storage client.

func NewStorage

func NewStorage(ctx context.Context, authFile string) (*Storage, error)

NewStorage returns and initializes the Storage client.

func (*Storage) BucketPolicy

func (s *Storage) BucketPolicy(ctx context.Context, bucketName string) (*iam.Policy, error)

BucketPolicy gets the IAM policy for the given bucket.

func (*Storage) EnableBucketOnlyPolicy

func (s *Storage) EnableBucketOnlyPolicy(ctx context.Context, bucketName string) error

EnableBucketOnlyPolicy enables the bucket only policy for the given bucket.

func (*Storage) SetBucketPolicy

func (s *Storage) SetBucketPolicy(ctx context.Context, bucketName string, policy *iam.Policy) error

SetBucketPolicy sets the policy for the given bucket.

Directories

Path Synopsis
cscc
apiv1p1alpha1
Package securitycenter is an auto-generated package for the Cloud Security Command Center API.
Package securitycenter is an auto-generated package for the Cloud Security Command Center API.
Package stubs provides testable stubs for clients.
Package stubs provides testable stubs for clients.

Jump to

Keyboard shortcuts

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