private async Task<CloudServersServerNode> CreateServerNodeAsync(CloudServersProvider provider, Server server, FlavorDetails[] flavors, ServerImage[] images)
        {
            FlavorDetails flavor = flavors.FirstOrDefault(i => server.Flavor != null && string.Equals(server.Flavor.Id, i.Id, StringComparison.OrdinalIgnoreCase));
            try
            {
                if (flavor == null && server.Flavor != null)
                    flavor = await Task.Run(() => provider.GetFlavor(server.Flavor.Id));
            }
            catch (ResponseException)
            {
                // ignore
                flavor = null;
            }

            ServerImage image = images.FirstOrDefault(i => server.Image != null && string.Equals(server.Image.Id, i.Id, StringComparison.OrdinalIgnoreCase));
            try
            {
                if (image == null && server.Image != null)
                    image = await Task.Run(() => provider.GetImage(server.Image.Id));
            }
            catch (ResponseException)
            {
                // ignore
                image = null;
            }

            return new CloudServersServerNode(provider, server, flavor, image);
        }
Ejemplo n.º 2
0
        public CloudServersServerNode(CloudServersProvider provider, Server server, FlavorDetails flavor, ServerImage image)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");
            if (server == null)
                throw new ArgumentNullException("server");

            this._provider = provider;
            this._server = server;
            this._flavor = flavor;
            this._image = image;
        }
Ejemplo n.º 3
0
            public ServerProperties(CloudServersProvider provider, Server server, FlavorDetails flavor, ServerImage image)
            {
                if (provider == null)
                    throw new ArgumentNullException("provider");
                if (server == null)
                    throw new ArgumentNullException("server");

                _provider = provider;
                _server = server;
                _flavor = flavor;
                _image = image;
            }