Documentation
¶
Overview ¶
Package dataexport defines DataExport object definitions.
Index ¶
- Constants
- Variables
- type DataExport
- func (d DataExport) GetKind() manifest.Kind
- func (d DataExport) GetManifestSource() string
- func (d DataExport) GetName() string
- func (d DataExport) GetOrganization() string
- func (d DataExport) GetProject() string
- func (d DataExport) GetVersion() string
- func (d DataExport) SetManifestSource(src string) manifest.Object
- func (d DataExport) SetOrganization(org string) manifest.Object
- func (d DataExport) SetProject(project string) manifest.Object
- func (d DataExport) Validate() error
- type ExportJobStatus
- type GCSDataExportSpec
- type Metadata
- type S3DataExportSpec
- type Spec
- type Status
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 string `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: "examplebucket",
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.ApplyObjects(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: examplebucket 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() string
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 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 ¶
type Status ¶
type Status struct {
ExportJob ExportJobStatus `json:"exportJob"`
AWSExternalID *string `json:"awsExternalID,omitempty"`
}
Status represents content of Status optional for DataExport Object
Click to show internal directories.
Click to hide internal directories.