config

package
v0.0.0-...-c8b7f0f Latest Latest
Warning

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

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

Documentation

Overview

Package config provides utilities to parse and create project and resource configurations.

Index

Constants

View Source
const (
	IAMChangeMetricName                = "iam-policy-change-count"
	BucketPermissionChangeMetricName   = "bucket-permission-change-count"
	BQSettingChangeMetricName          = "bigquery-settings-change-count"
	BucketUnexpectedAccessMetricPrefix = "unexpected-access-"
)

Logging Metric names used to create logs-based-metrics and Stackdriver alerts.

Variables

View Source
var EnableTerraform = false

EnableTerraform determines whether terraform will be enabled or not. Note: The terraform state bucket does not respect this var as it is required currently for Forseti projects. TODO: remove this once DM has been deprecated.

Functions

func DumpGeneratedFields

func DumpGeneratedFields(generatedFields *AllGeneratedFields, path string) error

DumpGeneratedFields dumps generated fields to file at path.

func NormalizePath

func NormalizePath(path string) (string, error)

NormalizePath normalizes paths specified through a local run or Bazel invocation.

func ValidateConf

func ValidateConf(confYAML []byte) error

ValidateConf validates the input project config against the default schema template.

Types

type Access

type Access struct {
	Role         string `json:"role"`
	UserByEmail  string `json:"userByEmail,omitempty"`
	GroupByEmail string `json:"groupByEmail,omitempty"`

	// Unsupported roles.
	SpecialGroup string      `json:"specialGroup,omitempty"`
	View         interface{} `json:"view,omitempty"`
}

Access defines a dataset access. Only one non-role field should be set.

type AllGeneratedFields

type AllGeneratedFields struct {
	Projects map[string]*GeneratedFields `json:"projects,omitempty"`
	Forseti  *ForsetiServiceInfo         `json:"forseti,omitempty"`
}

AllGeneratedFields defines the generated_fields block. AllGeneratedFields contains resource information when the resources are deployed. See field_generation_test for examples.

type BigqueryDataset

type BigqueryDataset struct {
	BigqueryDatasetProperties `json:"properties"`
	// contains filtered or unexported fields
}

BigqueryDataset represents a bigquery dataset.

func (*BigqueryDataset) Init

func (d *BigqueryDataset) Init() error

Init initializes a new dataset with the given project.

func (*BigqueryDataset) MarshalJSON

func (d *BigqueryDataset) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*BigqueryDataset) Name

func (d *BigqueryDataset) Name() string

Name returns the name of this dataset.

func (*BigqueryDataset) TemplatePath

func (d *BigqueryDataset) TemplatePath() string

TemplatePath returns the name of the template to use for this dataset.

func (*BigqueryDataset) UnmarshalJSON

func (d *BigqueryDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type BigqueryDatasetProperties

type BigqueryDatasetProperties struct {
	BigqueryDatasetName string    `json:"name"`
	Location            string    `json:"location"`
	Accesses            []*Access `json:"access,omitempty"`
	SetDefaultOwner     bool      `json:"setDefaultOwner,omitempty"`
}

BigqueryDatasetProperties represents a partial CFT dataset implementation.

type BinAuthz

type BinAuthz struct {
	Properties interface{} `json:"properties"`
}

BinAuthz represents a binary authorization policy. https://codelabs.developers.google.com/codelabs/cloud-binauthz-intro/#0

type Binding

type Binding struct {
	Role    string   `json:"role" yaml:"role"`
	Members []string `json:"members" yaml:"members"`
}

Binding represents a GCP policy binding.

func MergeBindings

func MergeBindings(bs ...Binding) []Binding

MergeBindings merges bindings together. It is typically used to merge default bindings with user specified bindings. Roles will be de-duplicated and merged into a single binding. Members are de-duplicated by deployment manager.

type CHCDataset

type CHCDataset struct {
	CHCDatasetProperties `json:"properties"`
	// contains filtered or unexported fields
}

CHCDataset represents a CHC dataset.

func (*CHCDataset) Init

func (d *CHCDataset) Init() error

Init initializes a new dataset with the given project.

func (*CHCDataset) MarshalJSON

func (d *CHCDataset) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*CHCDataset) Name

func (d *CHCDataset) Name() string

Name returns the name of this dataset.

func (*CHCDataset) TemplatePath

func (d *CHCDataset) TemplatePath() string

TemplatePath returns the name of the template to use for this dataset.

func (*CHCDataset) UnmarshalJSON

func (d *CHCDataset) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type CHCDatasetProperties

type CHCDatasetProperties struct {
	CHCDatasetID string `json:"datasetId"`
}

CHCDatasetProperties represents a partial CFT dataset implementation.

type Config

type Config struct {
	Overall struct {
		BillingAccount string   `json:"billing_account"`
		Domain         string   `json:"domain"`
		OrganizationID string   `json:"organization_id"`
		FolderID       string   `json:"folder_id"`
		AllowedAPIs    []string `json:"allowed_apis"`
	} `json:"overall"`

	Devops *struct {
		Project *Project `json:"project"`
	} `json:"devops"`
	AuditLogsProject    *Project   `json:"audit_logs_project"`
	Forseti             *Forseti   `json:"forseti"`
	Projects            []*Project `json:"projects"`
	GeneratedFieldsPath string     `json:"generated_fields_path"`

	// Set by helper and not directly through user defined config.
	AllGeneratedFields *AllGeneratedFields `json:"-"`
}

Config represents a (partial) representation of a projects YAML file. Only the required fields are present. See project_config.yaml.schema for details.

func Load

func Load(path string) (*Config, error)

Load loads a config from the given path.

func (*Config) AllFolders

func (c *Config) AllFolders() []string

AllFolders returns all folder ids in this config.

func (*Config) AllProjects

func (c *Config) AllProjects() []*Project

AllProjects returns all projects in this config. This includes Audit, Forseti and all data hosting projects.

func (*Config) Init

func (c *Config) Init(genFields *AllGeneratedFields) error

Init initializes the config and all its projects.

func (*Config) ProjectForAuditLogs

func (c *Config) ProjectForAuditLogs(p *Project) *Project

ProjectForAuditLogs is a helper function to get the audit logs project for the given project. Return the remote audit logs project if it exists, else return the project itself (to store audit logs locally).

func (*Config) ProjectForDevops

func (c *Config) ProjectForDevops(p *Project) *Project

ProjectForDevops is a helper function to get the devops project for the given project. Return the devops project if it exists, else return the project itself (to store devops resources locally).

type DefaultResource

type DefaultResource struct {
	DefaultResourceProperties `json:"properties"`
	OuterName                 string `json:"name,omitempty"`

	TmplPath string `json:"-"` // must be set in code
	// contains filtered or unexported fields
}

DefaultResource represents a resource supported by CFT

func (*DefaultResource) Init

func (dr *DefaultResource) Init() error

Init initializes a new default resource with the given project.

func (*DefaultResource) MarshalJSON

func (dr *DefaultResource) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*DefaultResource) Name

func (dr *DefaultResource) Name() string

Name returns the name of this resource.

func (*DefaultResource) TemplatePath

func (dr *DefaultResource) TemplatePath() string

TemplatePath returns the name of the template to use for this resource.

func (*DefaultResource) UnmarshalJSON

func (dr *DefaultResource) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type DefaultResourceProperties

type DefaultResourceProperties struct {
	InnerName string `json:"name,omitempty"`
}

DefaultResourceProperties represents a partial CFT resource implementation.

type Forseti

type Forseti struct {
	Project    *Project           `json:"project"`
	Properties *ForsetiProperties `json:"properties"`
}

Forseti wraps the CFT Forseti module.

type ForsetiProperties

type ForsetiProperties struct {
	// The following vars should not directly be set by users.
	ProjectID              string   `json:"project_id"`
	Domain                 string   `json:"domain"`
	CompositeRootResources []string `json:"composite_root_resources"`
	// contains filtered or unexported fields
}

ForsetiProperties represents a partial CFT Forseti implementation.

func (*ForsetiProperties) Init

func (p *ForsetiProperties) Init() error

Init initializes Forseti properties.

func (*ForsetiProperties) MarshalJSON

func (p *ForsetiProperties) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*ForsetiProperties) UnmarshalJSON

func (p *ForsetiProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type ForsetiServiceInfo

type ForsetiServiceInfo struct {
	ServiceAccount string `json:"service_account,omitempty"`
	ServiceBucket  string `json:"server_bucket,omitempty"`
}

ForsetiServiceInfo defines the generated_fields of the forseti service.

type GCEInstance

type GCEInstance struct {
	GCEInstanceProperties `json:"properties"`
	CustomBootImage       *struct {
		ImageName string `json:"image_name"`
		GCSPath   string `json:"gcs_path"`
	} `json:"custom_boot_image,omitempty"`
	// contains filtered or unexported fields
}

GCEInstance wraps a CFT GCE Instance.

func (*GCEInstance) Init

func (i *GCEInstance) Init() error

Init initializes the instance.

func (*GCEInstance) MarshalJSON

func (i *GCEInstance) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*GCEInstance) Name

func (i *GCEInstance) Name() string

Name returns the name of this instance.

func (*GCEInstance) TemplatePath

func (i *GCEInstance) TemplatePath() string

TemplatePath returns the name of the template to use for this instance.

func (*GCEInstance) UnmarshalJSON

func (i *GCEInstance) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type GCEInstanceInfo

type GCEInstanceInfo struct {
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`
}

GCEInstanceInfo defines the generated fields for instances in a project.

type GCEInstanceProperties

type GCEInstanceProperties struct {
	GCEInstanceName string `json:"name"`
	Zone            string `json:"zone"`
	DiskImage       string `json:"diskImage,omitempty"`
}

GCEInstanceProperties represents a partial CFT instance implementation.

type GCSBucket

type GCSBucket struct {
	GCSBucketProperties `json:"properties"`
	TTLDays             int      `json:"ttl_days,omitempty"`
	ExpectedUsers       []string `json:"expected_users,omitempty"`
	// contains filtered or unexported fields
}

GCSBucket wraps a CFT Cloud Storage Bucket.

func (*GCSBucket) Init

func (b *GCSBucket) Init() error

Init initializes the bucket with the given project.

func (*GCSBucket) MarshalJSON

func (b *GCSBucket) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*GCSBucket) Name

func (b *GCSBucket) Name() string

Name returns the name of the bucket.

func (*GCSBucket) TemplatePath

func (b *GCSBucket) TemplatePath() string

TemplatePath returns the name of the template to use for the bucket.

func (*GCSBucket) UnmarshalJSON

func (b *GCSBucket) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type GCSBucketProperties

type GCSBucketProperties struct {
	GCSBucketName              string     `json:"name"`
	Location                   string     `json:"location"`
	Bindings                   []Binding  `json:"bindings"`
	StorageClass               string     `json:"storageClass,omitempty"`
	Versioning                 versioning `json:"versioning"`
	Lifecycle                  *lifecycle `json:"lifecycle,omitempty"`
	PredefinedACL              string     `json:"predefinedAcl,omitempty"`
	PredefinedDefaultObjectACL string     `json:"predefinedDefaultObjectAcl,omitempty"`
	Logging                    *logging   `json:"logging,omitempty"`
}

GCSBucketProperties represents a partial CFT bucket implementation.

type GKECluster

type GKECluster struct {
	GKEClusterProperties `json:"properties"`
	// contains filtered or unexported fields
}

GKECluster wraps a CFT GKE cluster.

func (*GKECluster) Init

func (*GKECluster) Init() error

Init initializes a new GKE cluster with the given project.

func (*GKECluster) MarshalJSON

func (c *GKECluster) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*GKECluster) Name

func (c *GKECluster) Name() string

Name returns the name of this cluster.

func (*GKECluster) TemplatePath

func (*GKECluster) TemplatePath() string

TemplatePath returns the name of the template to use for this cluster.

func (*GKECluster) UnmarshalJSON

func (c *GKECluster) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type GKEClusterProperties

type GKEClusterProperties struct {
	ClusterLocationType string             `json:"clusterLocationType"`
	Region              string             `json:"region,omitempty"`
	Zone                string             `json:"zone,omitempty"`
	Cluster             GKEClusterSettings `json:"cluster"`
}

GKEClusterProperties represents a partial GKE cluster implementation.

type GKEClusterSettings

type GKEClusterSettings struct {
	Name string `json:"name"`
}

GKEClusterSettings the cluster settings in a GKE cluster.

type GKEWorkload

type GKEWorkload struct {
	Properties  interface{} `json:"properties"`
	ClusterName string      `json:"cluster_name"`
}

GKEWorkload represents a GKE resources, not limited to workloads.

type GeneratedFields

type GeneratedFields struct {
	ProjectNumber         string            `json:"project_number,omitempty"`
	LogSinkServiceAccount string            `json:"log_sink_service_account,omitempty"`
	GCEInstanceInfoList   []GCEInstanceInfo `json:"gce_instance_info,omitempty"`
}

GeneratedFields defines the generated_fields of a single project.

func (*GeneratedFields) InstanceID

func (g *GeneratedFields) InstanceID(name string) (string, error)

InstanceID returns the ID of the instance with the given name.

type IAMCustomRole

type IAMCustomRole struct {
	IAMCustomRoleProperties `json:"properties"`
	// contains filtered or unexported fields
}

IAMCustomRole wraps a CFT IAM custom role.

func (*IAMCustomRole) Init

func (i *IAMCustomRole) Init() error

Init initializes a new custom role with the given project.

func (*IAMCustomRole) MarshalJSON

func (i *IAMCustomRole) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*IAMCustomRole) Name

func (i *IAMCustomRole) Name() string

Name returns the name of this custom role.

func (*IAMCustomRole) TemplatePath

func (i *IAMCustomRole) TemplatePath() string

TemplatePath returns the template to use for this custom role.

func (*IAMCustomRole) UnmarshalJSON

func (i *IAMCustomRole) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type IAMCustomRoleProperties

type IAMCustomRoleProperties struct {
	RoleID string `json:"roleId"`
}

IAMCustomRoleProperties represents a partial IAM custom role implementation.

type IAMPolicy

type IAMPolicy struct {
	IAMPolicyProperties `json:"properties"`
	IAMPolicyName       string `json:"name"`
	// contains filtered or unexported fields
}

IAMPolicy wraps a CFT IAM policy.

func (*IAMPolicy) Init

func (i *IAMPolicy) Init() error

Init initializes a new custom role with the given project.

func (*IAMPolicy) MarshalJSON

func (i *IAMPolicy) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*IAMPolicy) Name

func (i *IAMPolicy) Name() string

Name returns the name of this custom role.

func (*IAMPolicy) TemplatePath

func (i *IAMPolicy) TemplatePath() string

TemplatePath returns the template to use for this custom role.

func (*IAMPolicy) UnmarshalJSON

func (i *IAMPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type IAMPolicyProperties

type IAMPolicyProperties struct {
	Bindings []Binding `json:"roles"`
}

IAMPolicyProperties represents a partial IAM policy implementation.

type LifecycleRule

type LifecycleRule struct {
	Action    *action    `json:"action,omitempty"`
	Condition *condition `json:"condition,omitempty"`
	// contains filtered or unexported fields
}

LifecycleRule defines a partial bucket lifecycle rule implementation.

func (*LifecycleRule) MarshalJSON

func (r *LifecycleRule) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*LifecycleRule) UnmarshalJSON

func (r *LifecycleRule) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type LogSink

type LogSink struct {
	LogSinkProperties `json:"properties"`
}

LogSink wraps a deployment manager Log Sink. Note: log sinks cannot be created by users, so do not implement custom json marshallers. TODO: see if we can use the CFT log sink template.

func (*LogSink) DeploymentManagerType

func (*LogSink) DeploymentManagerType() string

DeploymentManagerType returns the type to use for deployment manager.

func (*LogSink) Init

func (l *LogSink) Init() error

Init initializes the instance.

func (*LogSink) Name

func (l *LogSink) Name() string

Name returns the name of this log sink.

type LogSinkProperties

type LogSinkProperties struct {
	Sink                 string `json:"sink"`
	Destination          string `json:"destination"`
	Filter               string `json:"filter"`
	UniqueWriterIdentity bool   `json:"uniqueWriterIdentity"`
}

LogSinkProperties represents a partial DM log sink resource.

type Metric

type Metric struct {
	MetricProperties `json:"properties"`
	// contains filtered or unexported fields
}

Metric wraps a logging metric. Note: metrics cannot be created by users, so do not implement custom json marshallers.

func (*Metric) Dependencies

func (m *Metric) Dependencies() []string

Dependencies gets the dependencies of this metric.

func (*Metric) DeploymentManagerType

func (m *Metric) DeploymentManagerType() string

DeploymentManagerType returns the type to use for deployment manager.

func (*Metric) Init

func (m *Metric) Init() error

Init initializes the metric.

func (*Metric) Name

func (m *Metric) Name() string

Name returns the name of the metric.

type MetricProperties

type MetricProperties struct {
	MetricName      string            `json:"metric"`
	Description     string            `json:"description"`
	Filter          string            `json:"filter"`
	Descriptor      descriptor        `json:"metricDescriptor"`
	LabelExtractors map[string]string `json:"labelExtractors"`
}

MetricProperties wraps the metric template properties.

type Project

type Project struct {
	ID                  string   `json:"project_id"`
	BillingAccount      string   `json:"billing_account"`
	FolderID            string   `json:"folder_id"`
	OwnersGroup         string   `json:"owners_group"`
	AuditorsGroup       string   `json:"auditors_group"`
	DataReadWriteGroups []string `json:"data_readwrite_groups"`
	DataReadOnlyGroups  []string `json:"data_readonly_groups"`

	DevopsConfig struct {
		StateBucket *tfconfig.StorageBucket `json:"state_storage_bucket"`
	} `json:"devops"`

	CreateDeletionLien    bool                `json:"create_deletion_lien"`
	EnabledAPIs           []string            `json:"enabled_apis"`
	ViolationExceptions   map[string][]string `json:"violation_exceptions"`
	StackdriverAlertEmail string              `json:"stackdriver_alert_email"`

	Resources struct {
		// Deployment manager resources
		BQDatasets      []*BigqueryDataset `json:"bq_datasets"`
		CHCDatasets     []*CHCDataset      `json:"chc_datasets"`
		CloudRouter     []*DefaultResource `json:"cloud_routers"`
		GCEFirewalls    []*DefaultResource `json:"gce_firewalls"`
		GCEInstances    []*GCEInstance     `json:"gce_instances"`
		GCSBuckets      []*GCSBucket       `json:"gcs_buckets"`
		GKEClusters     []*GKECluster      `json:"gke_clusters"`
		IAMCustomRoles  []*IAMCustomRole   `json:"iam_custom_roles"`
		IAMPolicies     []*IAMPolicy       `json:"iam_policies"`
		IPAddresses     []*DefaultResource `json:"ip_addresses"`
		Pubsubs         []*Pubsub          `json:"pubsubs"`
		Routes          []*DefaultResource `json:"routes"`
		ServiceAccounts []*ServiceAccount  `json:"service_accounts"`
		VPCNetworks     []*DefaultResource `json:"vpc_networks"`
		VPNs            []*DefaultResource `json:"vpns"`

		// Kubectl resources
		GKEWorkloads []*GKEWorkload `json:"gke_workloads"`
	} `json:"resources"`

	// Terraform resources
	BigqueryDatasets     []*tfconfig.BigqueryDataset               `json:"bigquery_datasets"`
	ComputeFirewalls     []*tfconfig.ComputeFirewall               `json:"compute_firewalls"`
	ComputeImages        []*tfconfig.ComputeImage                  `json:"compute_images"`
	ComputeInstances     []*tfconfig.ComputeInstance               `json:"compute_instances"`
	HealthcareDatasets   []*tfconfig.HealthcareDataset             `json:"healthcare_datasets"`
	IAMCustomRoles       []*tfconfig.ProjectIAMCustomRole          `json:"project_iam_custom_roles"`
	IAMMembers           *tfconfig.ProjectIAMMembers               `json:"project_iam_members"`
	NotificationChannels []*tfconfig.MonitoringNotificationChannel `json:"monitoring_notification_channels"`
	PubsubTopics         []*tfconfig.PubsubTopic                   `json:"pubsub_topics"`
	Services             *tfconfig.ProjectServices                 `json:"project_services"`
	ResourceManagerLiens []*tfconfig.ResourceManagerLien           `json:"resource_manager_liens"`
	ServiceAccounts      []*tfconfig.ServiceAccount                `json:"service_accounts"`
	StorageBuckets       []*tfconfig.StorageBucket                 `json:"storage_buckets"`

	BinauthzPolicy *BinAuthz `json:"binauthz"`

	AuditLogs *struct {
		LogsBQDataset BigqueryDataset `json:"logs_bq_dataset"`
		LogsGCSBucket *GCSBucket      `json:"logs_gcs_bucket"`
	} `json:"audit_logs"`

	Audit struct {
		LogsBigqueryDataset *tfconfig.BigqueryDataset `json:"logs_bigquery_dataset"`
		LogsStorageBucket   *tfconfig.StorageBucket   `json:"logs_storage_bucket"`
	} `json:"audit"`

	TerraformDeployments struct {
		Resources struct {
			Config map[string]interface{} `json:"config"`
		} `json:"resources"`
	} `json:"terraform_deployments"`

	// The following vars are set through helpers and not directly through the user defined config.
	GeneratedFields *GeneratedFields `json:"-"`
	BQLogSink       *LogSink         `json:"-"`
	// TODO: replace DM log sink with TF once DM is deprecated.
	BQLogSinkTF *tfconfig.LoggingSink `json:"-"`
	Metrics     []*Metric             `json:"-"`

	IAMAuditConfig        *tfconfig.ProjectIAMAuditConfig   `json:"-"`
	DefaultAlertPolicies  []*tfconfig.MonitoringAlertPolicy `json:"-"`
	DefaultLoggingMetrics []*tfconfig.LoggingMetric         `json:"-"`
}

Project defines a single project's configuration.

func (*Project) DeploymentManagerResources

func (p *Project) DeploymentManagerResources() []Resource

DeploymentManagerResources gets all deployment manager data resources in this project.

func (*Project) Init

func (p *Project) Init(devopsProject, auditLogsProject *Project) error

Init initializes a project and all its resources. Audit Logs Project should either be a remote project or nil.

func (*Project) TerraformResources

func (p *Project) TerraformResources() []tfconfig.Resource

TerraformResources gets all terraform resources in this project.

type Pubsub

type Pubsub struct {
	PubsubProperties `json:"properties"`
	// contains filtered or unexported fields
}

Pubsub represents a GCP pubsub channel resource.

func (*Pubsub) Init

func (p *Pubsub) Init() error

Init initializes a new pubsub with the given project.

func (*Pubsub) MarshalJSON

func (p *Pubsub) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*Pubsub) Name

func (p *Pubsub) Name() string

Name returns the name of this pubsub.

func (*Pubsub) TemplatePath

func (p *Pubsub) TemplatePath() string

TemplatePath returns the name of the template to use for this pubsub.

func (*Pubsub) UnmarshalJSON

func (p *Pubsub) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type PubsubProperties

type PubsubProperties struct {
	TopicName     string          `json:"topic"`
	Subscriptions []*Subscription `json:"subscriptions"`
}

PubsubProperties represents a partial CFT pubsub implementation.

type Resource

type Resource interface {
	Init() error
	Name() string
}

Resource is an interface that must be implemented by all concrete resource implementations.

type ServiceAccount

type ServiceAccount struct {
	ServiceAccountProperties `json:"properties"`
	// contains filtered or unexported fields
}

ServiceAccount wraps a deployment manager service account.

func (*ServiceAccount) DeploymentManagerType

func (*ServiceAccount) DeploymentManagerType() string

DeploymentManagerType returns the type to use for deployment manager.

func (*ServiceAccount) Init

func (sa *ServiceAccount) Init() error

Init initializes the instance.

func (*ServiceAccount) MarshalJSON

func (sa *ServiceAccount) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*ServiceAccount) Name

func (sa *ServiceAccount) Name() string

Name returns the name of this service account.

func (*ServiceAccount) UnmarshalJSON

func (sa *ServiceAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

type ServiceAccountProperties

type ServiceAccountProperties struct {
	AccountID   string `json:"accountId"`
	DisplayName string `json:"displayName"`
}

ServiceAccountProperties represents a partial DM service account resource.

type Subscription

type Subscription struct {
	Bindings []Binding `json:"accessControl,omitempty"`
	// contains filtered or unexported fields
}

Subscription represents a partial subscription impementation.

func (*Subscription) MarshalJSON

func (s *Subscription) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom JSON marshaller. It is used to merge the original (raw) user JSON definition with the struct.

func (*Subscription) UnmarshalJSON

func (s *Subscription) UnmarshalJSON(data []byte) error

UnmarshalJSON provides a custom JSON unmarshaller. It is used to store the original (raw) user JSON definition, which can have more fields than what is defined in this struct.

Directories

Path Synopsis
Package tfconfig provides utilities to parse terraform resource configurations.
Package tfconfig provides utilities to parse terraform resource configurations.

Jump to

Keyboard shortcuts

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