Class: Fog::Identity::OpenStack

Inherits:
Service
  • Object
show all
Defined in:
lib/fog/identity/openstack.rb,
lib/fog/identity/openstack/v2.rb,
lib/fog/identity/openstack/v3.rb,
lib/fog/identity/openstack/v2/models/role.rb,
lib/fog/identity/openstack/v2/models/user.rb,
lib/fog/identity/openstack/v3/models/role.rb,
lib/fog/identity/openstack/v3/models/user.rb,
lib/fog/identity/openstack/v2/models/roles.rb,
lib/fog/identity/openstack/v2/models/users.rb,
lib/fog/identity/openstack/v3/models/group.rb,
lib/fog/identity/openstack/v3/models/roles.rb,
lib/fog/identity/openstack/v3/models/token.rb,
lib/fog/identity/openstack/v3/models/users.rb,
lib/fog/identity/openstack/v2/models/tenant.rb,
lib/fog/identity/openstack/v3/models/domain.rb,
lib/fog/identity/openstack/v3/models/groups.rb,
lib/fog/identity/openstack/v3/models/policy.rb,
lib/fog/identity/openstack/v3/models/tokens.rb,
lib/fog/identity/openstack/v2/models/tenants.rb,
lib/fog/identity/openstack/v3/models/domains.rb,
lib/fog/identity/openstack/v3/models/project.rb,
lib/fog/identity/openstack/v3/models/service.rb,
lib/fog/identity/openstack/v3/models/endpoint.rb,
lib/fog/identity/openstack/v3/models/policies.rb,
lib/fog/identity/openstack/v3/models/projects.rb,
lib/fog/identity/openstack/v3/models/services.rb,
lib/fog/identity/openstack/v3/models/endpoints.rb,
lib/fog/identity/openstack/v2/requests/get_role.rb,
lib/fog/identity/openstack/v3/requests/get_role.rb,
lib/fog/identity/openstack/v3/requests/get_user.rb,
lib/fog/identity/openstack/v3/requests/get_group.rb,
lib/fog/identity/openstack/v2/requests/get_tenant.rb,
lib/fog/identity/openstack/v2/requests/list_roles.rb,
lib/fog/identity/openstack/v2/requests/list_users.rb,
lib/fog/identity/openstack/v2/requests/set_tenant.rb,
lib/fog/identity/openstack/v3/requests/get_domain.rb,
lib/fog/identity/openstack/v3/requests/get_policy.rb,
lib/fog/identity/openstack/v3/requests/list_roles.rb,
lib/fog/identity/openstack/v3/requests/list_users.rb,
lib/fog/identity/openstack/v2/requests/check_token.rb,
lib/fog/identity/openstack/v2/requests/create_role.rb,
lib/fog/identity/openstack/v2/requests/create_user.rb,
lib/fog/identity/openstack/v2/requests/delete_role.rb,
lib/fog/identity/openstack/v2/requests/delete_user.rb,
lib/fog/identity/openstack/v2/requests/update_user.rb,
lib/fog/identity/openstack/v3/models/os_credential.rb,
lib/fog/identity/openstack/v3/requests/create_role.rb,
lib/fog/identity/openstack/v3/requests/create_user.rb,
lib/fog/identity/openstack/v3/requests/delete_role.rb,
lib/fog/identity/openstack/v3/requests/delete_user.rb,
lib/fog/identity/openstack/v3/requests/get_project.rb,
lib/fog/identity/openstack/v3/requests/get_service.rb,
lib/fog/identity/openstack/v3/requests/list_groups.rb,
lib/fog/identity/openstack/v3/requests/token_check.rb,
lib/fog/identity/openstack/v3/requests/update_role.rb,
lib/fog/identity/openstack/v3/requests/update_user.rb,
lib/fog/identity/openstack/v2/models/ec2_credential.rb,
lib/fog/identity/openstack/v2/requests/list_tenants.rb,
lib/fog/identity/openstack/v3/models/os_credentials.rb,
lib/fog/identity/openstack/v3/requests/auth_domains.rb,
lib/fog/identity/openstack/v3/requests/create_group.rb,
lib/fog/identity/openstack/v3/requests/delete_group.rb,
lib/fog/identity/openstack/v3/requests/get_endpoint.rb,
lib/fog/identity/openstack/v3/requests/list_domains.rb,
lib/fog/identity/openstack/v3/requests/token_revoke.rb,
lib/fog/identity/openstack/v3/requests/update_group.rb,
lib/fog/identity/openstack/v2/models/ec2_credentials.rb,
lib/fog/identity/openstack/v2/requests/create_tenant.rb,
lib/fog/identity/openstack/v2/requests/delete_tenant.rb,
lib/fog/identity/openstack/v2/requests/update_tenant.rb,
lib/fog/identity/openstack/v3/models/role_assignment.rb,
lib/fog/identity/openstack/v3/requests/auth_projects.rb,
lib/fog/identity/openstack/v3/requests/create_domain.rb,
lib/fog/identity/openstack/v3/requests/create_policy.rb,
lib/fog/identity/openstack/v3/requests/delete_domain.rb,
lib/fog/identity/openstack/v3/requests/delete_policy.rb,
lib/fog/identity/openstack/v3/requests/list_policies.rb,
lib/fog/identity/openstack/v3/requests/list_projects.rb,
lib/fog/identity/openstack/v3/requests/list_services.rb,
lib/fog/identity/openstack/v3/requests/update_domain.rb,
lib/fog/identity/openstack/v3/requests/update_policy.rb,
lib/fog/identity/openstack/v2/requests/get_user_by_id.rb,
lib/fog/identity/openstack/v2/requests/validate_token.rb,
lib/fog/identity/openstack/v3/models/role_assignments.rb,
lib/fog/identity/openstack/v3/requests/create_project.rb,
lib/fog/identity/openstack/v3/requests/create_service.rb,
lib/fog/identity/openstack/v3/requests/delete_project.rb,
lib/fog/identity/openstack/v3/requests/delete_service.rb,
lib/fog/identity/openstack/v3/requests/list_endpoints.rb,
lib/fog/identity/openstack/v3/requests/token_validate.rb,
lib/fog/identity/openstack/v3/requests/update_project.rb,
lib/fog/identity/openstack/v3/requests/update_service.rb,
lib/fog/identity/openstack/v3/requests/create_endpoint.rb,
lib/fog/identity/openstack/v3/requests/delete_endpoint.rb,
lib/fog/identity/openstack/v3/requests/update_endpoint.rb,
lib/fog/identity/openstack/v2/requests/create_user_role.rb,
lib/fog/identity/openstack/v2/requests/delete_user_role.rb,
lib/fog/identity/openstack/v2/requests/get_user_by_name.rb,
lib/fog/identity/openstack/v3/requests/group_user_check.rb,
lib/fog/identity/openstack/v3/requests/list_group_users.rb,
lib/fog/identity/openstack/v3/requests/list_user_groups.rb,
lib/fog/identity/openstack/v2/requests/get_tenants_by_id.rb,
lib/fog/identity/openstack/v3/requests/add_user_to_group.rb,
lib/fog/identity/openstack/v3/requests/get_os_credential.rb,
lib/fog/identity/openstack/v2/requests/add_user_to_tenant.rb,
lib/fog/identity/openstack/v2/requests/get_ec2_credential.rb,
lib/fog/identity/openstack/v3/requests/list_user_projects.rb,
lib/fog/identity/openstack/v3/requests/token_authenticate.rb,
lib/fog/identity/openstack/v2/requests/get_tenants_by_name.rb,
lib/fog/identity/openstack/v3/requests/list_os_credentials.rb,
lib/fog/identity/openstack/v2/requests/list_ec2_credentials.rb,
lib/fog/identity/openstack/v3/requests/create_os_credential.rb,
lib/fog/identity/openstack/v3/requests/delete_os_credential.rb,
lib/fog/identity/openstack/v3/requests/update_os_credential.rb,
lib/fog/identity/openstack/v2/requests/create_ec2_credential.rb,
lib/fog/identity/openstack/v2/requests/delete_ec2_credential.rb,
lib/fog/identity/openstack/v3/requests/list_role_assignments.rb,
lib/fog/identity/openstack/v2/requests/list_user_global_roles.rb,
lib/fog/identity/openstack/v3/requests/check_domain_user_role.rb,
lib/fog/identity/openstack/v3/requests/grant_domain_user_role.rb,
lib/fog/identity/openstack/v3/requests/list_domain_user_roles.rb,
lib/fog/identity/openstack/v3/requests/remove_user_from_group.rb,
lib/fog/identity/openstack/v2/requests/remove_user_from_tenant.rb,
lib/fog/identity/openstack/v3/requests/check_domain_group_role.rb,
lib/fog/identity/openstack/v3/requests/check_project_user_role.rb,
lib/fog/identity/openstack/v3/requests/grant_domain_group_role.rb,
lib/fog/identity/openstack/v3/requests/grant_project_user_role.rb,
lib/fog/identity/openstack/v3/requests/list_domain_group_roles.rb,
lib/fog/identity/openstack/v3/requests/list_project_user_roles.rb,
lib/fog/identity/openstack/v3/requests/revoke_domain_user_role.rb,
lib/fog/identity/openstack/v2/requests/list_endpoints_for_token.rb,
lib/fog/identity/openstack/v3/requests/check_project_group_role.rb,
lib/fog/identity/openstack/v3/requests/grant_project_group_role.rb,
lib/fog/identity/openstack/v3/requests/list_project_group_roles.rb,
lib/fog/identity/openstack/v3/requests/revoke_domain_group_role.rb,
lib/fog/identity/openstack/v3/requests/revoke_project_user_role.rb,
lib/fog/identity/openstack/v3/requests/revoke_project_group_role.rb,
lib/fog/identity/openstack/v2/requests/list_roles_for_user_on_tenant.rb

Defined Under Namespace

Classes: Mock, Real, V2, V3

Class Method Summary collapse

Class Method Details

.new(args = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/identity/openstack.rb', line 7

def self.new(args = {})
  version = if args[:openstack_identity_api_version] =~ /(v)*2(\.0)*/i
              '2.0'
            elsif args[:openstack_auth_url] =~ /v3|v2(\.0)*/
              # Deprecated from fog-openstack 0.2.0
              # Will be removed in future after hard deprecation is enforced for a couple of releases
              Fog::Logger.deprecation("An authentication URL including a version is deprecated")
              case args[:openstack_auth_url]
              when /\/v3(\/)*.*$/
                args[:openstack_auth_url].gsub!(/\/v3(\/)*.*$/, '')
                args[:no_path_prefix] = true
                '3'
              when /\/v2(\.0)*(\/)*.*$/
                args[:openstack_auth_url].gsub!(/\/v2(\.0)*(\/)*.*$/, '')
                args[:no_path_prefix] = true
                '2.0'
              end
            end

  case version
  when '2.0'
    Fog::Identity::OpenStack::V2.new(args)
  else
    Fog::Identity::OpenStack::V3.new(args)
  end
end