github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/extensions/security/groups/testing/fixtures_test.go (about) 1 package testing 2 3 import ( 4 "time" 5 6 "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups" 7 "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/rules" 8 ) 9 10 const SecurityGroupListResponse = ` 11 { 12 "security_groups": [ 13 { 14 "description": "default", 15 "id": "85cc3048-abc3-43cc-89b3-377341426ac5", 16 "name": "default", 17 "security_group_rules": [], 18 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", 19 "created_at": "2019-06-30T04:15:37", 20 "updated_at": "2019-06-30T05:18:49" 21 } 22 ] 23 } 24 ` 25 26 var ( 27 createdTime, _ = time.Parse(time.RFC3339, "2019-06-30T04:15:37Z") 28 updatedTime, _ = time.Parse(time.RFC3339, "2019-06-30T05:18:49Z") 29 30 SecurityGroup1 = groups.SecGroup{ 31 Description: "default", 32 ID: "85cc3048-abc3-43cc-89b3-377341426ac5", 33 Name: "default", 34 Rules: []rules.SecGroupRule{}, 35 TenantID: "e4f50856753b4dc6afee5fa6b9b6c550", 36 CreatedAt: createdTime, 37 UpdatedAt: updatedTime, 38 } 39 ) 40 41 const SecurityGroupCreateRequest = ` 42 { 43 "security_group": { 44 "name": "new-webservers", 45 "description": "security group for webservers" 46 } 47 } 48 ` 49 50 const SecurityGroupCreateResponse = ` 51 { 52 "security_group": { 53 "description": "security group for webservers", 54 "id": "2076db17-a522-4506-91de-c6dd8e837028", 55 "name": "new-webservers", 56 "security_group_rules": [ 57 { 58 "direction": "egress", 59 "ethertype": "IPv4", 60 "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d", 61 "port_range_max": null, 62 "port_range_min": null, 63 "protocol": null, 64 "remote_group_id": null, 65 "remote_ip_prefix": null, 66 "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", 67 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 68 }, 69 { 70 "direction": "egress", 71 "ethertype": "IPv6", 72 "id": "565b9502-12de-4ffd-91e9-68885cff6ae1", 73 "port_range_max": null, 74 "port_range_min": null, 75 "protocol": null, 76 "remote_group_id": null, 77 "remote_ip_prefix": null, 78 "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", 79 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 80 } 81 ], 82 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", 83 "created_at": "2019-06-30T04:15:37Z", 84 "updated_at": "2019-06-30T05:18:49Z" 85 } 86 } 87 ` 88 89 const SecurityGroupUpdateRequest = ` 90 { 91 "security_group": { 92 "name": "newer-webservers" 93 } 94 } 95 ` 96 97 const SecurityGroupUpdateResponse = ` 98 { 99 "security_group": { 100 "description": "security group for webservers", 101 "id": "2076db17-a522-4506-91de-c6dd8e837028", 102 "name": "newer-webservers", 103 "security_group_rules": [ 104 { 105 "direction": "egress", 106 "ethertype": "IPv4", 107 "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d", 108 "port_range_max": null, 109 "port_range_min": null, 110 "protocol": null, 111 "remote_group_id": null, 112 "remote_ip_prefix": null, 113 "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", 114 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 115 }, 116 { 117 "direction": "egress", 118 "ethertype": "IPv6", 119 "id": "565b9502-12de-4ffd-91e9-68885cff6ae1", 120 "port_range_max": null, 121 "port_range_min": null, 122 "protocol": null, 123 "remote_group_id": null, 124 "remote_ip_prefix": null, 125 "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", 126 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 127 } 128 ], 129 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", 130 "created_at": "2019-06-30T04:15:37Z", 131 "updated_at": "2019-06-30T05:18:49Z" 132 } 133 } 134 ` 135 136 const SecurityGroupGetResponse = ` 137 { 138 "security_group": { 139 "description": "default", 140 "id": "85cc3048-abc3-43cc-89b3-377341426ac5", 141 "name": "default", 142 "security_group_rules": [ 143 { 144 "direction": "egress", 145 "ethertype": "IPv6", 146 "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", 147 "port_range_max": null, 148 "port_range_min": null, 149 "protocol": null, 150 "remote_group_id": null, 151 "remote_ip_prefix": null, 152 "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 153 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 154 }, 155 { 156 "direction": "egress", 157 "ethertype": "IPv4", 158 "id": "93aa42e5-80db-4581-9391-3a608bd0e448", 159 "port_range_max": null, 160 "port_range_min": null, 161 "protocol": null, 162 "remote_group_id": null, 163 "remote_ip_prefix": null, 164 "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 165 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" 166 } 167 ], 168 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", 169 "created_at": "2019-06-30T04:15:37Z", 170 "updated_at": "2019-06-30T05:18:49Z" 171 } 172 } 173 `