tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/4.1/types.yaml
- plugin.yaml
# Add this block to import your plugin
plugins:
#any name for your plugin
fico-octa-plugin:
# Give the same details as mentioned while creating the plugin
executor: central_deployment_agent
package_name: oktautil
package_version: '0.1'
distribution_release: ''
distribution_version: ''
supported_platform: ''
distribution: ''
node_templates:
okta_app:
type: fico.nodes.okta.app
properties:
okta_domain: somehost.com
okta_key: <some generated key>
application_json: { get_input: application_json }
okta_group:
type: fico.nodes.okta.group
relationships:
- type: connnect_to_app
target: okta_app
properties:
appid: { get_attrbute: [okta_app, appid] }
properties:
okta_domain: somehost.com
okta_key: <some generated key>
group_name: { get_input: group_name }
group_description: { get_input: group_description }
inputs:
okta_domain:
description: The Okta domain
okta_key:
description: Okta authentication token
application_json:
description: application configuration json as string
group_name:
description: name of okta group
group_description:
description: Group description, give empty string if no description
node_types:
fico.nodes.okta.group:
derived_from: cloudify.nodes.Root
properties:
okta_domain:
type: string
okta_key:
type: string
group_name:
type: string
group_description:
type: string
appid:
type: string
interfaces:
cloudify.interfaces.lifecycle:
start: ## three operations exists for install workflow ('create', 'configure', and 'start'
implementation: fico-okta-plugin.plugin.tasks.create_group
delete: ## 'delete' is an operation for the uninstall workflow.
implementation: fico-okta-plugin.plugin.tasks.delete_group
fico.nodes.okta.app:
derived_from: cloudify.nodes.Root
properties:
application_json:
type: string
okta_domain:
type: string
okta_key:
type: string
appid:
type: string
interfaces:
cloudify.interfaces.lifecycle:
start: ## three operations exists for install workflow ('create', 'configure', and 'start'
implementation: fico-okta-plugin.plugin.tasks.create_app
delete: ## 'delete' is an operation for the uninstall workflow.
implementation: fico-okta-plugin.plugin.tasks.delete_app
... this is the task that creates the app in okta
@operation
def create_app(**kwargs):
... omitting the call to create the app but from the response I am able to get the appid and some other data. Next I take the id and ... add it to the runtime properties:
if 'id' in r:
appid = r['id']
ctx.instance.runtime_properties['appid'] = appid
ctx.logger.info("Application was successfully added to okta with id: {}".format(appid))
...doing some error checking and validation here@operation
def create_group(**kwargs):
if DEBUG:
debugGroup_func('create_group')
gname = ctx.node.properties['group_name']
gdesc = ctx.node.properties['group_description']
okta = OktaClient(ctx.node.properties['okta_key'], ctx.node.properties['okta_domain'], 'https')
target_node_value = ctx.target.instance.runtime_properties['appid']
ctx.source.instance.runtime_properties['appid'] = target_node_value
---
tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/4.1/types.yaml
- plugin.yaml
# Add this block to import your plugin
plugins:
#any name for your plugin
fico-octa-plugin:
# Give the same details as mentioned while creating the plugin
executor: central_deployment_agent
package_name: oktautil
package_version: '0.1'
distribution_release: ''
distribution_version: ''
supported_platform: ''
distribution: ''
node_templates:
okta_app:
type: fico.nodes.okta.app
properties:
okta_domain: <somepassword>
okta_key: <somekey>
application_json: { get_input: application_json }
okta_group:
type: fico.nodes.okta.group
relationships:
- type: cloudify.relationships.depends_on
target: okta_app
properties:
okta_domain: <somepassword>
okta_key: <somekey>
group_name: { get_input: group_name }
group_description: { get_input: group_description }
appid: { get_attribute: [okta_app, appid] }
string
application_json:
type: string
interfaces:
cloudify.interfaces.lifecycle:
configure: ### not used. Had hopped I could create an okta object to be used by all the other tasks.
implementation: fico-okta-plugin.plugin.tasks.configure_app
start: ## three operations exists for install workflow ('create', 'configure', and 'start'
implementation: fico-okta-plugin.plugin.tasks.create_app
delete: ## 'delete' is an operation for the uninstall workflow.
implementation: fico-okta-plugin.plugin.tasks.delete_app
target_node_value = ctx.target.instance.runtime_properties['appid'] target_node_value = ctx.instance.runtime_properties['appid']@operation
def connect_to_app(**kwargs):
if DEBUG:
ctx.logger.info('Linking appid, okta_domain, and okta_key betweeen source and target.')
# preconfigure method to use when connecting two nodes with relation ships.
# Get appid property from target app node and store it in the source group node.
ctx.logger.info("Setting up relationship properties and attributes. ")
ctx.source.instance.runtime_properties['appid'] = ctx.target.instance.runtime_properties['appid']
ctx.source.instance.runtime_properties['okta_domain'] = ctx.target.instance.runtime_properties['okta_domain']
ctx.source.instance.runtime_properties['okta_key'] = ctx.target.instance.runtime_properties['okta_key']
@operation
def configure_app(**kwargs):
if DEBUG:
debugApp_func('configure_app')
ctx.instance.runtime_properties['okta_key'] = ctx.node.properties['okta_key']
ctx.instance.runtime_properties['okta_domain'] = ctx.node.properties['okta_domain']
@operation
def create_group(**kwargs):
if DEBUG:
debugGroup_func('create_group')
gname = ctx.node.properties['group_name']
gdesc = ctx.node.properties['group_description']
okta_key = ctx.instance.runtime_properties['okta_key']
okta_domain = ctx.instance.runtime_properties['okta_domain']
okta = OktaClient(okta_key, okta_domain, 'https')
appid = ctx.instance.runtime_properties['appid']
res = OktaClient._add_okta_group(okta, gname, gdesc)
tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/4.1/types.yaml
- plugin.yaml
# Add this block to import your plugin
plugins:
#any name for your plugin
fico-octa-plugin:
# Give the same details as mentioned while creating the plugin
executor: central_deployment_agent
package_name: oktautil
package_version: '0.1'
distribution_release: ''
distribution_version: ''
supported_platform: ''
distribution: ''
node_templates:
okta_app:
type: fico.nodes.okta.app
properties:
okta_domain: { get_input: okta_domain }
okta_key: { get_input: okta_key }
application_json: { get_input: application_json }
okta_group:
type: fico.nodes.okta.group
relationships:
- type: connect_to_app
target: okta_app
properties:
group_name: { get_input: group_name }
group_description: { get_input: group_description }
---
plugins:
fico-okta-plugin:
executor: central_deployment_agent
package_name: oktautil
package_version: '0.1'
inputs:
okta_domain:
description: The Okta domain
okta_key:
description: Okta authentication token
application_json:
description: application configuration json as string
group_name:
description: name of okta group
group_description:
description: Group description, give empty string if no description
node_types:
fico.nodes.okta.app:
derived_from: cloudify.nodes.Root
properties:
okta_domain:
type: string
okta_key:
type: string
application_json:
type: string
interfaces:
cloudify.interfaces.lifecycle:
configure:
implementation: fico-okta-plugin.plugin.tasks.configure_app
start: ## three operations exists for install workflow ('create', 'configure', and 'start'
implementation: fico-okta-plugin.plugin.tasks.create_app
delete: ## 'delete' is an operation for the uninstall workflow.
implementation: fico-okta-plugin.plugin.tasks.delete_app
fico.nodes.okta.group:
derived_from: cloudify.nodes.Root
properties:
group_name:
type: string
group_description:
type: string
interfaces:
cloudify.interfaces.lifecycle:
start: ## three operations exists for install workflow ('create', 'configure', and 'start'
implementation: fico-okta-plugin.plugin.tasks.create_group
delete: ## 'delete' is an operation for the uninstall workflow.
implementation: fico-okta-plugin.plugin.tasks.delete_group
relationships:
connect_to_app:
derived_from: cloudify.relationships.connected_to
source_interfaces:
cloudify.interfaces.relationship_lifecycle:
preconfigure:
implementation: fico-okta-plugin.plugin.tasks.connect_to_app
outputs:
# example output the could be used to simplify assertions by test
application_metadata:
description: Metadata for the application added to okta
value:
saml: { get_attribute: [okta_app, saml_metadata] }
appid: { get_attribute: [okta_app, appid] }
groupid: { get_attribute: [okta_group, groupid] }