/// <summary> /// Get detailed information about a scaling group. /// </summary> /// <param name="service">The Auto Scale service instance.</param> /// <param name="groupId">The ID of the scaling group. This is obtained from <see cref="ScalingGroup.Id">ScalingGroup.Id</see>.</param> /// <returns>A <see cref="ScalingGroup"/> object describing the scaling group.</returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException">If <paramref name="groupId"/> is <see langword="null"/>.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/GET_showGroupManifest_v1.0__tenantId__groups__groupId__autoscale-groups.html">Show scaling group details (Rackspace Auto Scale Developer Guide - API v1.0)</seealso> public static ScalingGroup GetGroup(this IAutoScaleService service, ScalingGroupId groupId) { if (service == null) { throw new ArgumentNullException("service"); } try { return(service.GetGroupAsync(groupId, CancellationToken.None).Result); } catch (AggregateException ex) { ReadOnlyCollection <Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) { throw innerExceptions[0]; } throw; } }
/// <summary> /// Remove and delete a webhook associated with a scaling policy. /// </summary> /// <param name="service">The Auto Scale service instance.</param> /// <param name="groupId">The ID of the scaling group. This is obtained from <see cref="ScalingGroup.Id">ScalingGroup.Id</see>.</param> /// <param name="policyId">The ID of the scaling policy. This is obtained from <see cref="Policy.Id">Policy.Id</see>.</param> /// <param name="webhookId">The ID of the webhook. This is obtained from <see cref="Webhook.Id">Webhook.Id</see>.</param> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="groupId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="policyId"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="webhookId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/DELETE_deleteWebhook_v1.0__tenantId__groups__groupId__policies__policyId__webhooks__webhookId__autoscale-webhooks.html">Delete webhook (Rackspace Auto Scale Developer Guide - API v1.0)</seealso> public static void DeleteWebhook(this IAutoScaleService service, ScalingGroupId groupId, PolicyId policyId, WebhookId webhookId) { if (service == null) { throw new ArgumentNullException("service"); } try { service.DeleteWebhookAsync(groupId, policyId, webhookId, CancellationToken.None).Wait(); } catch (AggregateException ex) { ReadOnlyCollection <Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) { throw innerExceptions[0]; } throw; } }
/// <summary> /// Gets a collection of webhooks which trigger the execution of a particular /// scaling policy. /// </summary> /// <param name="service">The Auto Scale service instance.</param> /// <param name="groupId">The ID of the scaling group. This is obtained from <see cref="ScalingGroup.Id">ScalingGroup.Id</see>.</param> /// <param name="policyId">The ID of the scaling policy. This is obtained from <see cref="Policy.Id">Policy.Id</see>.</param> /// <param name="marker">The <see cref="Webhook.Id"/> of the last item in the previous list. Used for <see href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/pagination.html">pagination</see>. If the value is <see langword="null"/>, the list starts at the beginning.</param> /// <param name="limit">Indicates the maximum number of items to return. Used for <see href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/pagination.html">pagination</see>. If the value is <see langword="null"/>, a provider-specific default value is used.</param> /// <returns>A collection of <see cref="Webhook"/> objects describing the webhooks for the scaling policy.</returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="groupId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="policyId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentOutOfRangeException">If <paramref name="limit"/> is less than or equal to 0.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/GET_getWebhooks_v1.0__tenantId__groups__groupId__policies__policyId__webhooks_autoscale-webhooks.html">List webhooks for the policy (Rackspace Auto Scale Developer Guide - API v1.0)</seealso> public static ReadOnlyCollectionPage <Webhook> ListWebhooks(this IAutoScaleService service, ScalingGroupId groupId, PolicyId policyId, WebhookId marker, int?limit) { if (service == null) { throw new ArgumentNullException("service"); } try { return(service.ListWebhooksAsync(groupId, policyId, marker, limit, CancellationToken.None).Result); } catch (AggregateException ex) { ReadOnlyCollection <Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) { throw innerExceptions[0]; } throw; } }
/// <summary> /// Create a collection of webhooks capable of anonymously executing a scaling policy. /// </summary> /// <param name="service">The Auto Scale service instance.</param> /// <param name="groupId">The ID of the scaling group. This is obtained from <see cref="ScalingGroup.Id">ScalingGroup.Id</see>.</param> /// <param name="policyId">The ID of the scaling policy. This is obtained from <see cref="Policy.Id">Policy.Id</see>.</param> /// <param name="configurations">A collection of <see cref="NewWebhookConfiguration"/> objects describing the webhook configurations.</param> /// <returns>A collection of <see cref="Webhook"/> objects describing the newly created webhooks.</returns> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="groupId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="policyId"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="configurations"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException">If <paramref name="configurations"/> contains any <see langword="null"/> values.</exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/POST_createWebhook_v1.0__tenantId__groups__groupId__policies__policyId__webhooks_autoscale-webhooks.html">Create a webhook (Rackspace Auto Scale Developer Guide - API v1.0)</seealso> public static ReadOnlyCollection <Webhook> CreateWebhookRange(this IAutoScaleService service, ScalingGroupId groupId, PolicyId policyId, IEnumerable <NewWebhookConfiguration> configurations) { if (service == null) { throw new ArgumentNullException("service"); } try { return(service.CreateWebhookRangeAsync(groupId, policyId, configurations, CancellationToken.None).Result); } catch (AggregateException ex) { ReadOnlyCollection <Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) { throw innerExceptions[0]; } throw; } }
/// <summary> /// Set the launch configuration for a scaling group. /// </summary> /// <param name="service">The Auto Scale service instance.</param> /// <param name="groupId">The ID of the scaling group. This is obtained from <see cref="ScalingGroup.Id">ScalingGroup.Id</see>.</param> /// <param name="configuration">The new launch configuration for the scaling group.</param> /// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="groupId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="configuration"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="WebException">If the REST request does not return successfully.</exception> /// <seealso href="http://docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/PUT_putLaunchConfig_v1.0__tenantId__groups__groupId__launch_Configurations.html">Update launch configuration (Rackspace Auto Scale Developer Guide - API v1.0)</seealso> public static void SetLaunchConfiguration(this IAutoScaleService service, ScalingGroupId groupId, LaunchConfiguration configuration) { if (service == null) { throw new ArgumentNullException("service"); } try { service.SetLaunchConfigurationAsync(groupId, configuration, CancellationToken.None).Wait(); } catch (AggregateException ex) { ReadOnlyCollection <Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) { throw innerExceptions[0]; } throw; } }