コード例 #1
0
        public async Task TriggerSample()
        {
            #region Snippet:CreateTriggerClientPrep
#if SNIPPET
            // Replace the string below with your actual endpoint url.
            string endpoint = "<my-endpoint-url>";
#else
            string endpoint = TestEnvironment.EndpointUrl;
#endif
            string triggerName = "Test-Trigger";
            #endregion

            #region Snippet:CreateTriggerClient
            TriggerClient client = new TriggerClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential());
            #endregion

            #region Snippet:CreateTrigger
            TriggerResource triggerResource = new TriggerResource(new ScheduleTrigger(new ScheduleTriggerRecurrence()));
            TriggerCreateOrUpdateTriggerOperation operation      = client.StartCreateOrUpdateTrigger(triggerName, triggerResource);
            Response <TriggerResource>            createdTrigger = await operation.WaitForCompletionAsync();

            #endregion

            #region Snippet:RetrieveTrigger
            TriggerResource retrievedTrigger = client.GetTrigger(triggerName);
            #endregion

            #region Snippet:ListTriggers
            Pageable <TriggerResource> triggers = client.GetTriggersByWorkspace();
            foreach (TriggerResource trigger in triggers)
            {
                System.Console.WriteLine(trigger.Name);
            }
            #endregion

            #region Snippet:DeleteTrigger
            TriggerDeleteTriggerOperation deleteOperation = client.StartDeleteTrigger(triggerName);
            await deleteOperation.WaitForCompletionResponseAsync();

            #endregion
        }
コード例 #2
0
        public async ValueTask DisposeAsync()
        {
            TriggerDeleteTriggerOperation deleteOperation = await _client.StartDeleteTriggerAsync(Name);

            await deleteOperation.WaitForCompletionResponseAsync();
        }