public async Task TriggerSample()
        {
            #region Snippet:CreateTriggerClient
            // Replace the string below with your actual endpoint url.
            string endpoint = "<my-endpoint-url>";
            /*@@*/ endpoint = TestEnvironment.EndpointUrl;
            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("MyTrigger", triggerResource);
            Response <TriggerResource>            createdTrigger = await operation.WaitForCompletionAsync();

            #endregion

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

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

            #region Snippet:DeleteTrigger
            client.StartDeleteTrigger("MyTrigger");
            #endregion
        }
Exemple #2
0
 public void CreateTrigger()
 {
     #region Snippet:CreateTrigger
     TriggerCreateOrUpdateTriggerOperation operation = TriggerClient.StartCreateOrUpdateTrigger("MyTrigger", new TriggerResource(new Trigger()));
     TriggerResource trigger = operation.WaitForCompletionAsync().ConfigureAwait(true).GetAwaiter().GetResult();
     #endregion
 }
Exemple #3
0
        public static async ValueTask <TriggerResource> CreateResource(TriggerClient client, TestRecording recording)
        {
            string          triggerName = recording.GenerateId("Trigger", 16);
            TriggerResource trigger     = new TriggerResource(new ScheduleTrigger(new ScheduleTriggerRecurrence()));
            TriggerCreateOrUpdateTriggerOperation createOperation = await client.StartCreateOrUpdateTriggerAsync(triggerName, trigger);

            return(await createOperation.WaitForCompletionAsync());
        }
        public async Task TestCreateTrigger()
        {
            string triggerName = Recording.GenerateName("Trigger");
            TriggerCreateOrUpdateTriggerOperation operation = await TriggerClient.StartCreateOrUpdateTriggerAsync(triggerName, new TriggerResource(new Trigger()));

            TriggerResource trigger = await operation.WaitForCompletionAsync();

            Assert.AreEqual(triggerName, trigger.Name);
        }
        public async Task TestCreateTrigger()
        {
            TriggerClient client = CreateClient();

            string triggerName = Recording.GenerateId("Trigger", 16);
            TriggerCreateOrUpdateTriggerOperation operation = await client.StartCreateOrUpdateTriggerAsync(triggerName, new TriggerResource(new ScheduleTrigger(new ScheduleTriggerRecurrence())));

            TriggerResource trigger = await operation.WaitForCompletionAsync();

            Assert.AreEqual(triggerName, trigger.Name);
        }
        public async Task TestDeleteTrigger()
        {
            string triggerName = Recording.GenerateName("Trigger");

            TriggerCreateOrUpdateTriggerOperation createOperation = await TriggerClient.StartCreateOrUpdateTriggerAsync(triggerName, new TriggerResource(new Trigger()));

            await createOperation.WaitForCompletionAsync();

            TriggerDeleteTriggerOperation deleteOperation = await TriggerClient.StartDeleteTriggerAsync(triggerName);

            Response response = await deleteOperation.WaitForCompletionAsync();

            Assert.AreEqual(200, response.Status);
        }