public ServerWithSecurityGroups build() { return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames); }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInZone(zone); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }
public void testGetServerWithSecurityGroups() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); ServerWithSecurityGroupsApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build() ).getServerWithSecurityGroupsExtensionForZone("az-1.region-a.geo-1").get(); ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1")); }
@Override public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server server = context.deserialize(jsonElement, Server.class); ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server); Set<String> names = Sets.newLinkedHashSet(); if (jsonElement.getAsJsonObject().get("security_groups") != null) { JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray(); for (JsonElement y : x) { names.add(y.getAsJsonObject().get("name").getAsString()); } result.securityGroupNames(names); } return result.build(); } }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInRegion(region); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }
public void testGetServerWithSecurityGroups() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); ServerWithSecurityGroupsApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_with_security_groups.json")).build() ).getServerWithSecurityGroupsApi("az-1.region-a.geo-1").get(); ServerWithSecurityGroups server = api.get("8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getId(), "8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(server.getSecurityGroupNames(), ImmutableSet.of("default", "group1")); } }
@Override public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server server = context.deserialize(jsonElement, Server.class); ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server); Set<String> names = Sets.newLinkedHashSet(); if (jsonElement.getAsJsonObject().get("security_groups") != null) { JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray(); for (JsonElement y : x) { names.add(y.getAsJsonObject().get("name").getAsString()); } result.securityGroupNames(names); } return result.build(); } }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public ServerWithSecurityGroups build() { return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames); }
@Override public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server server = context.deserialize(jsonElement, Server.class); ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server); Set<String> names = Sets.newLinkedHashSet(); if (jsonElement.getAsJsonObject().get("security_groups") != null) { JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray(); for (JsonElement y : x) { names.add(y.getAsJsonObject().get("name").getAsString()); } result.securityGroupNames(names); } return result.build(); } }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public ServerWithSecurityGroups build() { return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames, availabilityZone); }
@Override public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server server = context.deserialize(jsonElement, Server.class); ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server); Set<String> names = Sets.newLinkedHashSet(); if (jsonElement.getAsJsonObject().get("security_groups") != null) { JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray(); for (JsonElement y : x) { names.add(y.getAsJsonObject().get("name").getAsString()); } result.securityGroupNames(names); } return result.build(); } }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public ServerWithSecurityGroups build() { return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames); }
@Override public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server server = context.deserialize(jsonElement, Server.class); ServerWithSecurityGroups.Builder<?> result = ServerWithSecurityGroups.builder().fromServer(server); Set<String> names = Sets.newLinkedHashSet(); if (jsonElement.getAsJsonObject().get("security_groups") != null) { JsonArray x = jsonElement.getAsJsonObject().get("security_groups").getAsJsonArray(); for (JsonElement y : x) { names.add(y.getAsJsonObject().get("name").getAsString()); } result.securityGroupNames(names); } return result.build(); } }
public T fromServerWithSecurityGroups(ServerWithSecurityGroups in) { return super.fromServer(in) .securityGroupNames(in.getSecurityGroupNames()); } }
public ServerWithSecurityGroups build() { return new ServerWithSecurityGroups(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig, securityGroupNames, availabilityZone); }