def setup_import_notifications(ctx, appliance_label):
    # Create the topic, subscriptions and rule in the root compartment so that everything trickles down
    config = oci.config.from_file(file_location=ctx.obj['config_file'], profile_name=ctx.obj['profile'])
    root_compartment = config['tenancy']

    create_topic_details = {
        'name': 'DTSImportApplianceTopic_{}'.format(appliance_label),
        'description': 'Topic for data transfer service appliance import with label {}'.format(appliance_label),
        'compartmentId': root_compartment
    }
    create_rule_kwargs = {
        'display_name': 'DTSImportApplianceRule_{}'.format(appliance_label),
        'compartment_id': root_compartment,
        'description': 'Rule for data transfer service to send notifications for a transfer appliance with label {}'.format(appliance_label),
        'is_enabled': True,
        'condition': '{"eventType":"com.oraclecloud.datatransferservice.*transferappliance","data":{"additionalDetails":{"applianceLabel":"%s"}}}' % appliance_label,
        'actions': {
            'actions': [
                {
                    'actionType': 'ONS',
                    'topicId': None,
                    'isEnabled': True
                }
            ]
        }
    }
    setup_notifications_helper(ctx, create_topic_details, create_rule_kwargs)
Exemplo n.º 2
0
def setup_export_notifications(ctx):
    # Create the topic, subscriptions and rule in the root compartment so that everything trickles down
    config = oci.config.from_file(file_location=ctx.obj['config_file'],
                                  profile_name=ctx.obj['profile'])
    root_compartment = config['tenancy']

    create_topic_details = {
        'name': 'DTSExportTopic',
        'description': 'Topic for data transfer service export jobs',
        'compartmentId': root_compartment
    }

    create_rule_kwargs = {
        'display_name': 'DTSExportRule',
        'compartment_id': root_compartment,
        'description':
        'Rule for data transfer service to send notifications for export jobs',
        'is_enabled': True,
        'condition':
        '{"eventType":"com.oraclecloud.datatransferservice.*applianceexportjob"}',
        'actions': {
            'actions': [{
                'actionType': 'ONS',
                'topicId': None,
                'isEnabled': True
            }]
        }
    }

    setup_notifications_helper(ctx, create_topic_details, create_rule_kwargs)
Exemplo n.º 3
0
def setup_import_notifications(ctx, job_id):
    # Create the topic, subscriptions and rule in the root compartment so that everything trickles down
    config = oci.config.from_file(file_location=ctx.obj['config_file'],
                                  profile_name=ctx.obj['profile'])
    root_compartment = config['tenancy']

    create_topic_details = {
        'name':
        'DTSImportJobTopic_{}'.format(job_id[-6:]),
        'description':
        'Topic for data transfer service import job with OCID {}'.format(
            job_id),
        'compartmentId':
        root_compartment
    }
    create_rule_kwargs = {
        'display_name':
        'DTSImportJobRule_{}'.format(job_id[-6:]),
        'compartment_id':
        root_compartment,
        'description':
        'Rule for data transfer service to send notifications for an import job with OCID {}'
        .format(job_id),
        'is_enabled':
        True,
        'condition':
        '{"eventType":"com.oraclecloud.datatransferservice.*transferjob","data":{"resourceId":"%s"}}'
        % job_id,
        'actions': {
            'actions': [{
                'actionType': 'ONS',
                'topicId': None,
                'isEnabled': True
            }]
        }
    }
    setup_notifications_helper(ctx, create_topic_details, create_rule_kwargs)