public void AttachServerToBlockStorage() { var serverBlockStorage = new BlockStorageServerRequest() { ServerId = server.Id }; var result = client.BlockStorages.CreateServerBlockStorage(serverBlockStorage, blockStorage.Id); Assert.IsNotNull(result); Assert.IsNotNull(result.Id); Config.WaitBlockStorageReady(result.Id); }
/// <summary> /// Attaches a server to a block storage. /// </summary> /// <param name="blockStorageId">Unique block storage's identifier.</param> public BlockStoragesResponse CreateServerBlockStorage(BlockStorageServerRequest serverBlockStorage, string blockStorageId) { try { var request = new RestRequest("/block_storages/{block_storage_id}/server", Method.POST) { RequestFormat = DataFormat.Json, JsonSerializer = new CustomSerializer() }; request.AddUrlSegment("block_storage_id", blockStorageId); request.AddBody(serverBlockStorage); var result = restclient.Execute <BlockStoragesResponse>(request); if (result.StatusCode != HttpStatusCode.Created) { throw new Exception(result.Content); } return(result.Data); } catch { throw; } }