def create_firewall_structure_from_rules(network, rules): firewall_structure = utils.create_firewall_structure_from_rules( network, rules) if utils.should_use_external_resource(): firewall_structure['name'] = utils.assure_resource_id_correct() return firewall_structure
def delete(user, private_key_path, **kwargs): gcp_config = utils.get_gcp_config() keypair = KeyPair(gcp_config, ctx.logger, user, private_key_path, None) keypair.public_key = ctx.instance.runtime_properties[constants.PUBLIC_KEY] if not utils.should_use_external_resource(): keypair.remove_private_key() ctx.instance.runtime_properties.pop(constants.PRIVATE_KEY, None) ctx.instance.runtime_properties.pop(constants.PUBLIC_KEY, None)
def create(user, private_key_path, public_key_path, **kwargs): gcp_config = utils.get_gcp_config() keypair = KeyPair(gcp_config, ctx.logger, user, private_key_path, public_key_path) create_keypair(keypair) ctx.instance.runtime_properties[constants.USER] = user ctx.instance.runtime_properties[constants.PRIVATE_KEY] = \ keypair.private_key ctx.instance.runtime_properties[constants.PUBLIC_KEY] = keypair.public_key if not utils.should_use_external_resource(): keypair.save_private_key()
def delete(user, private_key_path, **kwargs): gcp_config = utils.get_gcp_config() keypair = KeyPair(gcp_config, ctx.logger, user, private_key_path, None) keypair.public_key = ctx.instance.runtime_properties[constants.PUBLIC_KEY] if not utils.should_use_external_resource(): keypair.remove_private_key() ctx.instance.runtime_properties.pop(constants.PRIVATE_KEY, None) ctx.instance.runtime_properties.pop(constants.PUBLIC_KEY, None)
def create(user, private_key_path, public_key_path, **kwargs): gcp_config = utils.get_gcp_config() keypair = KeyPair(gcp_config, ctx.logger, user, private_key_path, public_key_path) create_keypair(keypair) ctx.instance.runtime_properties[constants.USER] = user ctx.instance.runtime_properties[constants.PRIVATE_KEY] = \ keypair.private_key ctx.instance.runtime_properties[constants.PUBLIC_KEY] = keypair.public_key if not utils.should_use_external_resource(): keypair.save_private_key()
def create_keypair(keypair): if utils.should_use_external_resource(): keypair.private_key = ctx.get_resource(keypair.private_key_path) keypair.public_key = ctx.get_resource(keypair.public_key_path) else: keypair.create()
def create_firewall_structure_from_rules(network, rules): firewall_structure = utils.create_firewall_structure_from_rules( network, rules) if utils.should_use_external_resource(): firewall_structure['name'] = utils.assure_resource_id_correct() return firewall_structure
def set_firewall_rule_name(firewall_rule, network_name): if utils.should_use_external_resource(): firewall_rule['name'] = utils.assure_resource_id_correct() else: firewall_rule['name'] = utils.get_firewall_rule_name( network_name, firewall_rule)
def set_firewall_rule_name(firewall_rule, network_name): if utils.should_use_external_resource(): firewall_rule['name'] = utils.assure_resource_id_correct() else: firewall_rule['name'] = utils.get_firewall_rule_name(network_name, firewall_rule)
def create_keypair(keypair): if utils.should_use_external_resource(): keypair.private_key = ctx.get_resource(keypair.private_key_path) keypair.public_key = ctx.get_resource(keypair.public_key_path) else: keypair.create()