/// <summary> /// Initializes a new instance of the <see cref="ServerArgument"/> class /// with the specified values. /// </summary> /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param> /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param> /// <param name="name">The prefix to use when assigning names to new servers.</param> /// <param name="diskConfiguration">The disk configuration to use for new servers.</param> /// <param name="metadata">The metadata to associate with the server argument.</param> /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param> /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="flavorId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// If <paramref name="networks"/> contains any <see langword="null"/> values. /// <para>-or-</para> /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para> /// </exception> public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, JObject metadata, IEnumerable <ServerNetworkArgument> networks, IEnumerable <Personality> personality) { if (flavorId == null) { throw new ArgumentNullException("flavorId"); } if (imageId == null) { throw new ArgumentNullException("imageId"); } _flavorId = flavorId; _imageId = imageId; _name = name; _diskConfiguration = diskConfiguration; _metadata = metadata; if (networks != null) { _networks = networks.ToArray(); if (_networks.Contains(null)) { throw new ArgumentException("networks cannot contain any null values", "networks"); } } if (personality != null) { _personality = personality.ToArray(); if (_personality.Contains(null)) { throw new ArgumentException("personality cannot contain any null values", "personality"); } } }
/// <summary> /// Initializes a new instance of the <see cref="ServerArgument"/> class /// with the specified values. /// </summary> /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param> /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param> /// <param name="name">The prefix to use when assigning names to new servers.</param> /// <param name="diskConfiguration">The disk configuration to use for new servers.</param> /// <param name="metadata">The metadata to associate with the server argument.</param> /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param> /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="flavorId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// If <paramref name="networks"/> contains any <see langword="null"/> values. /// <para>-or-</para> /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para> /// </exception> public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, JObject metadata, IEnumerable<ServerNetworkArgument> networks, IEnumerable<Personality> personality) { if (flavorId == null) throw new ArgumentNullException("flavorId"); if (imageId == null) throw new ArgumentNullException("imageId"); _flavorId = flavorId; _imageId = imageId; _name = name; _diskConfiguration = diskConfiguration; _metadata = metadata; if (networks != null) { _networks = networks.ToArray(); if (_networks.Contains(null)) throw new ArgumentException("networks cannot contain any null values", "networks"); } if (personality != null) { _personality = personality.ToArray(); if (_personality.Contains(null)) throw new ArgumentException("personality cannot contain any null values", "personality"); } }