/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateConfigurationResponse response = new UpdateConfigurationResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("arn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Arn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("latestRevision", targetDepth))
                {
                    var unmarshaller = ConfigurationRevisionUnmarshaller.Instance;
                    response.LatestRevision = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #2
0
        public async Task <UpdateConfigurationResponse> UpdateConfiguration(UpdateConfigurationRequest o)
        {
            var result = new UpdateConfigurationResponse(o.RequestId);

            result.Updated = await Server.UpdateSettings(o.Application, o.Key, o.Value);

            return(result);
        }
Пример #3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateConfigurationResponse response = new UpdateConfigurationResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("arn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Arn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("created", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.Created = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("id", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Id = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("latestRevision", targetDepth))
                {
                    var unmarshaller = ConfigurationRevisionUnmarshaller.Instance;
                    response.LatestRevision = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("name", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Name = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("warnings", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <SanitizationWarning, SanitizationWarningUnmarshaller>(SanitizationWarningUnmarshaller.Instance);
                    response.Warnings = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #4
0
        public static async Task Main()
        {
            logger.Info("Starting example");
            AuditClient client = null;

            try
            {
                // Assumption: the compartment id has been set in environment variable.
                var compartmentId = Environment.GetEnvironmentVariable("OCI_COMPARTMENT_ID");
                logger.Info(compartmentId);

                // ListEvents
                var listEventsRequest = new ListEventsRequest
                {
                    CompartmentId = compartmentId,
                    StartTime     = DateTime.Now.AddDays(-1),
                    EndTime       = DateTime.Now
                };

                // Create AuditClient
                var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");

                using (client = new AuditClient(provider, new ClientConfiguration()))
                {
                    logger.Info("AuditClient created.");

                    ListEventsResponse listEventsResp = await NoRetryExample(client, listEventsRequest);

                    logger.Info($"Received {listEventsResp?.Items.Count} items");

                    ListEventsResponse listEventsRespFromRetry = await RetryExample(client, listEventsRequest);

                    logger.Info($"Received {listEventsRespFromRetry?.Items.Count} items");

                    await CancellationTokenExample(client, listEventsRequest);

                    // GetConfiguration
                    var getConfigurationRequest = new GetConfigurationRequest
                    {
                        CompartmentId = compartmentId
                    };

                    logger.Info("GetConfigurationRequest created.");

                    GetConfigurationResponse getConfigurationResp = await client.GetConfiguration(getConfigurationRequest);

                    logger.Info($"Retention period days: {getConfigurationResp?.Configuration.RetentionPeriodDays}");

                    // UpdateConfiguration
                    var updateConfigurationRequest = new UpdateConfigurationRequest
                    {
                        CompartmentId = compartmentId,
                        UpdateConfigurationDetails = new UpdateConfigurationDetails
                        {
                            RetentionPeriodDays = 90
                        }
                    };

                    logger.Info("UpdateConfigurationRequest created.");

                    UpdateConfigurationResponse updateConfigurationResp = await client.UpdateConfiguration(updateConfigurationRequest);

                    logger.Info($"opc work request id: {updateConfigurationResp.OpcRequestId}");
                }
            }
            catch (Exception e)
            {
                logger.Error($"Failed Audit example: {e.Message}");
            }
        }