agent/taskresource/types/types.go
func (rm *ResourcesMap) UnmarshalJSON(data []byte) error {
	resources := make(map[string]json.RawMessage)
	err := json.Unmarshal(data, &resources)
	if err != nil {
		return err
	}
	result := make(map[string][]taskresource.TaskResource)
	for key, value := range resources {
		switch key {
		case CgroupKey:
			if unmarshlCgroup(key, value, result) != nil {
				return err
			}
		case DockerVolumeKey:
			if unmarshalDockerVolume(key, value, result) != nil {
				return err
			}
		case ASMAuthKey:
			if unmarshalASMAuthKey(key, value, result) != nil {
				return err
			}
		case SSMSecretKey:
			if unmarshalSSMSecretKey(key, value, result) != nil {
				return err
			}
		case ASMSecretKey:
			if unmarshalASMSecretKey(key, value, result) != nil {
				return err
			}
		default:
			return errors.New("Unsupported resource type")
		}
	}
	*rm = result
	return nil
}
func (rm *ResourcesMap) UnmarshalJSON(data []byte) error {
	resources := make(map[string]json.RawMessage)
	err := json.Unmarshal(data, &resources)
	if err != nil {
		return err
	}
	result := make(map[string][]taskresource.TaskResource)
	for key, value := range resources {
		switch key {
		case CgroupKey:
			if unmarshlCgroup(key, value, result) != nil {
				return err
			}
		case DockerVolumeKey:
			if unmarshalDockerVolume(key, value, result) != nil {
				return err
			}
		case ASMAuthKey:
			if unmarshalASMAuthKey(key, value, result) != nil {
				return err
			}
		case SSMSecretKey:
			if unmarshalSSMSecretKey(key, value, result) != nil {
				return err
			}
		case ASMSecretKey:
			if unmarshalASMSecretKey(key, value, result) != nil {
				return err
			}
		default:
			return errors.New("Unsupported resource type")
		}
	}
	*rm = result
	return nil
}
func ( rm * ResourcesMap ) UnmarshalJSON ( data [ ] byte ) error { resources := make ( map [ string ] json . RawMessage ) err := json . Unmarshal ( data , & resources ) if err != nil { return err } result := make ( map [ string ] [ ] taskresource . TaskResource ) for key , value := range resources { switch key { case CgroupKey : if unmarshlCgroup ( key , value , result ) != nil { return err } case DockerVolumeKey : if unmarshalDockerVolume ( key , value , result ) != nil { return err } case ASMAuthKey : if unmarshalASMAuthKey ( key , value , result ) != nil { return err } case SSMSecretKey : if unmarshalSSMSecretKey ( key , value , result ) != nil { return err } case ASMSecretKey : if unmarshalASMSecretKey ( key , value , result ) != nil { return err } default : return errors . New ( " " ) } } * rm = result return nil }
// UnmarshalJSON unmarshals ResourcesMap object
UnmarshalJSON unmarshals ResourcesMap object