nano

package
v1.3.43 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodeAuditDataMapperInstance = NewCodeAuditDataMapper()
View Source
var CodeMapperInstance = NewCodeMapper()
View Source
var CodeResource = &model.Resource{
	Name:        "Code",
	Namespace:   "nano",
	Title:       util.Pointer("Code"),
	Description: util.Pointer("Nano code"),
	Types: []*model.ResourceSubType{
		{
			Name:        "AuditData",
			Title:       "Audit Data",
			Description: "Audit Data is a type that represents the audit data of a resource/record. ",
			Properties: []*model.ResourceProperty{
				{
					Name:         "createdBy",
					Type:         model.ResourceProperty_STRING,
					Length:       256,
					Immutable:    true,
					ExampleValue: structpb.NewStringValue("admin"),

					Annotations: map[string]string{
						"SpecialProperty": "true",
					},
				},
				{
					Name:         "updatedBy",
					Type:         model.ResourceProperty_STRING,
					Length:       256,
					ExampleValue: structpb.NewStringValue("admin"),

					Annotations: map[string]string{
						"SpecialProperty": "true",
					},
				},
				{
					Name:         "createdOn",
					Type:         model.ResourceProperty_TIMESTAMP,
					Immutable:    true,
					ExampleValue: structpb.NewStringValue("2024-03-28T17:16:51+04:00"),

					Annotations: map[string]string{
						"SpecialProperty": "true",
					},
				},
				{
					Name:         "updatedOn",
					Type:         model.ResourceProperty_TIMESTAMP,
					ExampleValue: structpb.NewStringValue("2024-03-28T17:16:51+04:00"),

					Annotations: map[string]string{
						"SpecialProperty": "true",
					},
				},
			},

			Annotations: map[string]string{
				"EnableAudit":        "true",
				"OpenApiGroup":       "meta",
				"NormalizedResource": "true",
			},
		},
	},
	Properties: []*model.ResourceProperty{
		{
			Name:         "id",
			Type:         model.ResourceProperty_UUID,
			Primary:      true,
			Required:     true,
			Immutable:    true,
			ExampleValue: structpb.NewStringValue("a39621a4-6d48-11ee-b962-0242ac120002"),

			Annotations: map[string]string{
				"SpecialProperty": "true",
			},
		},
		{
			Name:      "name",
			Type:      model.ResourceProperty_STRING,
			Length:    255,
			Required:  true,
			Unique:    true,
			Immutable: true,
		},
		{
			Name:       "language",
			Type:       model.ResourceProperty_ENUM,
			Required:   true,
			EnumValues: []string{"PYTHON", "JAVASCRIPT"},
		},
		{
			Name:     "content",
			Type:     model.ResourceProperty_STRING,
			Length:   64000,
			Required: true,

			Annotations: map[string]string{
				"SQLType": "TEXT",
			},
		},
		{
			Name:         "contentFormat",
			Type:         model.ResourceProperty_ENUM,
			Required:     true,
			DefaultValue: structpb.NewStringValue("TEXT"),
			EnumValues:   []string{"TEXT", "TAR", "TAR_GZ"},
		},
		{
			Name: "annotations",
			Type: model.ResourceProperty_MAP,
			Item: &model.ResourceProperty{
				Name: "",
				Type: model.ResourceProperty_STRING,
			},
		},
		{
			Name:         "version",
			Type:         model.ResourceProperty_INT32,
			Required:     true,
			DefaultValue: structpb.NewNumberValue(1),
			ExampleValue: structpb.NewNumberValue(1),

			Annotations: map[string]string{
				"SpecialProperty":     "true",
				"AllowEmptyPrimitive": "true",
			},
		},
		{
			Name:         "auditData",
			Type:         model.ResourceProperty_STRUCT,
			TypeRef:      util.Pointer("AuditData"),
			ExampleValue: structpb.NewStructValue(&structpb.Struct{Fields: map[string]*structpb.Value{"createdBy": structpb.NewStringValue("admin"), "updatedBy": structpb.NewStringValue("admin"), "createdOn": structpb.NewStringValue("2024-03-28T17:16:51+04:00"), "updatedOn": structpb.NewStringValue("2024-03-28T17:16:51+04:00")}}),

			Annotations: map[string]string{
				"SpecialProperty": "true",
			},
		},
	},

	Annotations: map[string]string{
		"EnableAudit":        "true",
		"OpenApiGroup":       "meta",
		"NormalizedResource": "true",
	},
}

Functions

func GetBuiltinJs added in v1.3.28

func GetBuiltinJs(name string) string

func NewModule

func NewModule(container service.Container) service.Module

Types

type Code

type Code struct {
	Id            *uuid.UUID        `json:"id,omitempty"`
	Name          string            `json:"name,omitempty"`
	Language      CodeLanguage      `json:"language,omitempty"`
	Content       string            `json:"content,omitempty"`
	ContentFormat CodeContentFormat `json:"contentFormat,omitempty"`
	Annotations   map[string]string `json:"annotations,omitempty"`
	Version       int32             `json:"version,omitempty"`
	AuditData     *CodeAuditData    `json:"auditData,omitempty"`
}

func (*Code) GetAnnotations

func (s *Code) GetAnnotations() map[string]string

func (*Code) GetAuditData

func (s *Code) GetAuditData() *CodeAuditData

func (*Code) GetContent

func (s *Code) GetContent() string

func (*Code) GetContentFormat

func (s *Code) GetContentFormat() CodeContentFormat

func (*Code) GetId

func (s *Code) GetId() *uuid.UUID

func (*Code) GetLanguage

func (s *Code) GetLanguage() CodeLanguage

func (*Code) GetName

func (s *Code) GetName() string

func (*Code) GetVersion

func (s *Code) GetVersion() int32

type CodeAuditData

type CodeAuditData struct {
	CreatedBy *string    `json:"createdBy,omitempty"`
	UpdatedBy *string    `json:"updatedBy,omitempty"`
	CreatedOn *time.Time `json:"createdOn,omitempty"`
	UpdatedOn *time.Time `json:"updatedOn,omitempty"`
}

func (*CodeAuditData) GetCreatedBy

func (s *CodeAuditData) GetCreatedBy() *string

func (*CodeAuditData) GetCreatedOn

func (s *CodeAuditData) GetCreatedOn() *time.Time

func (*CodeAuditData) GetUpdatedBy

func (s *CodeAuditData) GetUpdatedBy() *string

func (*CodeAuditData) GetUpdatedOn

func (s *CodeAuditData) GetUpdatedOn() *time.Time

type CodeAuditDataMapper

type CodeAuditDataMapper struct {
}

func NewCodeAuditDataMapper

func NewCodeAuditDataMapper() *CodeAuditDataMapper

func (*CodeAuditDataMapper) FromProperties

func (m *CodeAuditDataMapper) FromProperties(properties map[string]*structpb.Value) *CodeAuditData

func (*CodeAuditDataMapper) New

func (*CodeAuditDataMapper) ResourceIdentity

func (m *CodeAuditDataMapper) ResourceIdentity() abs.ResourceIdentity

func (*CodeAuditDataMapper) ToProperties

func (m *CodeAuditDataMapper) ToProperties(codeAuditData *CodeAuditData) map[string]*structpb.Value

func (*CodeAuditDataMapper) ToUnstructured added in v1.3.43

func (m *CodeAuditDataMapper) ToUnstructured(codeAuditData *CodeAuditData) unstructured.Unstructured

type CodeContentFormat

type CodeContentFormat string
const (
	CodeContentFormat_TEXT  CodeContentFormat = "TEXT"
	CodeContentFormat_TAR   CodeContentFormat = "TAR"
	CodeContentFormat_TARGZ CodeContentFormat = "TAR_GZ"
)

type CodeLanguage

type CodeLanguage string
const (
	CodeLanguage_PYTHON     CodeLanguage = "PYTHON"
	CodeLanguage_JAVASCRIPT CodeLanguage = "JAVASCRIPT"
)

type CodeMapper

type CodeMapper struct {
}

func NewCodeMapper

func NewCodeMapper() *CodeMapper

func (*CodeMapper) FromProperties

func (m *CodeMapper) FromProperties(properties map[string]*structpb.Value) *Code

func (*CodeMapper) FromRecord

func (m *CodeMapper) FromRecord(record *model.Record) *Code

func (*CodeMapper) New

func (m *CodeMapper) New() *Code

func (*CodeMapper) ResourceIdentity

func (m *CodeMapper) ResourceIdentity() abs.ResourceIdentity

func (*CodeMapper) ToProperties

func (m *CodeMapper) ToProperties(code *Code) map[string]*structpb.Value

func (*CodeMapper) ToRecord

func (m *CodeMapper) ToRecord(code *Code) *model.Record

func (*CodeMapper) ToUnstructured added in v1.3.43

func (m *CodeMapper) ToUnstructured(code *Code) unstructured.Unstructured

Directories

Path Synopsis
api
aws

Jump to

Keyboard shortcuts

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