blob: 5457a2a90224d9d6a87f1fbaabc6b190385cc6c7 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
brooklyn.catalog:
id: basic-with-constraint
version: 1.0.0-SNAPSHOT
itemType: entity
item:
type: org.apache.brooklyn.entity.stock.BasicEntity
brooklyn.parameters:
- name: post_code
constraints:
- requiredUnless: zip-code
- name: zip_code
constraints:
- forbiddenIf: post_code
tags:
- ui-composer-hints:
config-quick-fixes:
- key: zip_code
fix: clear_config
message-regex: cannot both be set
- # set from existing key matching [.*_|]postal_code[|_.*] on ancestor
key: post_code
fix: set_from_key
message-regex: required
source-key: postal_code
source-key-regex: (_|^)postal_code(_|$) # will match e.g. cust1_postal_code and postal_core_north but not postal_codex
source-hierarchy: ancestors # on self or any ancestor
- # create key postal_code at root
key: post_code
fix: set_from_key
message-regex: required
source-key: postal_code
source-key-createable: true # will create if not present
source-hierarchy: root # but only at root
source-key-parameter-definition:
constraints:
- required
- # use this key on any other entity of the same type
key: post_code
fix: set_from_key
message-regex: required
source-key: post_code # will match the key
source-hierarchy: anywhere # anywhere
source-types: [ basic-with-constraint ] # of this type
- key: post_code
fix: set_from_template
message-regex: required
template: ${application}-${entity} # required, the template, supporting vars application, application.id, entity, entity.name, entity._id
preview: "Set ${entity.type} post_code '${application}-<entity_name_or_id>'" # optional, summary for button, grouping fixes, and filtering (template rules applied to this, skipped if not applicable)
sanitize: _ # optional, sanitize as specified, eg _ or - or '.' to replace non-alphanumeric chars with that