CFoundry Helper

This collection of scripts provides helper methods to the cfoundry gem’s API. It implements common use cases when administrating a Cloud Foundry installation.

Configuration

a) You can configure multiple targets within a configuration file. Please execute the following code to load the file’s contents into the configuration: CFoundryHelper.load_config_from_file file_location

b) You can also configure the targets by passing in a configuration hash: CfoundryHelper.load_config_from_hash config_hash

!!! It is important to load a configuration using one of the methods above before executing any helper functions.

Target Selection

Since cfoundry_helper now supports multiple CF targets you have to set your desired target by using the CFoundryHelper::Helpers::ClientHelper.current_target_url= method for selecting a target from your service configuration file. You can list all configured targets using the CFoundryHelper.available_targets method.

!!! It is important to select a target before executing any helper functions, e.g: CFoundryHelper::Helpers::ClientHelper.current_target_url = CFoundryHelper.available_targets.first

Organization management

The CFoundryHelper::Helpers::OrganizationHelper modules’ methods provide helper methods for the following use cases:

  • create organizations
  • add/remove Users from organizations
  • administer User roles within organizations

User management

The CFoundryHelper::Helpers::UserHelper module provides methods for managing users within the system:

  • get user by email
  • create a user
  • delete a user
  • change a user’s password

Space management

The CFoundryHelper::Helpers::OrganizationHelper modules’ methods provide helper methods for the following use cases:

  • create a space within an organization
  • add/remove Users from spaces
  • administer User roles within a space
  • empty a space (remove all apps, service_bindings, service_instances, routes and domains from the space)
  • delete a space

Client Helper

The CFoundryHelper::Helpers::ClientHelper is a factory for uaa and cloud controller clients. The current_target_url has to point to your desired endpoint. (see Target Selection)

Scripts

  • bin/add_users_to_org : adds users to an organization
    • usage : bundle exec bin/add_users_to_org
  • bin/create_space_for_org : creates a space to an organization and assigns all organization members to it
    • usage : bundle exec bin/create_space_for_org

Documentation

  • You can find additional documentation in the doc directory.
  • You can find usage examples in the doc/examples and bin directories.

Console Usage

Use the following command to start the console: bundle exec rake c