public override void ExecuteApiManagementCmdlet() { string resourceGroupName; string serviceName; string subscriptionId; if (ParameterSetName.Equals(ByInputObjectParameterSet)) { subscriptionId = InputObject.SubscriptionId; resourceGroupName = InputObject.ResourceGroupName; serviceName = InputObject.ServiceName; } else if (ParameterSetName.Equals(ExpandedParameterSet)) { subscriptionId = SubscriptionId; resourceGroupName = Context.ResourceGroupName; serviceName = Context.ServiceName; } else { var subscriptionObject = new PsApiManagementSubscription(ResourceId); resourceGroupName = subscriptionObject.ResourceGroupName; serviceName = subscriptionObject.ServiceName; subscriptionId = subscriptionObject.SubscriptionId; } var actionDescription = string.Format(CultureInfo.CurrentCulture, Resources.SubscriptionRemoveDescription, subscriptionId); var actionWarning = string.Format(CultureInfo.CurrentCulture, Resources.SubscriptionRemoveWarning, subscriptionId); // Do nothing if force is not specified and user cancelled the operation if (!ShouldProcess( actionDescription, actionWarning, Resources.ShouldProcessCaption)) { return; } Client.SubscriptionRemove(resourceGroupName, serviceName, subscriptionId); if (PassThru.IsPresent) { WriteObject(true); } }
public override void ExecuteApiManagementCmdlet() { var subscriptionId = SubscriptionId ?? Guid.NewGuid().ToString("N"); PsApiManagementSubscription subscription = Client.SubscriptionCreate( Context, subscriptionId, Scope, ProductId, UserId, Name, PrimaryKey, SecondaryKey, AllowTracing.IsPresent, State); WriteObject(subscription); }