Esempio n. 1
0
        /// <summary>Snippet for CreateTrigger</summary>
        public void CreateTriggerResourceNames()
        {
            // Snippet: CreateTrigger(LocationName, Trigger, string, CallSettings)
            // Create client
            EventarcClient eventarcClient = EventarcClient.Create();
            // Initialize request argument(s)
            LocationName parent    = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            Trigger      trigger   = new Trigger();
            string       triggerId = "";
            // Make the request
            Operation <Trigger, OperationMetadata> response = eventarcClient.CreateTrigger(parent, trigger, triggerId);

            // Poll until the returned long-running operation is complete
            Operation <Trigger, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Trigger result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Trigger, OperationMetadata> retrievedResponse = eventarcClient.PollOnceCreateTrigger(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Trigger retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }