public Hardware(string name, Identifier identifier, ISettings settings) { this.settings = settings; this.identifier = identifier; this.name = name; this.customName = settings.GetValue( new Identifier(Identifier, "name").ToString(), name); }
public static bool Equals(Identifier a, Identifier b) { if (a == b) return true; if (a != null && b != null) return a.Equals(b); return false; }
/// <summary> /// Initializes a new instance of the <see cref="ServerCreateDefinition"/> class. /// </summary> /// <param name="name">The server name.</param> /// <param name="imageId">The image identifier.</param> /// <param name="flavorId">The flavor identifier.</param> public ServerCreateDefinition(string name, Identifier imageId, Identifier flavorId) { Name = name; ImageId = imageId; FlavorId = flavorId; SecurityGroups = new List<SecurityGroupReference>(); Networks = new List<ServerNetworkDefinition>(); Metadata = new Dictionary<string, string>(); Personality = new List<Personality>(); BlockDeviceMapping = new List<ServerBlockDeviceMapping>(); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.GetRouterAsync" /> public static Router GetRouter(this NetworkingService service, Identifier routerId) { return service._networkingApiBuilder.GetRouterAsync<Router>(routerId).ForceSynchronous(); }
public IPAddressAssociation(Identifier subnetId, string ipAddress) { SubnetId = subnetId; IPAddress = ipAddress; }
/// <inheritdoc cref="ComputeApi.ResizeServerAsync" /> /// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception> public Task ResizeAsync(Identifier flavorId, CancellationToken cancellationToken = default(CancellationToken)) { var compute = this.GetOwnerOrThrow<ComputeApi>(); return compute.ResizeServerAsync(Id, flavorId, cancellationToken); }
/// <inheritdoc cref="NetworkingApiBuilder.GetFloatingIPAsync{T}" /> public static Task<FloatingIP> GetFloatingIPAsync(this NetworkingService service, Identifier floatingIPId, CancellationToken cancellationToken = default(CancellationToken)) { return service._networkingApiBuilder.GetFloatingIPAsync<FloatingIP>(floatingIPId, cancellationToken); }
/// <inheritdoc cref="NetworkingApiBuilder.AttachSubnetToRouterAsync" /> public static async Task<Identifier> AttachSubnetToRouterAsync(this NetworkingService service, Identifier routerId, Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken)) { return await service._networkingApiBuilder.AttachSubnetToRouterAsync(routerId, subnetId, cancellationToken).ConfigureAwait(false); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.DeleteFloatingIPAsync" /> public static void DeleteFloatingIP(this NetworkingService service, Identifier floatingIPId) { service._networkingApiBuilder.DeleteFloatingIPAsync(floatingIPId).ForceSynchronous(); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.GetFloatingIPAsync" /> public static FloatingIP GetFloatingIP(this NetworkingService service, Identifier floatingIPId) { return service._networkingApiBuilder.GetFloatingIPAsync<FloatingIP>(floatingIPId).ForceSynchronous(); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.AttachSubnetToRouterAsync" /> public static Identifier AttachSubnetToRouter(this NetworkingService service, Identifier routerId, Identifier subnetId) { return service._networkingApiBuilder.AttachSubnetToRouterAsync(routerId, subnetId).ForceSynchronous(); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.DeleteRouterAsync" /> public static void DeleteRouter(this NetworkingService service, Identifier routerId) { service._networkingApiBuilder.DeleteRouterAsync(routerId).ForceSynchronous(); }
/// <summary> /// Configures the server to boot from a copy of an existing volume. /// </summary> /// <param name="volumeId">The volume identifier.</param> /// <param name="volumeSize">Size of the volume.</param> /// <param name="deleteVolumeWithServer">if set to <c>true</c> [delete volume with server].</param> public void ConfigureBootFromNewVolume(Identifier volumeId, int volumeSize, bool deleteVolumeWithServer = false) { BlockDeviceMapping.Add(new ServerBlockDeviceMapping { SourceType = ServerBlockDeviceType.Volume, SourceId = volumeId, BootIndex = 0, DestinationType = ServerBlockDeviceType.Volume, DestinationVolumeSize = volumeSize, DeleteWithServer = deleteVolumeWithServer }); }
/// <inheritdoc cref="NetworkingApiBuilder.AttachSubnetToRouterAsync"/> /// <exception cref="InvalidOperationException">Thrown when a resource as not constructed by the SDK.</exception> public async Task<Identifier> AttachSubnetAsync(Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken)) { var networking = this.GetOwnerOrThrow<NetworkingApiBuilder>(); return await networking.AttachSubnetToRouterAsync(Id, subnetId, cancellationToken).ConfigureAwait(false); }
/// <inheritdoc cref="NetworkingApiBuilder.AttachPortToRouterAsync"/> /// <exception cref="InvalidOperationException">Thrown when a resource as not constructed by the SDK.</exception> public Task AttachPortAsync(Identifier portId, CancellationToken cancellationToken = default(CancellationToken)) { var networking = this.GetOwnerOrThrow<NetworkingApiBuilder>(); return networking.AttachPortToRouterAsync(Id, portId, cancellationToken); }
/// <inheritdoc cref="NetworkingApiBuilder.DetachSubnetFromRouterAsync"/> /// <exception cref="InvalidOperationException">Thrown when a resource as not constructed by the SDK.</exception> public Task DetachSubnetAsync(Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken)) { var networking = this.GetOwnerOrThrow<NetworkingApiBuilder>(); return networking.DetachSubnetFromRouterAsync(Id, subnetId, cancellationToken); }
/// <summary> /// Initializes a new instance of the <see cref="VolumeSnapshotDefinition"/> class. /// </summary> /// <param name="volumeId">The volume identifier.</param> public VolumeSnapshotDefinition(Identifier volumeId) { VolumeId = volumeId; }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.AttachPortToRouterAsync" /> public static void AttachPortToRouter(this NetworkingService service, Identifier routerId, Identifier portId) { service._networkingApiBuilder.AttachPortToRouterAsync(routerId, portId).ForceSynchronous(); }
/// <summary> /// Initializes a new instance of the <see cref="ExternalGateway"/> class. /// </summary> public ExternalGatewayDefinition(Identifier externalNetworkId) { ExternalNetworkId = externalNetworkId; ExternalFixedIPs = new List<IPAddressAssociation>(); }
/// <inheritdoc cref="NetworkingService_Layer3_Extensions.DetachSubnetFromRouterAsync" /> public static void DetachSubnetFromRouter(this NetworkingService service, Identifier routerId, Identifier subnetId) { service._networkingApiBuilder.DetachSubnetFromRouterAsync(routerId, subnetId).ForceSynchronous(); }
/// <summary> /// Initializes a new instance of the <see cref="SubnetCreateDefinition"/> class. /// </summary> /// <param name="networkId">The network identifier.</param> /// <param name="ipVersion">The ip version.</param> /// <param name="cidr">The cidr.</param> public SubnetCreateDefinition(Identifier networkId, IPVersion ipVersion, string cidr) { NetworkId = networkId; IPVersion = ipVersion; CIDR = cidr; }
/// <inheritdoc cref="NetworkingApiBuilder.GetRouterAsync{T}" /> public static Task<Router> GetRouterAsync(this NetworkingService service, Identifier routerId, CancellationToken cancellationToken = default(CancellationToken)) { return service._networkingApiBuilder.GetRouterAsync<Router>(routerId, cancellationToken); }
/// <summary> /// Initializes a new instance of the <see cref="FloatingIPCreateDefinition"/> class. /// </summary> /// <param name="networkId">The network identifier.</param> public FloatingIPCreateDefinition(Identifier networkId) { NetworkId = networkId; }
/// <inheritdoc cref="NetworkingApiBuilder.AttachPortToRouterAsync" /> public static Task AttachPortToRouterAsync(this NetworkingService service, Identifier routerId, Identifier portId, CancellationToken cancellationToken = default(CancellationToken)) { return service._networkingApiBuilder.AttachPortToRouterAsync(routerId, portId, cancellationToken); }
/// <summary> /// Equalses the specified function. /// </summary> /// <param name="function">The function.</param> /// <returns></returns> public bool Equals(Identifier function) { return (_name == function.Name); }
/// <inheritdoc cref="NetworkingApiBuilder.DetachSubnetFromRouterAsync" /> public static Task DetachSubnetFromRouterAsync(this NetworkingService service, Identifier routerId, Identifier subnetId, CancellationToken cancellationToken = default(CancellationToken)) { return service._networkingApiBuilder.DetachSubnetFromRouterAsync(routerId, subnetId, cancellationToken); }
/// <summary> /// Initializes a new instance of the <see cref="IPAddressAssociation"/> class. /// <para> /// an available IP from that subnet will be allocated to the port. /// </para> /// </summary> /// <param name="subnetId">The subnet identifier.</param> public IPAddressAssociation(Identifier subnetId) { SubnetId = subnetId; }
/// <summary> /// Initializes a new instance of the <see cref="PortCreateDefinition"/> class. /// </summary> /// <param name="networkId">The network identifier.</param> public PortCreateDefinition(Identifier networkId) : this() { NetworkId = networkId; }
/// <summary> /// Initializes a new instance of the <see cref="ServerVolumeDefinition"/> class. /// </summary> /// <param name="volumeId">The volume identifier.</param> public ServerVolumeDefinition(Identifier volumeId) { VolumeId = volumeId; }