resources

package
v1.2.21 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const OpenApiInternal = "internal"
View Source
const OpenApiMeta = "meta"

Variables

View Source
var AuditLogResource = &model.Resource{
	Name:      "AuditLog",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "audit_log",
	},
	Immutable: true,
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		{
			Name:     "namespace",
			Length:   256,
			Type:     model.ResourceProperty_STRING,
			Required: true,
		},
		{
			Name:     "resource",
			Length:   256,
			Type:     model.ResourceProperty_STRING,
			Required: true,
		},
		{
			Name:     "recordId",
			Length:   256,
			Type:     model.ResourceProperty_STRING,
			Required: true,
			Annotations: map[string]string{
				annotations.SourceDef: "record_id",
			},
		},
		{
			Name:     "time",
			Type:     model.ResourceProperty_TIMESTAMP,
			Required: true,
		},
		{
			Name:     "username",
			Type:     model.ResourceProperty_STRING,
			Required: true,
		},
		{
			Name:     "operation",
			Type:     model.ResourceProperty_ENUM,
			Required: true,
			EnumValues: []string{
				"CREATE",
				"UPDATE",
				"DELETE",
			},
		},
		{
			Name:     "properties",
			Type:     model.ResourceProperty_OBJECT,
			Required: false,
		},
		special.AnnotationsProperty,
	},
	Annotations: map[string]string{
		annotations.OpenApiGroup:     OpenApiInternal,
		annotations.BypassExtensions: annotations.Enabled,
	},
}
View Source
var DataSourceResource = &model.Resource{
	Name:      "DataSource",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "data_source",
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "name",
			Length:   64,
			Unique:   true,
			Type:     model.ResourceProperty_STRING,
			Required: true,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "description",
			Length:   64,
			Type:     model.ResourceProperty_STRING,
			Required: false,
			Annotations: map[string]string{
				annotations.AllowEmptyPrimitive: annotations.Enabled,
			},
		},
		{
			Name:     "backend",
			Type:     model.ResourceProperty_ENUM,
			Required: true,
			EnumValues: []string{
				"POSTGRESQL",
				"MYSQL",
				"MONGODB",
				"REDIS",
			},
		},
		{
			Name:     "options",
			Required: true,
			Type:     model.ResourceProperty_MAP,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_STRING,
			},
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  "true",
		annotations.OpenApiGroup: OpenApiInternal,
	},
}
View Source
var ExtensionResource = &model.Resource{
	Name:      "Extension",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "extension",
	},
	Types: []*model.ResourceSubType{
		sub_types.BooleanExpression,
		sub_types.PairExpression,
		sub_types.RefValue,
		sub_types.RegexMatchExpression,
		sub_types.Expression,
		{
			Name: "FunctionCall",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:     "host",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
				{
					Name:     "functionName",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
			},
		},
		{
			Name: "HttpCall",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:     "uri",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
				{
					Name:     "method",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
			},
		},
		{
			Name: "ChannelCall",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:     "channelKey",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
			},
		},
		{
			Name: "ExternalCall",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:    "functionCall",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer("FunctionCall"),
				},
				{
					Name:    "httpCall",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer("HttpCall"),
				},
				{
					Name:    "channelCall",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer("ChannelCall"),
				},
			},
		},
		{
			Name: "EventSelector",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name: "actions",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Name: "action",
						Type: model.ResourceProperty_ENUM,
						EnumValues: []string{
							"CREATE",
							"UPDATE",
							"DELETE",
							"GET",
							"LIST",
							"OPERATE",
						},
						Annotations: map[string]string{
							annotations.TypeName: "EventAction",
						},
					},
				},
				{
					Name:    "recordSelector",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer(sub_types.BooleanExpression.Name),
				},
				{
					Name: "namespaces",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{Type: model.ResourceProperty_STRING},
				},
				{
					Name: "resources",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{Type: model.ResourceProperty_STRING},
				},
				{
					Name: "ids",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{Type: model.ResourceProperty_STRING},
				},
				special.AnnotationsProperty,
			},
		},
		{
			Name: "RecordSearchParams",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:    "query",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: &sub_types.BooleanExpression.Name,
				},
				{
					Name: "limit",
					Type: model.ResourceProperty_INT32,
				},
				{
					Name: "offset",
					Type: model.ResourceProperty_INT32,
				},
				{
					Name: "resolveReferences",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Type: model.ResourceProperty_STRING,
					},
				},
			},
		},
		{
			Name: "Event",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name:      "id",
					Type:      model.ResourceProperty_STRING,
					Required:  true,
					Immutable: true,
				},
				{
					Name: "action",
					Type: model.ResourceProperty_ENUM,
					EnumValues: []string{
						"CREATE",
						"UPDATE",
						"DELETE",
						"GET",
						"LIST",
						"OPERATE",
					},
					Required: true,
				},
				{
					Name:    "recordSearchParams",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer("RecordSearchParams"),
				},
				{
					Name: "actionSummary",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "actionDescription",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "resource",
					Type: model.ResourceProperty_REFERENCE,
					Reference: &model.Reference{
						Resource: "Resource",
					},
				},
				{
					Name: "records",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Type: model.ResourceProperty_REFERENCE,
						Reference: &model.Reference{
							Resource: "Record",
						},
					},
				},
				{
					Name: "ids",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Type: model.ResourceProperty_STRING,
					},
				},
				{
					Name: "finalizes",
					Type: model.ResourceProperty_BOOL,
				},
				{
					Name: "sync",
					Type: model.ResourceProperty_BOOL,
				},
				{
					Name: "time",
					Type: model.ResourceProperty_TIMESTAMP,
				},
				{
					Name: "total",
					Type: model.ResourceProperty_INT64,
				},
				{
					Name: "actionName",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "input",
					Type: model.ResourceProperty_OBJECT,
				},
				{
					Name: "output",
					Type: model.ResourceProperty_OBJECT,
				},
				special.AnnotationsProperty,
				{
					Name:    "error",
					Type:    model.ResourceProperty_STRUCT,
					TypeRef: util.Pointer("Error"),
				},
			},
		},
		{
			Name: "ErrorField",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name: "recordId",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "property",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "message",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "value",
					Type: model.ResourceProperty_OBJECT,
				},
			},
		},
		{
			Name: "Error",
			Annotations: map[string]string{
				annotations.CommonType: annotations.Enabled,
			},
			Properties: []*model.ResourceProperty{
				{
					Name: "code",
					Type: model.ResourceProperty_ENUM,
					EnumValues: []string{
						"UNKNOWN_ERROR",
						"RECORD_NOT_FOUND",
						"UNABLE_TO_LOCATE_PRIMARY_KEY",
						"INTERNAL_ERROR",
						"PROPERTY_NOT_FOUND",
						"RECORD_VALIDATION_ERROR",
						"RESOURCE_VALIDATION_ERROR",
						"AUTHENTICATION_FAILED",
						"ALREADY_EXISTS",
						"ACCESS_DENIED",
						"BACKEND_ERROR",
						"UNIQUE_VIOLATION",
						"REFERENCE_VIOLATION",
						"RESOURCE_NOT_FOUND",
						"UNSUPPORTED_OPERATION",
						"EXTERNAL_BACKEND_COMMUNICATION_ERROR",
						"EXTERNAL_BACKEND_ERROR",
						"RATE_LIMIT_ERROR",
					},
				},
				{
					Name: "message",
					Type: model.ResourceProperty_STRING,
				},
				{
					Name: "fields",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Type:    model.ResourceProperty_STRUCT,
						TypeRef: util.Pointer("ErrorField"),
					},
				},
			},
		},
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "name",
			Length:   64,
			Type:     model.ResourceProperty_STRING,
			Unique:   true,
			Required: true,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "description",
			Length:   64,
			Type:     model.ResourceProperty_STRING,
			Required: false,
		},
		{
			Name:     "selector",
			Type:     model.ResourceProperty_STRUCT,
			Required: false,
			TypeRef:  util.Pointer("EventSelector"),
		},
		{
			Name:     "order",
			Type:     model.ResourceProperty_INT32,
			Required: true,
		},
		{
			Name:     "finalizes",
			Type:     model.ResourceProperty_BOOL,
			Required: true,
		},
		{
			Name:     "sync",
			Type:     model.ResourceProperty_BOOL,
			Required: true,
		},
		{
			Name:     "responds",
			Type:     model.ResourceProperty_BOOL,
			Required: true,
		},
		{
			Name:     "call",
			Type:     model.ResourceProperty_STRUCT,
			Required: true,
			TypeRef:  util.Pointer("ExternalCall"),
		},
		special.AnnotationsProperty,
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  "true",
		annotations.OpenApiGroup: OpenApiInternal,
	},
}
View Source
var NamespaceResource = &model.Resource{
	Name:      "Namespace",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "namespace",
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:      "name",
			Type:      model.ResourceProperty_STRING,
			Length:    256,
			Required:  true,
			Unique:    true,
			Immutable: true,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "description",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "details",
			Type:     model.ResourceProperty_OBJECT,
			Required: false,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  "true",
		annotations.OpenApiGroup: OpenApiInternal,
	},
}
View Source
var PermissionResource = &model.Resource{
	Name:      "Permission",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "permission",
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:   "namespace",
			Type:   model.ResourceProperty_STRING,
			Length: 255,
		},
		{
			Name:   "resource",
			Type:   model.ResourceProperty_STRING,
			Length: 255,
		},
		{
			Name:     "property",
			Type:     model.ResourceProperty_STRING,
			Length:   255,
			Required: false,
		},
		{
			Name:     "propertyValue",
			Type:     model.ResourceProperty_STRING,
			Length:   255,
			Required: false,
		},
		{
			Name:   "propertyMode",
			Type:   model.ResourceProperty_ENUM,
			Length: 255,
			EnumValues: []string{
				"PROPERTY_MATCH_ONLY",
				"PROPERTY_MATCH_ANY",
			},
		},
		{
			Name:         "operation",
			Type:         model.ResourceProperty_ENUM,
			Length:       255,
			Required:     true,
			DefaultValue: structpb.NewStringValue("FULL"),
			EnumValues: []string{
				"READ",
				"CREATE",
				"UPDATE",
				"DELETE",
				"FULL",
			},
		},
		{
			Name: "recordIds",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_STRING,
			},
		},
		{
			Name: "before",
			Type: model.ResourceProperty_TIMESTAMP,
		},
		{
			Name: "after",
			Type: model.ResourceProperty_TIMESTAMP,
		},
		{
			Name: "user",
			Type: model.ResourceProperty_REFERENCE,
			Reference: &model.Reference{
				Namespace: UserResource.Namespace,
				Resource:  UserResource.Name,
			},
		},
		{
			Name: "role",
			Type: model.ResourceProperty_REFERENCE,
			Reference: &model.Reference{
				Namespace: RoleResource.Namespace,
				Resource:  RoleResource.Name,
			},
		},
		{
			Name:     "permit",
			Required: true,
			Length:   255,
			Type:     model.ResourceProperty_ENUM,
			EnumValues: []string{
				"ALLOW",
				"REJECT",
			},
		},
		{
			Name: "localFlags",
			Type: model.ResourceProperty_OBJECT,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  annotations.Enabled,
		annotations.OpenApiGroup: OpenApiMeta,
	},
}
View Source
var PropertyType = &model.ResourceSubType{
	Name: "Property",
	Annotations: map[string]string{
		annotations.CommonType: annotations.Enabled,
	},
	Properties: ResourcePropertyProperties,
}
View Source
var RecordResource = &model.Resource{
	Name:      "Record",
	Namespace: "system",
	Virtual:   true,
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		{
			Name:     "properties",
			Type:     model.ResourceProperty_OBJECT,
			Required: true,
		},
		{
			Name: "packedProperties",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_OBJECT,
			},
		},
	},

	Annotations: map[string]string{

		annotations.RestApiDisabled: annotations.Enabled,
	},
}
View Source
var ReferenceType = &model.ResourceSubType{
	Name: "Reference",
	Annotations: map[string]string{
		annotations.CommonType: annotations.Enabled,
	},
	Properties: []*model.ResourceProperty{
		{
			Name: "resource",
			Type: model.ResourceProperty_REFERENCE,
			Reference: &model.Reference{
				Namespace: "system",
				Resource:  "Resource",
			},
		},
		{
			Name: "cascade",
			Type: model.ResourceProperty_BOOL,
		},
		{
			Name: "backReference",
			Type: model.ResourceProperty_STRING,
		},
	},
}
View Source
var ResourceActionResource = &model.Resource{
	Name:      "ResourceAction",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "resource_action",
	},
	Types: []*model.ResourceSubType{
		SubTypeType,
		ReferenceType,
		PropertyType,
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "resource",
			Type:     model.ResourceProperty_REFERENCE,
			Required: true,
			Reference: &model.Reference{
				Resource:  ResourceResource.Name,
				Namespace: ResourceResource.Namespace,
				Cascade:   false,
			},
		},
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: true,
			Unique:   false,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "title",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
			Unique:   false,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "description",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
			Unique:   false,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:         "internal",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: structpb.NewBoolValue(false),
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "types",
			Type:     model.ResourceProperty_LIST,
			Required: false,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("SubType"),
			},
		},
		{
			Name: "input",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("Property"),
			},
		},
		{
			Name:    "output",
			Type:    model.ResourceProperty_STRUCT,
			TypeRef: util.Pointer("Property"),
		},
		special.AnnotationsProperty,
	},
	Indexes: []*model.ResourceIndex{
		{
			Properties: []*model.ResourceIndexProperty{
				{
					Name: "resource",
				},
				{
					Name: "name",
				},
			},
			Unique: true,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:     annotations.Enabled,
		annotations.RestApiDisabled: annotations.Enabled,
		annotations.OpenApiGroup:    OpenApiMeta,
	},
}
View Source
var ResourcePropertyProperties = []*model.ResourceProperty{
	{
		Name:     "name",
		Type:     model.ResourceProperty_STRING,
		Length:   256,
		Required: false,
	},
	{
		Name: "type",
		Type: model.ResourceProperty_ENUM,
		EnumValues: []string{
			"BOOL",
			"STRING",
			"FLOAT32",
			"FLOAT64",
			"INT32",
			"INT64",
			"BYTES",
			"UUID",
			"DATE",
			"TIME",
			"TIMESTAMP",
			"OBJECT",
			"MAP",
			"LIST",
			"REFERENCE",
			"ENUM",
			"STRUCT",
		},
		Required: true,
	},
	{
		Name:     "typeRef",
		Type:     model.ResourceProperty_STRING,
		Length:   256,
		Required: false,
	},
	{
		Name:         "primary",
		Type:         model.ResourceProperty_BOOL,
		Required:     true,
		DefaultValue: structpb.NewBoolValue(false),
	},
	{
		Name:         "required",
		Type:         model.ResourceProperty_BOOL,
		Required:     true,
		DefaultValue: structpb.NewBoolValue(false),
	},
	{
		Name:         "unique",
		Type:         model.ResourceProperty_BOOL,
		Required:     true,
		DefaultValue: structpb.NewBoolValue(false),
	},
	{
		Name:         "immutable",
		Type:         model.ResourceProperty_BOOL,
		Required:     true,
		DefaultValue: structpb.NewBoolValue(false),
	},
	{
		Name:         "length",
		Type:         model.ResourceProperty_INT32,
		Required:     true,
		DefaultValue: structpb.NewNumberValue(256),
	},
	{
		Name:     "item",
		Type:     model.ResourceProperty_STRUCT,
		Required: false,
		TypeRef:  util.Pointer("Property"),
	},
	{
		Name:    "reference",
		Type:    model.ResourceProperty_STRUCT,
		TypeRef: util.Pointer("Reference"),
	},
	{
		Name:     "defaultValue",
		Type:     model.ResourceProperty_OBJECT,
		Required: false,
	},
	{
		Name: "enumValues",
		Type: model.ResourceProperty_LIST,
		Item: &model.ResourceProperty{
			Type: model.ResourceProperty_STRING,
		},
		Required: false,
	},
	{
		Name:     "exampleValue",
		Type:     model.ResourceProperty_OBJECT,
		Required: false,
	},
	{
		Name:     "title",
		Type:     model.ResourceProperty_STRING,
		Length:   256,
		Required: false,
	},
	{
		Name:     "description",
		Type:     model.ResourceProperty_STRING,
		Length:   256,
		Required: false,
	},
	special.AnnotationsProperty,
}
View Source
var ResourceResource = &model.Resource{
	Name:      "Resource",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "resource",
	},
	Types: []*model.ResourceSubType{
		PropertyType,
		SubTypeType,
		{
			Name: "IndexProperty",
			Properties: []*model.ResourceProperty{
				{
					Name:     "name",
					Type:     model.ResourceProperty_STRING,
					Required: true,
				},
				{
					Name:     "order",
					Type:     model.ResourceProperty_ENUM,
					Required: false,
					EnumValues: []string{
						"UNKNOWN", "ASC", "DESC",
					},
					DefaultValue: structpb.NewStringValue("ASC"),
				},
			},
		},
		{
			Name: "Index",
			Properties: []*model.ResourceProperty{
				{
					Name: "properties",
					Type: model.ResourceProperty_LIST,
					Item: &model.ResourceProperty{
						Type:    model.ResourceProperty_STRUCT,
						TypeRef: util.Pointer("IndexProperty"),
					},
				},
				{
					Name:     "indexType",
					Type:     model.ResourceProperty_ENUM,
					Required: false,
					EnumValues: []string{
						"BTREE", "HASH",
					},
					DefaultValue: structpb.NewStringValue("BTREE"),
				},
				{
					Name:     "unique",
					Type:     model.ResourceProperty_BOOL,
					Required: false,
				},
				special.AnnotationsProperty,
			},
		},
		ReferenceType,
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: true,
			Unique:   false,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "namespace",
			Type:     model.ResourceProperty_REFERENCE,
			Required: true,
			Reference: &model.Reference{
				Resource:  NamespaceResource.Name,
				Namespace: NamespaceResource.Namespace,
				Cascade:   false,
			},
		},
		{
			Name:         "virtual",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: structpb.NewBoolValue(false),
		},
		{
			Name:     "properties",
			Type:     model.ResourceProperty_LIST,
			Required: true,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("Property"),
			},
		},
		{
			Name:     "indexes",
			Type:     model.ResourceProperty_LIST,
			Required: false,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("Index"),
			},
		},
		{
			Name:     "types",
			Type:     model.ResourceProperty_LIST,
			Required: false,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("SubType"),
			},
		},
		{
			Name:         "immutable",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: structpb.NewBoolValue(false),
		},
		{
			Name:         "abstract",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: structpb.NewBoolValue(false),
		},
		{
			Name:         "checkReferences",
			Type:         model.ResourceProperty_BOOL,
			Required:     true,
			DefaultValue: structpb.NewBoolValue(false),
		},
		{
			Name:     "dataSource",
			Type:     model.ResourceProperty_REFERENCE,
			Required: false,
			Reference: &model.Reference{
				Resource:  DataSourceResource.Name,
				Namespace: DataSourceResource.Namespace,
				Cascade:   false,
			},
		},
		{
			Name:     "entity",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "catalog",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "title",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "description",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		special.AnnotationsProperty,
	},
	Indexes: []*model.ResourceIndex{
		{
			Properties: []*model.ResourceIndexProperty{
				{
					Name: "namespace",
				},
				{
					Name: "name",
				},
			},
			Unique: true,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:     annotations.Enabled,
		annotations.RestApiDisabled: annotations.Enabled,
		annotations.OpenApiGroup:    OpenApiMeta,
	},
}
View Source
var RoleResource = &model.Resource{
	Name:      "Role",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "role",
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: true,
			Unique:   true,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name: "permissions",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_REFERENCE,
				Reference: &model.Reference{
					Namespace: "system",
					Resource:  "Permission",
				},
				BackReference: &model.BackReference{
					Property: "role",
				},
			},
			Required: false,
		},
		{
			Name: "details",

			Type: model.ResourceProperty_OBJECT,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  annotations.Enabled,
		annotations.OpenApiGroup: OpenApiMeta,
	},
}
View Source
var SubTypeType = &model.ResourceSubType{
	Name: "SubType",
	Annotations: map[string]string{
		annotations.CommonType: annotations.Enabled,
	},
	Properties: []*model.ResourceProperty{
		{
			Name:     "name",
			Type:     model.ResourceProperty_STRING,
			Required: true,
		},
		{
			Name:     "title",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "description",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name:     "properties",
			Type:     model.ResourceProperty_LIST,
			Required: true,
			Item: &model.ResourceProperty{
				Type:    model.ResourceProperty_STRUCT,
				TypeRef: util.Pointer("Property"),
			},
		},
	},
}
View Source
var UserResource = &model.Resource{
	Name:      "User",
	Namespace: "system",
	SourceConfig: &model.ResourceSourceConfig{
		DataSource: "system",
		Entity:     "user",
	},
	Properties: []*model.ResourceProperty{
		special.IdProperty,
		special.VersionProperty,
		special.AuditProperties[0],
		special.AuditProperties[1],
		special.AuditProperties[2],
		special.AuditProperties[3],
		{
			Name:     "username",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: true,
			Unique:   true,
			Annotations: map[string]string{
				annotations.IsHclLabel: annotations.Enabled,
			},
		},
		{
			Name:     "password",
			Type:     model.ResourceProperty_STRING,
			Length:   256,
			Required: false,
		},
		{
			Name: "roles",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_REFERENCE,
				Reference: &model.Reference{
					Namespace: RoleResource.Namespace,
					Resource:  RoleResource.Name,
				},
			},
		},
		{
			Name: "permissions",
			Type: model.ResourceProperty_LIST,
			Item: &model.ResourceProperty{
				Type: model.ResourceProperty_REFERENCE,
				Reference: &model.Reference{
					Namespace: "system",
					Resource:  "Permission",
				},
				BackReference: &model.BackReference{
					Property: "user",
				},
			},
			Required: false,
		},
		{
			Name: "details",
			Type: model.ResourceProperty_OBJECT,
		},
	},
	Annotations: map[string]string{
		annotations.EnableAudit:  annotations.Enabled,
		annotations.OpenApiGroup: OpenApiMeta,
	},
}

Functions

func GetAllSystemResources

func GetAllSystemResources() []*model.Resource

func GetSystemResourceType

func GetSystemResourceType(resource *model.Resource) proto.Message

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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