本文整理汇总了C#中LoadBalancerId类的典型用法代码示例。如果您正苦于以下问题:C# LoadBalancerId类的具体用法?C# LoadBalancerId怎么用?C# LoadBalancerId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadBalancerId类属于命名空间,在下文中一共展示了LoadBalancerId类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListLoadBalancers
public static ReadOnlyCollectionPage<LoadBalancer> ListLoadBalancers(this ILoadBalancerService service, LoadBalancerId markerId, int? limit)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListLoadBalancersAsync(markerId, limit, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例2: GetLoadBalancer
public static LoadBalancer GetLoadBalancer(this ILoadBalancerService service, LoadBalancerId loadBalancerId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.GetLoadBalancerAsync(loadBalancerId, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例3: ListAllLoadBalancerNodes
/// <summary>
/// Gets all existing load balancer nodes through a series of asynchronous operations,
/// each of which requests a subset of the available nodes.
/// </summary>
/// <param name="provider">The load balancer service.</param>
/// <param name="limit">The maximum number of <see cref="Node"/> to return from a single task. If this value is <c>null</c>, a provider-specific default is used.</param>
/// <returns>
/// A collection of <see cref="Node"/> objects, each of which represents a subset
/// of the available load balancer nodes.
/// </returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="provider"/> is <c>null</c>.
/// <para>-or-</para>
/// <para>If <paramref name="loadBalancerId"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="ArgumentException">If <paramref name="loadBalancerId"/> is empty.</exception>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="limit"/> is less than or equal to 0.</exception>
private static IEnumerable<Node> ListAllLoadBalancerNodes(ILoadBalancerService provider, LoadBalancerId loadBalancerId, int? limit, CancellationToken cancellationToken)
{
if (provider == null)
throw new ArgumentNullException("provider");
if (limit <= 0)
throw new ArgumentOutOfRangeException("limit");
// this API call is not currently paginated
IEnumerable<Node> loadBalancers = provider.ListNodesAsync(loadBalancerId, cancellationToken).Result;
return loadBalancers;
}
示例4: ListAllNodeServiceEvents
private static IEnumerable<NodeServiceEvent> ListAllNodeServiceEvents(ILoadBalancerService provider, LoadBalancerId loadBalancerId, int? limit, CancellationToken cancellationToken)
{
if (limit <= 0)
throw new ArgumentOutOfRangeException("limit");
NodeServiceEvent lastServiceEvent = null;
do
{
NodeServiceEventId marker = lastServiceEvent != null ? lastServiceEvent.Id : null;
IEnumerable<NodeServiceEvent> serviceEvents = provider.ListNodeServiceEventsAsync(loadBalancerId, marker, limit, cancellationToken).Result;
lastServiceEvent = null;
foreach (NodeServiceEvent serviceEvent in serviceEvents)
{
yield return serviceEvent;
lastServiceEvent = serviceEvent;
}
} while (lastServiceEvent != null);
}
示例5: ListHistoricalUsage
public static ReadOnlyCollection<LoadBalancerUsage> ListHistoricalUsage(this ILoadBalancerService service, LoadBalancerId loadBalancerId, DateTimeOffset? startTime, DateTimeOffset? endTime)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListHistoricalUsageAsync(loadBalancerId, startTime, endTime, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例6: RemoveVirtualAddressRange
public static void RemoveVirtualAddressRange(this ILoadBalancerService service, LoadBalancerId loadBalancerId, IEnumerable<VirtualAddressId> virtualAddressIds)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.RemoveVirtualAddressRangeAsync(loadBalancerId, virtualAddressIds, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例7: AddVirtualAddress
public static LoadBalancerVirtualAddress AddVirtualAddress(this ILoadBalancerService service, LoadBalancerId loadBalancerId, LoadBalancerVirtualAddressType type, AddressFamily addressFamily)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.AddVirtualAddressAsync(loadBalancerId, type, addressFamily, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例8: UpdateNode
public static void UpdateNode(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NodeId nodeId, NodeUpdate configuration)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.UpdateNodeAsync(loadBalancerId, nodeId, configuration, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例9: AddNodeRange
public static ReadOnlyCollection<Node> AddNodeRange(this ILoadBalancerService service, LoadBalancerId loadBalancerId, IEnumerable<NodeConfiguration> nodeConfigurations)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.AddNodeRangeAsync(loadBalancerId, nodeConfigurations, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例10: SetErrorPage
public static void SetErrorPage(this ILoadBalancerService service, LoadBalancerId loadBalancerId, string content)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.SetErrorPageAsync(loadBalancerId, content, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例11: RemoveNodeMetadataItem
public static void RemoveNodeMetadataItem(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NodeId nodeId, IEnumerable<MetadataId> metadataIds)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.RemoveNodeMetadataItemAsync(loadBalancerId, nodeId, metadataIds, CancellationToken.None).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例12: UpdateLoadBalancerMetadataItem
public static void UpdateLoadBalancerMetadataItem(this ILoadBalancerService service, LoadBalancerId loadBalancerId, MetadataId metadataId, string value)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.UpdateLoadBalancerMetadataItemAsync(loadBalancerId, metadataId, value, CancellationToken.None).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例13: AddNodeMetadata
public static ReadOnlyCollection<LoadBalancerMetadataItem> AddNodeMetadata(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NodeId nodeId, IEnumerable<KeyValuePair<string, string>> metadata)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.AddNodeMetadataAsync(loadBalancerId, nodeId, metadata, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
示例14: RemoveAccessList
public static void RemoveAccessList(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NetworkItemId networkItemId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
service.RemoveAccessListAsync(loadBalancerId, networkItemId, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Wait();
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}