# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/shared-resource.cue
apiVersion: core.oam.dev/v1beta1
kind: PolicyDefinition
metadata:
  annotations:
    definition.oam.dev/description: Configure the resources to be sharable across applications.
  name: shared-resource
  namespace: {{ include "systemDefinitionNamespace" . }}
spec:
  schematic:
    cue:
      template: |
        #SharedResourcePolicyRule: {
        	// +usage=Specify how to select the targets of the rule
        	selector: #ResourcePolicyRuleSelector
        }

        #ResourcePolicyRuleSelector: {
        	// +usage=Select resources by component names
        	componentNames?: [...string]
        	// +usage=Select resources by component types
        	componentTypes?: [...string]
        	// +usage=Select resources by oamTypes (COMPONENT or TRAIT)
        	oamTypes?: [...string]
        	// +usage=Select resources by trait types
        	traitTypes?: [...string]
        	// +usage=Select resources by resource types (like Deployment)
        	resourceTypes?: [...string]
        	// +usage=Select resources by their names
        	resourceNames?: [...string]
        }

        parameter: {
        	// +usage=Specify the list of rules to control shared-resource strategy at resource level.
        	// The selected resource will be sharable across applications. (That means multiple applications
        	// can all read it without conflict, but only the first one can write it)
        	rules?: [...#SharedResourcePolicyRule]
        }

