blob: e9b5549609eab013f551081454d7eab4d0b03ac0 [file] [log] [blame]
ehdoub5066cd2016-11-10 22:15:42 +02001package v2
2
3import (
4 "testing"
5
6 "github.com/gophercloud/gophercloud"
7 "github.com/gophercloud/gophercloud/acceptance/tools"
8 "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/securityservices"
9)
10
11// CreateSecurityService will create a security service with a random name. An
12// error will be returned if the security service was unable to be created.
13func CreateSecurityService(t *testing.T, client *gophercloud.ServiceClient) (*securityservices.SecurityService, error) {
14 if testing.Short() {
15 t.Skip("Skipping test that requires share network creation in short mode.")
16 }
17
18 securityServiceName := tools.RandomString("ACPTTEST", 16)
19 t.Logf("Attempting to create security service: %s", securityServiceName)
20
21 createOpts := securityservices.CreateOpts{
22 Name: securityServiceName,
23 Type: "kerberos",
24 }
25
26 securityService, err := securityservices.Create(client, createOpts).Extract()
27 if err != nil {
28 return securityService, err
29 }
30
31 return securityService, nil
32}
33
34// PrintSecurityService will print a security service and all of its attributes.
35func PrintSecurityService(t *testing.T, securityService *securityservices.SecurityService) {
36 t.Logf("ID: %s", securityService.ID)
37 t.Logf("Project ID: %s", securityService.ProjectID)
38 t.Logf("Domain: %s", securityService.Domain)
39 t.Logf("Status: %s", securityService.Status)
40 t.Logf("Type: %s", securityService.Type)
41 t.Logf("Name: %s", securityService.Name)
42 t.Logf("Description: %s", securityService.Description)
43 t.Logf("DNS IP: %s", securityService.DNSIP)
44 t.Logf("User: %s", securityService.User)
45 t.Logf("Password: %s", securityService.Password)
46 t.Logf("Server: %s", securityService.Server)
47 t.Logf("Created at: %v", securityService.CreatedAt)
48 t.Logf("Updated at: %v", securityService.UpdatedAt)
49}