Ezequiel Torres created AURORA-1991:
---------------------------------------

             Summary: TaskEvents in API Thrift should have optional parameters
                 Key: AURORA-1991
                 URL: https://issues.apache.org/jira/browse/AURORA-1991
             Project: Aurora
          Issue Type: Bug
          Components: Client
    Affects Versions: 0.19.1
            Reporter: Ezequiel Torres


Struct 
[TaskQuery|https://git-wip-us.apache.org/repos/asf?p=aurora.git;a=blob;f=api/src/main/thrift/org/apache/aurora/gen/api.thrift;h=7265b11103aa12743c42355163ae64e98e965d7f;hb=HEAD#l579]
 should have optional parameters in order to be able to be used in languages 
like Go where types does not have a null value by default.

The following is the autogenerated code created by Thrift with optional 
parameters and without optional parameters in Golang:

+*_Without Optional Parameters_*+
{code:go}
type TaskQuery struct {
  // unused field # 1
  JobName string `thrift:"jobName,2" json:"jobName"`
  // unused field # 3
  TaskIds map[string]bool `thrift:"taskIds,4" json:"taskIds"`
  Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
  // unused field # 6
  InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
  // unused field # 8
  Environment string `thrift:"environment,9" json:"environment"`
  SlaveHosts map[string]bool `thrift:"slaveHosts,10" json:"slaveHosts"`
  JobKeys map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
  Offset int32 `thrift:"offset,12" json:"offset"`
  Limit int32 `thrift:"limit,13" json:"limit"`
  Role string `thrift:"role,14" json:"role"`
}
{code}

_*+With Optional Parameters+*_
{code:go}

type TaskQuery struct {
        // unused field # 1
        JobName *string `thrift:"jobName,2" json:"jobName"`
        // unused field # 3
        TaskIds  map[string]bool         `thrift:"taskIds,4" json:"taskIds"`
        Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"`
        // unused field # 6
        InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"`
        // unused field # 8
        Environment *string          `thrift:"environment,9" json:"environment"`
        SlaveHosts  map[string]bool  `thrift:"slaveHosts,10" json:"slaveHosts"`
        JobKeys     map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"`
        Offset      *int32           `thrift:"offset,12" json:"offset"`
        Limit       *int32           `thrift:"limit,13" json:"limit"`
        Role        *string          `thrift:"role,14" json:"role"`
}
{code}

It can be seen that with an optional parameters like JobName, Role and 
Environment now can be set with a null value



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to