blob: 6874208b883d3f4e52d3d804f6e0fab804515add [file] [log] [blame]
ehdoub5066cd2016-11-10 22:15:42 +02001package securityservices
2
jrperritt98d01622017-01-12 14:24:42 -06003import (
4 "encoding/json"
5 "time"
6
7 "github.com/gophercloud/gophercloud"
8)
ehdoub5066cd2016-11-10 22:15:42 +02009
10// SecurityService contains all the information associated with an OpenStack
11// SecurityService.
12type SecurityService struct {
13 // The security service ID
14 ID string `json:"id"`
15 // The UUID of the project where the security service was created
16 ProjectID string `json:"project_id"`
17 // The security service domain
18 Domain string `json:"domain"`
19 // The security service status
20 Status string `json:"status"`
21 // The security service type. A valid value is ldap, kerberos, or active_directory
22 Type string `json:"type"`
23 // The security service name
24 Name string `json:"name"`
25 // The security service description
26 Description string `json:"description"`
27 // The DNS IP address that is used inside the tenant network
28 DNSIP string `json:"dns_ip"`
29 // The security service user or group name that is used by the tenant
30 User string `json:"user"`
31 // The user password, if you specify a user
32 Password string `json:"password"`
33 // The security service host name or IP address
34 Server string `json:"server"`
35 // The date and time stamp when the security service was created
jrperritt98d01622017-01-12 14:24:42 -060036 CreatedAt time.Time `json:"-"`
ehdoub5066cd2016-11-10 22:15:42 +020037 // The date and time stamp when the security service was updated
jrperritt98d01622017-01-12 14:24:42 -060038 UpdatedAt time.Time `json:"-"`
39}
40
41func (r *SecurityService) UnmarshalJSON(b []byte) error {
42 type tmp SecurityService
43 var s struct {
44 tmp
45 CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"`
46 UpdatedAt gophercloud.JSONRFC3339MilliNoZ `json:"updated_at"`
47 }
48 err := json.Unmarshal(b, &s)
49 if err != nil {
50 return err
51 }
52 *r = SecurityService(s.tmp)
53
54 r.CreatedAt = time.Time(s.CreatedAt)
55 r.UpdatedAt = time.Time(s.UpdatedAt)
56
57 return nil
ehdoub5066cd2016-11-10 22:15:42 +020058}
59
60type commonResult struct {
61 gophercloud.Result
62}
63
64// Extract will get the SecurityService object out of the commonResult object.
65func (r commonResult) Extract() (*SecurityService, error) {
66 var s struct {
67 SecurityService *SecurityService `json:"security_service"`
68 }
69 err := r.ExtractInto(&s)
70 return s.SecurityService, err
71}
72
73// CreateResult contains the response body and error from a Create request.
74type CreateResult struct {
75 commonResult
76}
ehdou894b50d2017-01-07 00:38:03 +020077
78// DeleteResult contains the response body and error from a Delete request.
79type DeleteResult struct {
80 gophercloud.ErrResult
81}