/// <summary>
        /// Creates a waiter using the provided configuration.
        /// </summary>
        /// <param name="request">Request to send.</param>
        /// <param name="config">Wait Configuration</param>
        /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
        /// <returns>a new Oci.common.Waiter instance</returns>
        public Waiter <GetKeyRequest, GetKeyResponse> ForKey(GetKeyRequest request, WaiterConfiguration config, params Key.LifecycleStateEnum[] targetStates)
        {
            var agent = new WaiterAgent <GetKeyRequest, GetKeyResponse>(
                request,
                request => client.GetKey(request),
                response => targetStates.Contains(response.Key.LifecycleState.Value),
                targetStates.Contains(Key.LifecycleStateEnum.Deleted)
                );

            return(new Waiter <GetKeyRequest, GetKeyResponse>(config, agent));
        }
Exemplo n.º 2
0
        private static async Task GetKey(KmsManagementClient kmsManagementClient, string keyId)
        {
            logger.Info("Get Key");

            GetKeyRequest getKeyRequest = new GetKeyRequest
            {
                KeyId = keyId
            };
            GetKeyResponse getKeyResponse = await kmsManagementClient.GetKey(getKeyRequest);

            logger.Info($"Key Retrieved: {getKeyResponse.Key.DisplayName}");
        }