public override void ExecuteCmdlet()
        {
            if (string.Equals(ParameterSetName, RegistryObjectParameterSet))
            {
                ResourceGroupName = Registry.ResourceGroupName;
                RegistryName      = Registry.Name;
            }
            else if (MyInvocation.BoundParameters.ContainsKey("ResourceId") || !string.IsNullOrWhiteSpace(ResourceId))
            {
                string resourceGroup, registryName, childResourceName;
                if (!ConversionUtilities.TryParseRegistryRelatedResourceId(ResourceId, out resourceGroup, out registryName, out childResourceName))
                {
                    WriteInvalidResourceIdError(InvalidRegistryResourceIdErrorMessage);
                    return;
                }

                ResourceGroupName = resourceGroup;
                RegistryName      = registryName;
            }

            var tags    = TagsConversionHelper.CreateTagDictionary(Tag, validate: true);
            var headers = ConversionUtilities.ToDictionary(Header);

            var parameters = new WebhookCreateParameters()
            {
                Actions       = Action,
                CustomHeaders = headers,
                ServiceUri    = Uri?.ToString(),
                Tags          = tags,
                Status        = Status ?? WebhookStatus.Enabled,
                Scope         = Scope,
                Location      = Location ?? RegistryClient.GetRegistryLocation(ResourceGroupName, RegistryName)
            };

            if (ShouldProcess(Name, "Create a webhook for the container registry"))
            {
                var webhook = RegistryClient.CreateWebhook(ResourceGroupName, RegistryName, Name, parameters);
                WriteObject(new PSContainerRegistryWebhook(webhook));
            }
        }
 public Webhook CreateWebhook(string resourceGroupName, string registryName, string webhookName, WebhookCreateParameters parameters)
 {
     return(_client.Webhooks.Create(resourceGroupName, registryName, webhookName, parameters));
 }
 /// <summary>
 /// Creates a webhook for a container registry with the specified parameters.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group to which the container registry belongs.
 /// </param>
 /// <param name='registryName'>
 /// The name of the container registry.
 /// </param>
 /// <param name='webhookName'>
 /// The name of the webhook.
 /// </param>
 /// <param name='webhookCreateParameters'>
 /// The parameters for creating a webhook.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task <Webhook> BeginCreateAsync(this IWebhooksOperations operations, string resourceGroupName, string registryName, string webhookName, WebhookCreateParameters webhookCreateParameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates a webhook for a container registry with the specified parameters.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group to which the container registry belongs.
 /// </param>
 /// <param name='registryName'>
 /// The name of the container registry.
 /// </param>
 /// <param name='webhookName'>
 /// The name of the webhook.
 /// </param>
 /// <param name='webhookCreateParameters'>
 /// The parameters for creating a webhook.
 /// </param>
 public static Webhook BeginCreate(this IWebhooksOperations operations, string resourceGroupName, string registryName, string webhookName, WebhookCreateParameters webhookCreateParameters)
 {
     return(operations.BeginCreateAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).GetAwaiter().GetResult());
 }