0.1.50 • Published 9 months ago

@azbake/ingredient-property-service v0.1.50

Weekly downloads
47
License
MIT
Repository
github
Last release
9 months ago

Changelogs

Overview

The Property Service ingredient is a plugin for bake. When included in a recipe, this plugin will allow the pipeline to manage properties and secrets in the Property Service. You can add, update, and delete properties and secrets by specifying the name and selectors for each property or secret.

Encryption keys and certificates are not supported at this time.

Usage

Property Service Configuration

Ingredient Source

The ingredient's source field specifies the baseUrl and resourceUrl fields. Both of these fields are required.

  • The baseUrl is a fully qualified url for the Property Service.
  • The resourceUrl is a fully qualified url to the Azure Application Registeration.
name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        # URL to the property service.
        baseUrl: https://propertyservice.com
        # URL to the application registration for the property service.
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000

Parameters

The ingredient's parameters field allow you to define an array of properties and and array of secrets. Within these arrays you define the create, update, delete operations to be executed against the Property Service.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      # Define property and secret operations.
      parameters:
        # Property create, update, and delete operations.
        properties:
          create:
          update:
          delete:
        # Secret create, update, and delete operations.
        secrets:
          create:
          update:
          delete:

Variables

All of the configuration values within the create, update, and delete operations support BakeVariables. You can define the BakeVariables within the variables section of the ingredient and reference the variables inside your create, update, and delete operations. Before the operation is executed, the BakeVariables are resolved to their respective value.

Defining variables is optional. If you choose to use variables, they must have a unique key. You can place just about anything within a BakeVariables value.

In the following example a create operation is defined with the name, value, selectors, contentType, and expirationDate being resolved to the bake variables defined. The activeDate is not using a bake variable.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
 # Define your variables to be used in your create, update, and delete operations below.
variables:
  property-name: property-name
  property-value: property-value
  property-selectors:
    key1: value1
    key2: value2
  property-contentType: text/plain
  property-expirationDate: 2020-12-20 11:00:00
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          create:
            # Access your variables by using the coreutils.variables function and specifying the variable name.
            - name: "[coreutils.variable('property-name')]"
              value: "[coreutils.variable('property-value')]"
              selectors: "[coreutils.variable('property-selectors')]"
              contentType: "[coreutils.variable('property-contentType')]"
              expirationDate: "[coreutils.variable('property-expirationDate')]"
              # You can use literal values and variables together.
              activeDate: 2020-06-20 11:00:00

The above create operation will resolve the variables to the following values:

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
 # Define your variables to be used in your create, update, and delete operations below.
variables:
  property-name: property-name
  property-value: property-value
  property-selectors:
    key1: value1
    key2: value2
  property-contentType: text/plain
  property-expirationDate: 2020-12-20 11:00:00
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          create:
             # The above create operation will resolve to the following values:
            - name: property-name
              value: property-value
              selectors:
                key1: value1
                key2: value2
              contentType: text/plain
              expirationDate: 2020-12-20 11:00:00
              activeDate: 2020-06-20 11:00:00

Property Operations

Properties contain values that are non-sensitive. Whenever you define a property, you must give the property a name and a value.

While the selectors are optional, You will likely want to define selectors for your property so that you can easily query and manage it.

You would not define selectors when you have a value that does not change from entity to entity. Another use case for not defining selectors is to use that property as the default property, were you create a default property and if an entity needs to override the default you create a property specific to said entity.

Within the properties parameter you define what operations to execute. The properties parameter supports executing create, update, or delete operations.

Property Create Operation

The create operation allows you to create a property. If the property already exists, it will be updated. If the property matches a property already stored in the Property Service, the operation will not be executed.

PropertyData TypeRequiredDescription
nameStringXThe name of the property.
valueStringXThe value of the property.
selectorsString DictionaryThe selectors of the property.
contentTypeStringThe content-type of the property value.
expirationDateDateThe expiration date of the property in UTC.
activeDateDateThe active date of the property in UTC.

NOTE: The name and selectors combination must be unique.

Property Create Validation

The create operation validates the following before the operation is executed.

PropertyValidation
nameThe value is not null, empty, or white-space.
valueThe value is not null, empty, or white-space.
expirationDateThe value is not a date in the past.
activeDateThe value is greater than the expirationDate, if one is defined.

Property Create Example

In the following example a create operation is defined.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          create:
            # The name is required.
            - name: property-name
              # The value is required.
              value: property-value
              selectors:
                key1: value1
                key2: value2
              contentType: text/plain
              expirationDate: 2020-12-20 11:00:00
              activeDate: 2020-06-20 11:00:00

Property Update Operations

The update operation allows you to update an existing property. If the property matches a property already stored in the Property Service, the operation will not be executed. If the property does not exist on the server an exception will be raised.

The target object allows you to specify the name and selectors of the property you want to update.

PropertyData TypeRequiredDescription
nameStringXThe name of the property.
selectorsString DictionaryThe selectors of the property.

Once you have your target defined, you need to specify one or more of the values to be updated.

PropertyData TypeRequiredDescription
targetTarget ObjectXThe target property to be updated.
nameStringThe name of the property.
valueStringThe value of the property.
selectorsString DictionaryThe selectors of the property.
contentTypeStringThe content-type of the property value.
expirationDateDateThe expiration date of the property in UTC.
activeDateDateThe active date of the property in UTC.

NOTE: You must specify the target and one or more of the properties to update.

Property Update Validation

The update operation validates the following before the operation is executed.

PropertyValidation
activeDateThe value is greater than the expirationDate, if one is defined.
targetThe target's name is not null, empty, or white-space.
targetOne or more property values have been defined.

Property Update Example

In the following example an update operation is defined. The system will search for a property with the name of property-name that has the selectors equal to key1:value1 and key2:value2.

It will update the following values:

  • value to property-updated-value
  • selectors to key3:value3 and key4:value4
  • contentType to text/json
  • expirationDate to 2030-12-20 11:00:00
name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          update:
            - target:
                # The target name is required.
                name: property-name
                selectors:
                  key1: value1
                  key2: value2
              # You must define one or more of the property values to update.
              value: property-updated-value
              selectors:
                key3: value3
                key4: value4
              contentType: text/json
              expirationDate: 2030-12-20 11:00:00

In the following example an update operation is defined. The system will search for a property with the name of property-name that has the selectors equal to key1:value1 and key2:value2.

It will update the following values:

  • name to property-updated-name
  • value to property-updated-value
name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          update:
            - target:
                # The target name is required.
                name: property-name
                selectors:
                  key1: value1
                  key2: value2
              # You must define one or more of the property values to update.
              name: property-updated-name
              value: property-updated-value

Property Delete Operations

The delete operation allows you to delete properties. If the property does not exist on the server an exception will be raised.

PropertyData TypeRequiredDescription
nameStringXThe name of the property.
operatorSearchOperatorXThe type of search to execute.
selectorsString DictionaryThe selectors of the property.

The operator can be one of the following values:

  • None: Searches for properties by name only.
  • Equals: Searches for properties that equal the specified selectors.
  • Contains: Searches for properties that contain the specified selectors.

NOTE: If the operator is None then you cannot define any selectors and if the operator is Equals or Contains then you must define one or more selectors.

Property Delete Validation

The delete operation validates the following before the operation is executed.

PropertyValidation
nameThe value is not null, empty, or white-space.
operatorThe value is None, Equals, or Contains.
selectorsThe value is undefined if the operator is None.
selectorsThe value contains one or more key value pairs if the operator is Equals or Contains.

Property Delete Example

In the following example a delete operation is defined. The system will search for a property with the name of property-name that has the selectors equal to key1:value1 and key2:value2 and delete the property.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          delete:
            # The name is required.
            - name: property-name
              # The operator is required.
              operator: Equals
              selectors:
                key1: value1
                key2: value2

In the following example a delete operation is defined. The system will search for a property with the name of property-name that has the selectors containing to key1:value1 and delete the properties.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          delete:
            # The name is required.
            - name: property-name
              # The operator is required.
              operator: Conatins
              selectors:
                key1: value1

In the following example a delete operation is defined. The system will search for a properties with the name of property-name and delete the properties.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        properties:
          delete:
            # The name is required.
            - name: property-name
              # The operator is required.
              operator: None

Secret Operations

Secrets contain values that are sensitive such as a password or api key. Whenever you define a secret, you must give the secret a name and a value.

While the selectors are optional, You will likely want to define selectors for your secret so that you can easily query and manage it.

You would not define selectors when you have a value that does not change from entity to entity. Another use case for not defining selectors is to use that secret as the default secret, were you create a default secret and if an entity needs to override the default you create a secret specific to said entity.

Within the secrets parameter you define what operations to execute. The secrets parameter supports executing create, update, or delete operations.

Secret Create Operation

The create operation allows you to create a secret. If the secret already exists, it will be updated. If the secret matches a secret already stored in the Property Service, the operation will not be executed.

PropertyData TypeRequiredDescription
nameStringXThe name of the secret.
valueStringXThe value of the secret.
selectorsString DictionaryThe selectors of the secret.
contentTypeStringThe content-type of the secret value.
expirationDateDateThe expiration date of the secret in UTC.
activeDateDateThe active date of the secret in UTC.

NOTE: The name and selectors combination must be unique.

Secret Create Validation

The create operation validates the following before the operation is executed.

PropertyValidation
nameThe value is not null, empty, or white-space.
valueThe value is not null, empty, or white-space.
expirationDateThe value is not a date in the past.
activeDateThe value is greater than the expirationDate, if one is defined.

Secret Create Example

In the following example a create operation is defined.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          create:
            # The name is required.
            - name: secret-name
              # The value is required.
              value: secret-value
              selectors:
                key1: value1
                key2: value2
              contentType: text/plain
              expirationDate: 2020-12-20 11:00:00
              activeDate: 2020-06-20 11:00:00

Secret Update Operations

The update operation allows you to update an existing secret. If the secret matches a secret already stored in the Property Service, the operation will not be executed. If the secret does not exist on the server an exception will be raised.

The target object allows you to specify the name and selectors of the secret you want to update.

PropertyData TypeRequiredDescription
nameStringXThe name of the secret.
selectorsString DictionaryThe selectors of the secret.

Once you have your target defined, you need to specify one or more of the values to be updated.

PropertyData TypeRequiredDescription
targetTarget ObjectXThe target secret to be updated.
nameStringThe name of the secret.
valueStringThe value of the secret.
selectorsString DictionaryThe selectors of the secret.
contentTypeStringThe content-type of the secret value.
expirationDateDateThe expiration date of the secret in UTC.
activeDateDateThe active date of the secret in UTC.

NOTE: You must specify the target and one or more of the secrets to update.

Secret Update Validation

The update operation validates the following before the operation is executed.

PropertyValidation
activeDateThe value is greater than the expirationDate, if one is defined.
targetThe target's name is not null, empty, or white-space.
targetOne or more secret values have been defined.

Secret Update Example

In the following example an update operation is defined. The system will search for a secret with the name of secret-name that has the selectors equal to key1:value1 and key2:value2.

It will update the following values:

  • value to secret-updated-value_
  • selectors to key3:value3 and key4:value4
  • contentType to text/json
  • expirationDate to 2030-12-20 11:00:00
name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          update:
            - target:
                # The target name is required.
                name: secret-name
                selectors:
                  key1: value1
                  key2: value2
              # You must define one or more of the secrets values to update.
              value: secret-updated-value
              selectors:
                key3: value3
                key4: value4
              contentType: text/json
              expirationDate: 2030-12-20 11:00:00

In the following example an update operation is defined. The system will search for a secret with the name of secret-name that has the selectors equal to key1:value1 and key2:value2.

It will update the following values:

  • name to secret-updated-name
  • value to secret-updated-value
name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          update:
            - target:
                # The target name is required.
                name: secret-name
                selectors:
                  key1: value1
                  key2: value2
              # You must define one or more of the secrets values to update.
              name: secret-updated-name
              value: secret-updated-value

Secret Delete Operations

The delete operation allows you to delete secrets. If the secret does not exist on the server an exception will be raised.

PropertyData TypeRequiredDescription
nameStringXThe name of the secret.
operatorSearchOperatorXThe type of search to execute.
selectorsString DictionaryThe selectors of the secret.
allVersionsBooleantrue to delete all version of the secret, otherwise it will only delete the current version.

The operator can be one of the following values:

  • None: Searches for secrets by name only.
  • Equals: Searches for secrets that equal the specified selectors.
  • Contains: Searches for secrets that contain the specified selectors.

NOTE: If the operator is None then you cannot define any selectors and if the operator is Equals or Contains then you must define one or more selectors.

Secret Delete Validation

The delete operation validates the following before the operation is executed.

PropertyValidation
nameThe value is not null, empty, or white-space.
operatorThe value is None, Equals, or Contains.
selectorsThe value is undefined if the operator is None.
selectorsThe value contains one or more key value pairs if the operator is Equals or Contains.

Secret Delete Example

In the following example a delete operation is defined. The system will search for a secret with the name of secret-name that has the selectors equal to key1:value1 and key2:value2 and delete all versions of the secret.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          delete:
            # The name is required.
            - name: secret-name
              # The operator is required.
              operator: Equals
              selectors:
                key1: value1
                key2: value2
              allVersions: true

In the following example a delete operation is defined. The system will search for a secret with the name of secret-name that has the selectors containing to key1:value1 and delete only the latest version of the secret.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          delete:
            # The name is required.
            - name: secret-name
              # The operator is required.
              operator: Conatins
              selectors:
                key1: value1
              allVersions: false

In the following example a delete operation is defined. The system will search for a secrets with the name of secret-name and delete all versions of the secret.

name: Package Example
shortName: expl
version: 1.0.0
ingredients:
  - "@azbake/ingredient-property-service@~0"
resourceGroup: false
parallelRegions: false
variables:
recipe:
  property-service:
    properties:
      type: "@azbake/ingredient-property-service"
      source:
        baseUrl: https://propertyservice.com
        resourceUrl: https://azure.onmicrosoft.com/00000000-0000-0000-0000-000000000000
      parameters:
        secrets:
          delete:
            # The name is required.
            - name: secret-name
              # The operator is required.
              operator: None
              allVersions: true
0.1.50

9 months ago

0.1.49

1 year ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.1.44

2 years ago

0.1.43

3 years ago

0.1.41

3 years ago

0.1.42

3 years ago

0.1.40

3 years ago

0.1.39

4 years ago

0.1.38

4 years ago

0.1.37

4 years ago

0.1.36

4 years ago

0.1.35

4 years ago

0.1.34

4 years ago

0.1.33

4 years ago

0.1.32

4 years ago

0.1.30

4 years ago

0.1.31

4 years ago

0.1.29

4 years ago

0.1.28

4 years ago

0.1.27

4 years ago

0.1.26

4 years ago

0.1.24

4 years ago

0.1.25

4 years ago

0.1.22

4 years ago

0.1.23

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago