dataexport

package
v0.79.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dataexport defines DataExport object definitions.

Index

Examples

Constants

View Source
const (
	DataExportTypeS3        string = "S3"
	DataExportTypeSnowflake string = "Snowflake"
	DataExportTypeGCS       string = "GCS"
)
View Source
const (
	GCSNonDomainNameBucketMaxLength int = 63
)

Variables

View Source
var DNSNameRegexp = regexp.MustCompile(`^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$`)
View Source
var GCSNonDNSNameBucketNameRegexp = regexp.MustCompile(`^[a-z0-9][a-z0-9-_]{1,61}[a-z0-9]$`)
View Source
var S3BucketNameRegexp = regexp.MustCompile(`^[a-z0-9][a-z0-9\-.]{1,61}[a-z0-9]$`)

Functions

This section is empty.

Types

type DataExport

type DataExport struct {
	APIVersion manifest.Version `json:"apiVersion"`
	Kind       manifest.Kind    `json:"kind"`
	Metadata   Metadata         `json:"metadata"`
	Spec       Spec             `json:"spec"`
	Status     *Status          `json:"status"`

	Organization   string `json:"organization,omitempty"`
	ManifestSource string `json:"manifestSrc,omitempty"`
}

DataExport struct which mapped one to one with kind: DataExport yaml definition

Example
package main

import (
	"context"
	"log"

	"github.com/nobl9/nobl9-go/internal/examples"
	"github.com/nobl9/nobl9-go/manifest"
	"github.com/nobl9/nobl9-go/manifest/v1alpha/dataexport"
)

func main() {
	// Create the object:
	dataExport := dataexport.New(
		dataexport.Metadata{
			Name:        "s3-data-export",
			DisplayName: "S3 data export",
			Project:     "default",
		},
		dataexport.Spec{
			ExportType: "S3",
			Spec: dataexport.S3DataExportSpec{
				BucketName: "example-bucket",
				RoleARN:    "arn:aws:iam::341861879477:role/n9-access",
			},
		},
	)
	// Verify the object:
	if err := dataExport.Validate(); err != nil {
		log.Fatal("data export validation failed, err: %w", err)
	}
	// Apply the object:
	client := examples.GetOfflineEchoClient()
	if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{dataExport}); err != nil {
		log.Fatal("failed to apply data export err: %w", err)
	}
}
Output:

apiVersion: n9/v1alpha
kind: DataExport
metadata:
  name: s3-data-export
  displayName: S3 data export
  project: default
spec:
  exportType: S3
  spec:
    bucketName: example-bucket
    roleArn: arn:aws:iam::341861879477:role/n9-access
status: null

func New

func New(metadata Metadata, spec Spec) DataExport

New creates a new DataExport based on provided Metadata nad Spec.

func (DataExport) GetKind

func (d DataExport) GetKind() manifest.Kind

func (DataExport) GetManifestSource

func (d DataExport) GetManifestSource() string

func (DataExport) GetName

func (d DataExport) GetName() string

func (DataExport) GetOrganization

func (d DataExport) GetOrganization() string

func (DataExport) GetProject

func (d DataExport) GetProject() string

func (DataExport) GetVersion

func (d DataExport) GetVersion() manifest.Version

func (DataExport) SetManifestSource

func (d DataExport) SetManifestSource(src string) manifest.Object

func (DataExport) SetOrganization

func (d DataExport) SetOrganization(org string) manifest.Object

func (DataExport) SetProject

func (d DataExport) SetProject(project string) manifest.Object

func (DataExport) Validate

func (d DataExport) Validate() error

type ExportJobStatus

type ExportJobStatus struct {
	Timestamp string `json:"timestamp,omitempty"`
	State     string `json:"state"`
}

ExportJobStatus represents content of ExportJob status

type GCSDataExportSpec

type GCSDataExportSpec struct {
	BucketName string `json:"bucketName"`
}

GCSDataExportSpec represents content of GCP Cloud Storage export type spec.

type Metadata

type Metadata struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName,omitempty"`
	Project     string `json:"project,omitempty"`
}

type S3DataExportSpec

type S3DataExportSpec struct {
	BucketName string `json:"bucketName"`
	RoleARN    string `json:"roleArn"`
}

S3DataExportSpec represents content of Amazon S3 export type spec.

type Spec

type Spec struct {
	ExportType string      `json:"exportType"`
	Spec       interface{} `json:"spec"`
}

Spec represents content of DataExport's Spec

func (*Spec) UnmarshalJSON

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

func (*Spec) UnmarshalYAML added in v0.78.0

func (s *Spec) UnmarshalYAML(data []byte) error

type Status

type Status struct {
	ExportJob     ExportJobStatus `json:"exportJob"`
	AWSExternalID *string         `json:"awsExternalID,omitempty"`
}

Status represents content of Status optional for DataExport Object

Jump to

Keyboard shortcuts

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