Пример #1
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)
        {
            GetDataSourceResponse response = new GetDataSourceResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("dataSource", targetDepth))
                {
                    var unmarshaller = DataSourceUnmarshaller.Instance;
                    response.DataSource = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #2
0
        public GetDataSourceResponse GetDataSourceById(int Id)
        {
            return(dbPlugin.Execute((context) =>
            {
                try
                {
                    var source = context.datasourcedetail.FirstOrDefault(x => x.Id == Id);


                    var response = new GetDataSourceResponse()
                    {
                        ConnectionString = source.ConnectionString,
                        ConnectionType = source.ConnectionName,
                        IsDeleted = false,
                        Success = true
                    };
                    return response;
                }
                catch (Exception ex)
                {
                    return new GetDataSourceResponse();
                }
            }));
        }
Пример #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)
        {
            GetDataSourceResponse response = new GetDataSourceResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ComputeStatistics", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.ComputeStatistics = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ComputeTime", targetDepth))
                {
                    var unmarshaller = LongUnmarshaller.Instance;
                    response.ComputeTime = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("CreatedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.CreatedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("CreatedByIamUser", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.CreatedByIamUser = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DataLocationS3", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DataLocationS3 = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DataRearrangement", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DataRearrangement = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DataSizeInBytes", targetDepth))
                {
                    var unmarshaller = LongUnmarshaller.Instance;
                    response.DataSizeInBytes = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DataSourceId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DataSourceId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("DataSourceSchema", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DataSourceSchema = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("FinishedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.FinishedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("LastUpdatedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.LastUpdatedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("LogUri", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.LogUri = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Message", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Message = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Name", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Name = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NumberOfFiles", targetDepth))
                {
                    var unmarshaller = LongUnmarshaller.Instance;
                    response.NumberOfFiles = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RDSMetadata", targetDepth))
                {
                    var unmarshaller = RDSMetadataUnmarshaller.Instance;
                    response.RDSMetadata = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RedshiftMetadata", targetDepth))
                {
                    var unmarshaller = RedshiftMetadataUnmarshaller.Instance;
                    response.RedshiftMetadata = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RoleARN", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.RoleARN = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("StartedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.StartedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Status", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Status = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }