v2

package
v0.0.0-...-2804b72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package v2 contains common functions for creating identity-based resources for use in acceptance tests. See the `*_test.go` files for example usages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUserRole

func AddUserRole(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant, user *users.User, role *roles.Role) error

AddUserRole will grant a role to a user in a tenant. An error will be returned if the grant was unsuccessful.

func CreateTenant

func CreateTenant(t *testing.T, client *gophercloud.ServiceClient, c *tenants.CreateOpts) (*tenants.Tenant, error)

CreateTenant will create a project with a random name. It takes an optional createOpts parameter since creating a project has so many options. An error will be returned if the project was unable to be created.

func CreateUser

func CreateUser(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant) (*users.User, error)

CreateUser will create a user with a random name and adds them to the given tenant. An error will be returned if the user was unable to be created.

func DeleteTenant

func DeleteTenant(t *testing.T, client *gophercloud.ServiceClient, tenantID string)

DeleteTenant will delete a tenant by ID. A fatal error will occur if the tenant ID failed to be deleted. This works best when using it as a deferred function.

func DeleteUser

func DeleteUser(t *testing.T, client *gophercloud.ServiceClient, user *users.User)

DeleteUser will delete a user. A fatal error will occur if the delete was unsuccessful. This works best when used as a deferred function.

func DeleteUserRole

func DeleteUserRole(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant, user *users.User, role *roles.Role)

DeleteUserRole will revoke a role of a user in a tenant. A fatal error will occur if the revoke was unsuccessful. This works best when used as a deferred function.

func FindRole

func FindRole(t *testing.T, client *gophercloud.ServiceClient) (*roles.Role, error)

FindRole finds all roles that the current authenticated client has access to and returns the first one found. An error will be returned if the lookup was unsuccessful.

func FindTenant

func FindTenant(t *testing.T, client *gophercloud.ServiceClient) (*tenants.Tenant, error)

FindTenant finds all tenants that the current authenticated client has access to and returns the first one found. An error will be returned if the lookup was unsuccessful.

func UpdateUser

func UpdateUser(t *testing.T, client *gophercloud.ServiceClient, user *users.User) (*users.User, error)

UpdateUser will update an existing user with a new randomly generated name. An error will be returned if the update was unsuccessful.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL