/// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="PlacementSpec" />.</param>
 /// <returns>
 /// an instance of <see cref="PlacementSpec" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         PlacementSpec.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new PlacementSpec
         {
             EntitySpecList = sourceValue.EntitySpecList,
             ProbableClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ProbableClusterReference),
             TenantUuid = sourceValue.TenantUuid,
         });
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 2
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="Vm" />.</param>
 /// <returns>
 /// an instance of <see cref="Vm" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         Vm.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new Vm
         {
             Name = sourceValue.Name,
             Description = sourceValue.Description,
             AvailabilityZoneReference = AvailabilityZoneReferenceTypeConverter.ConvertFrom(sourceValue.AvailabilityZoneReference),
             ClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ClusterReference),
             Resources = VmResourcesTypeConverter.ConvertFrom(sourceValue.Resources),
         });
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 3
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="ImageMigrateInput" />.</param>
 /// <returns>
 /// an instance of <see cref="ImageMigrateInput" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         ImageMigrateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new ImageMigrateInput
         {
             ClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ClusterReference),
             ImageReferenceList = sourceValue.ImageReferenceList,
         });
     }
     catch
     {
     }
     return(null);
 }
Esempio n. 4
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="ImageDefStatus" />.</param>
 /// <returns>
 /// an instance of <see cref="ImageDefStatus" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         ImageDefStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new ImageDefStatus
         {
             Name = sourceValue.Name,
             Description = sourceValue.Description,
             AvailabilityZoneReference = AvailabilityZoneReferenceTypeConverter.ConvertFrom(sourceValue.AvailabilityZoneReference),
             ClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ClusterReference),
             MessageList = sourceValue.MessageList,
             Resources = ImageResourcesDefStatusTypeConverter.ConvertFrom(sourceValue.Resources),
             State = sourceValue.State,
         });
     }
     catch
     {
     }
     return(null);
 }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="PlacementDetail" />.</param>
 /// <returns>
 /// an instance of <see cref="PlacementDetail" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return null;
     }
     try
     {
         PlacementDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return new PlacementDetail
         {
         ClusterIp = sourceValue.ClusterIp,
         ClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ClusterReference),
         };
     }
     catch
     {
     }
     return null;
 }
Esempio n. 6
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the value to convert into an instance of <see cref="Task" />.</param>
 /// <returns>
 /// an instance of <see cref="Task" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public static object ConvertFrom(dynamic sourceValue)
 {
     if (null == sourceValue)
     {
         return(null);
     }
     try
     {
         Task.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());
     }
     catch
     {
         // Unable to use JSON pattern
     }
     try
     {
         return(new Task
         {
             ApiVersion = sourceValue.ApiVersion,
             ClusterReference = ClusterReferenceTypeConverter.ConvertFrom(sourceValue.ClusterReference),
             CompletionTime = sourceValue.CompletionTime,
             CreationTime = sourceValue.CreationTime,
             EntityReferenceList = sourceValue.EntityReferenceList,
             ErrorCode = sourceValue.ErrorCode,
             ErrorDetail = sourceValue.ErrorDetail,
             LastUpdateTime = sourceValue.LastUpdateTime,
             LogicalTimestamp = sourceValue.LogicalTimestamp,
             OperationType = sourceValue.OperationType,
             ParentTaskReference = TaskReferenceTypeConverter.ConvertFrom(sourceValue.ParentTaskReference),
             PercentageComplete = sourceValue.PercentageComplete,
             ProgressMessage = sourceValue.ProgressMessage,
             StartTime = sourceValue.StartTime,
             Status = sourceValue.Status,
             SubtaskReferenceList = sourceValue.SubtaskReferenceList,
             Uuid = sourceValue.Uuid,
         });
     }
     catch
     {
     }
     return(null);
 }