func awsRestjson1_deserializeDocumentWorkspaceDescription()

in service/grafana/deserializers.go [6504:6758]


func awsRestjson1_deserializeDocumentWorkspaceDescription(v **types.WorkspaceDescription, 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.WorkspaceDescription
	if *v == nil {
		sv = &types.WorkspaceDescription{}
	} else {
		sv = *v
	}

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

		case "authentication":
			if err := awsRestjson1_deserializeDocumentAuthenticationSummary(&sv.Authentication, value); err != nil {
				return err
			}

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

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

				}
			}

		case "dataSources":
			if err := awsRestjson1_deserializeDocumentDataSourceTypesList(&sv.DataSources, value); err != nil {
				return err
			}

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

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

		case "freeTrialConsumed":
			if value != nil {
				jtv, ok := value.(bool)
				if !ok {
					return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
				}
				sv.FreeTrialConsumed = ptr.Bool(jtv)
			}

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

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

				}
			}

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

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

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

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

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

				}
			}

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

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

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

				}
			}

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

		case "networkAccessControl":
			if err := awsRestjson1_deserializeDocumentNetworkAccessConfiguration(&sv.NetworkAccessControl, value); err != nil {
				return err
			}

		case "notificationDestinations":
			if err := awsRestjson1_deserializeDocumentNotificationDestinationsList(&sv.NotificationDestinations, value); err != nil {
				return err
			}

		case "organizationalUnits":
			if err := awsRestjson1_deserializeDocumentOrganizationalUnitList(&sv.OrganizationalUnits, value); err != nil {
				return err
			}

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

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

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

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

		case "tags":
			if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
				return err
			}

		case "vpcConfiguration":
			if err := awsRestjson1_deserializeDocumentVpcConfiguration(&sv.VpcConfiguration, value); err != nil {
				return err
			}

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

		default:
			_, _ = key, value

		}
	}
	*v = sv
	return nil
}