func awsAwsjson11_deserializeDocumentJobMetadata()

in service/snowball/deserializers.go [5043:5268]


func awsAwsjson11_deserializeDocumentJobMetadata(v **types.JobMetadata, value interface{}) error {
	if v == nil {
		return fmt.Errorf("unexpected nil of type %T", v)
	}
	if value == nil {
		return nil
	}

	shape, ok := value.(map[string]interface{})
	if !ok {
		return fmt.Errorf("unexpected JSON type %v", value)
	}

	var sv *types.JobMetadata
	if *v == nil {
		sv = &types.JobMetadata{}
	} else {
		sv = *v
	}

	for key, value := range shape {
		switch key {
		case "AddressId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected AddressId to be of type string, got %T instead", value)
				}
				sv.AddressId = ptr.String(jtv)
			}

		case "ClusterId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.ClusterId = ptr.String(jtv)
			}

		case "CreationDate":
			if value != nil {
				switch jtv := value.(type) {
				case json.Number:
					f64, err := jtv.Float64()
					if err != nil {
						return err
					}
					sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64))

				default:
					return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)

				}
			}

		case "DataTransferProgress":
			if err := awsAwsjson11_deserializeDocumentDataTransfer(&sv.DataTransferProgress, value); err != nil {
				return err
			}

		case "Description":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.Description = ptr.String(jtv)
			}

		case "DeviceConfiguration":
			if err := awsAwsjson11_deserializeDocumentDeviceConfiguration(&sv.DeviceConfiguration, value); err != nil {
				return err
			}

		case "ForwardingAddressId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected AddressId to be of type string, got %T instead", value)
				}
				sv.ForwardingAddressId = ptr.String(jtv)
			}

		case "ImpactLevel":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected ImpactLevel to be of type string, got %T instead", value)
				}
				sv.ImpactLevel = types.ImpactLevel(jtv)
			}

		case "JobId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.JobId = ptr.String(jtv)
			}

		case "JobLogInfo":
			if err := awsAwsjson11_deserializeDocumentJobLogs(&sv.JobLogInfo, value); err != nil {
				return err
			}

		case "JobState":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected JobState to be of type string, got %T instead", value)
				}
				sv.JobState = types.JobState(jtv)
			}

		case "JobType":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected JobType to be of type string, got %T instead", value)
				}
				sv.JobType = types.JobType(jtv)
			}

		case "KmsKeyARN":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected KmsKeyARN to be of type string, got %T instead", value)
				}
				sv.KmsKeyARN = ptr.String(jtv)
			}

		case "LongTermPricingId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected LongTermPricingId to be of type string, got %T instead", value)
				}
				sv.LongTermPricingId = ptr.String(jtv)
			}

		case "Notification":
			if err := awsAwsjson11_deserializeDocumentNotification(&sv.Notification, value); err != nil {
				return err
			}

		case "OnDeviceServiceConfiguration":
			if err := awsAwsjson11_deserializeDocumentOnDeviceServiceConfiguration(&sv.OnDeviceServiceConfiguration, value); err != nil {
				return err
			}

		case "PickupDetails":
			if err := awsAwsjson11_deserializeDocumentPickupDetails(&sv.PickupDetails, value); err != nil {
				return err
			}

		case "RemoteManagement":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RemoteManagement to be of type string, got %T instead", value)
				}
				sv.RemoteManagement = types.RemoteManagement(jtv)
			}

		case "Resources":
			if err := awsAwsjson11_deserializeDocumentJobResource(&sv.Resources, value); err != nil {
				return err
			}

		case "RoleARN":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RoleARN to be of type string, got %T instead", value)
				}
				sv.RoleARN = ptr.String(jtv)
			}

		case "ShippingDetails":
			if err := awsAwsjson11_deserializeDocumentShippingDetails(&sv.ShippingDetails, value); err != nil {
				return err
			}

		case "SnowballCapacityPreference":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected SnowballCapacity to be of type string, got %T instead", value)
				}
				sv.SnowballCapacityPreference = types.SnowballCapacity(jtv)
			}

		case "SnowballId":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.SnowballId = ptr.String(jtv)
			}

		case "SnowballType":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected SnowballType to be of type string, got %T instead", value)
				}
				sv.SnowballType = types.SnowballType(jtv)
			}

		case "TaxDocuments":
			if err := awsAwsjson11_deserializeDocumentTaxDocuments(&sv.TaxDocuments, value); err != nil {
				return err
			}

		default:
			_, _ = key, value

		}
	}
	*v = sv
	return nil
}