github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/vpcep/v1/endpoints/results.go (about) 1 package endpoints 2 3 import ( 4 "github.com/chnsz/golangsdk" 5 "github.com/chnsz/golangsdk/openstack/common/tags" 6 ) 7 8 // Endpoint contains the response of the VPC endpoint 9 type Endpoint struct { 10 // the ID of the VPC endpoint 11 ID string `json:"id"` 12 // the connection status of the VPC endpoint 13 Status string `json:"status"` 14 // the account status: frozen or active 15 ActiveStatus []string `json:"active_status"` 16 // the endpoint status is enabled: enable or disable 17 EnableStatus string `json:"enable_status"` 18 // the specification name of VPC endpoint 19 SpecificationName string `json:"specification_name"` 20 // the type of the VPC endpoint service that is associated with the VPC endpoint 21 ServiceType string `json:"service_type"` 22 // the name of the VPC endpoint service 23 ServiceName string `json:"endpoint_service_name"` 24 // the ID of the VPC endpoint service 25 ServiceID string `json:"endpoint_service_id"` 26 // the ID of the VPC where the VPC endpoint is to be created 27 VpcID string `json:"vpc_id"` 28 // the network ID of the subnet in the VPC specified by vpc_id 29 SubnetID string `json:"subnet_id"` 30 // the IP address for accessing the associated VPC endpoint service 31 IPAddr string `json:"ip"` 32 // the packet ID of the VPC endpoint 33 MarkerID int `json:"marker_id"` 34 // whether to create a private domain name 35 EnableDNS bool `json:"enable_dns"` 36 // the domain name for accessing the associated VPC endpoint service 37 DNSNames []string `json:"dns_names"` 38 // whether to enable access control 39 EnableWhitelist bool `json:"enable_whitelist"` 40 // the whitelist for controlling access to the VPC endpoint 41 Whitelist []string `json:"whitelist"` 42 // the IDs of route tables 43 RouteTables []string `json:"routetables"` 44 // the resource tags 45 Tags []tags.ResourceTag `json:"tags"` 46 // the project ID 47 ProjectID string `json:"project_id"` 48 // the description of the VPC endpoint 49 Description string `json:"description"` 50 // the creation time of the VPC endpoint 51 Created string `json:"created_at"` 52 // the update time of the VPC endpoint 53 Updated string `json:"updated_at"` 54 } 55 56 type commonResult struct { 57 golangsdk.Result 58 } 59 60 // CreateResult represents the result of a create operation. Call its Extract 61 // method to interpret it as a Endpoint. 62 type CreateResult struct { 63 commonResult 64 } 65 66 // UpdateResult represents the result of a update operation. Call its Extract 67 // method to interpret it as an Endpoint. 68 type UpdateResult struct { 69 commonResult 70 } 71 72 // GetResult represents the result of a get operation. Call its Extract 73 // method to interpret it as a Endpoint. 74 type GetResult struct { 75 commonResult 76 } 77 78 // DeleteResult represents the result of a delete operation. Call its ExtractErr 79 // method to determine if the request succeeded or failed. 80 type DeleteResult struct { 81 golangsdk.ErrResult 82 } 83 84 // ListResult represents the result of a list operation. Call its ExtractEndpoints 85 // method to interpret it as Endpoints. 86 type ListResult struct { 87 commonResult 88 } 89 90 // Extract is a function that accepts a result and extracts a Endpoint 91 func (r commonResult) Extract() (*Endpoint, error) { 92 var ep Endpoint 93 err := r.ExtractInto(&ep) 94 return &ep, err 95 } 96 97 // ExtractEndpoints is a function that accepts a result and extracts the given Endpoints 98 func (r ListResult) ExtractEndpoints() ([]Endpoint, error) { 99 var s struct { 100 Endpoints []Endpoint `json:"endpoints"` 101 } 102 103 err := r.ExtractInto(&s) 104 if err != nil { 105 return nil, err 106 } 107 return s.Endpoints, nil 108 }