PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

/vendor/github.com/gophercloud/gophercloud/acceptance/openstack/sharedfilesystems/v2/securityservices.go

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