diff --git a/.auroraversion b/.auroraversion index 8854156..ca222b7 100644 --- a/.auroraversion +++ b/.auroraversion @@ -1 +1 @@ -0.21.0 +0.23.0 diff --git a/.github/main.yml b/.github/main.yml new file mode 100644 index 0000000..0445266 --- /dev/null +++ b/.github/main.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Go for use with actions + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install goimports + run: go get golang.org/x/tools/cmd/goimports + - name: Set env with list of directories in repo containin go code + run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV + - name: Run goimports check + run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + - name: Create aurora/mesos docker cluster + run: docker-compose up -d + - name: Run tests + run: go test -timeout 35m -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..6c1890f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,57 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + schedule: + - cron: '34 4 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + - run: go build examples/client.go + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7edfc51 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Go for use with actions + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Install goimports + run: go get golang.org/x/tools/cmd/goimports + - name: Set env with list of directories in repo containin go code + run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV + - name: Run goimports check + run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + - name: Create aurora/mesos docker cluster + run: docker-compose up -d + - name: Run tests + run: go test -timeout 35m -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..dd37918 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,71 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # default concurrency is a available CPU number + concurrency: 4 + + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 1m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + skip-dirs: + - gen-go/ + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: colored-line-number + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + + +# all available settings of specific linters +linters-settings: + errcheck: + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; + # default is false: such cases aren't reported by default. + check-type-assertions: true + + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # default is false: such cases aren't reported by default. + check-blank: true + govet: + # report about shadowed variables + check-shadowing: true + goconst: + # minimal length of string constant, 3 by default + min-len: 3 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 2 + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + locale: US + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 120 + # tab width in spaces. Default to 1. + tab-width: 4 + +linters: + enable: + - govet + - goimports + - golint + - lll + - goconst + enable-all: false + fast: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 83cbcca..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -sudo: required - -language: go - -branches: - only: - - master - - master-v2.0 - - future - -go: - - "1.10.x" - -env: - global: - - GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") - -services: - - docker - -before_install: - - go get golang.org/x/tools/cmd/goimports - - test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" - -install: - - docker-compose up -d - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic -v github.com/paypal/gorealis - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4ac174..9cfbaef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,55 @@ +1.25.1 (unreleased) + +1.25.0 + +* Add priority api + +1.24.0 + +* enable default sla for slaDrain +* Changes Travis CI badge to Github Actions badge +* Bug fix for auto paused update monitor +* Adds support for running CI on github actions + +1.23.0 + +* First release tested against Aurora Scheduler 0.23.0 + +1.22.5 + +* Upgrading to thrift 0.14.0 + +1.22.4 + +* Updates which result in a no-op now return a response value so that the caller may analyze it to determine what happened + +1.22.3 + +* Contains a monitor timeout fix. Previously an error was being left unchecked which made a specific monitor timining out not be handled properly. + +1.22.2 + +* Bug fix: Change in retry mechanism created a deadlock. This release reverts that particular change. + +1.22.1 + +* Adding safeguards against setting multiple constraints with the same name for a single task. + +1.22.0 + +* CreateService and StartJobUpdate do not continue retrying if a timeout has been encountered +by the HTTP client. Instead they now return an error that conforms to the Timedout interface. +Users can check for a Timedout error by using `realis.IsTimeout(err)`. +* New API function VariableBatchStep has been added which returns the current batch at which +a Variable Batch Update configured Update is currently in. +* Added new PauseUpdateMonitor which monitors an update until it is an `ROLL_FORWARD_PAUSED` state. +* Added variableBatchStep command to sample client to be used for testing new VariableBatchStep api. +* JobUpdateStatus has changed function signature from: +`JobUpdateStatus(updateKey aurora.JobUpdateKey, desiredStatuses map[aurora.JobUpdateStatus]bool, interval, timeout time.Duration) (aurora.JobUpdateStatus, error)` +to +`JobUpdateStatus(updateKey aurora.JobUpdateKey, desiredStatuses []aurora.JobUpdateStatus, interval, timeout time.Duration) (aurora.JobUpdateStatus, error)` +* Added TerminalUpdateStates function which returns an slice containing all UpdateStates which are considered terminal states. + 1.21.0 * Version numbering change. Future versions will be labled X.Y.Z where X is the major version, Y is the Aurora version the library has been tested against (e.g. 21 -> 0.21.0), and X is the minor revision. @@ -5,4 +57,6 @@ * `aurora.ACTIVE_STATES`, `aurora.SLAVE_ASSIGNED_STATES`, `aurora.LIVE_STATES`, `aurora.TERMINAL_STATES`, `aurora.ACTIVE_JOB_UPDATE_STATES`, `aurora.AWAITNG_PULSE_JOB_UPDATE_STATES` are all now generated as a slices. * Please use `realis.ActiveStates`, `realis.SlaveAssignedStates`,`realis.LiveStates`, `realis.TerminalStates`, `realis.ActiveJobUpdateStates`, `realis.AwaitingPulseJobUpdateStates` in their places when map representations are needed. * `GetInstanceIds(key *aurora.JobKey, states map[aurora.ScheduleStatus]bool) (map[int32]bool, error)` has changed signature to ` GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error)` -* Adding support for GPU as resource. \ No newline at end of file +* Adding support for GPU as resource. +* Changing compose environment to Aurora snapshot in order to support staggered update. +* Adding staggered updates API. diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 109946a..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,64 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:89696c38cec777120b8b1bb5e2d363d655cf2e1e7d8c851919aaa0fd576d9b86" - name = "github.com/apache/thrift" - packages = ["lib/go/thrift"] - pruneopts = "" - revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33" - version = "v0.12.0" - -[[projects]] - digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b" - name = "github.com/davecgh/go-spew" - packages = ["spew"] - pruneopts = "" - revision = "346938d642f2ec3594ed81d874461961cd0faa76" - version = "v1.1.0" - -[[projects]] - digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "" - revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc" - -[[projects]] - digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411" - name = "github.com/pmezard/go-difflib" - packages = ["difflib"] - pruneopts = "" - revision = "792786c7400a136282c1664665ae0a8db921c6c2" - version = "v1.0.0" - -[[projects]] - digest = "1:78bea5e26e82826dacc5fd64a1013a6711b7075ec8072819b89e6ad76cb8196d" - name = "github.com/samuel/go-zookeeper" - packages = ["zk"] - pruneopts = "" - revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5" - -[[projects]] - digest = "1:2d0dc026c4aef5e2f3a0e06a4dabe268b840d8f63190cf6894e02134a03f52c5" - name = "github.com/stretchr/testify" - packages = [ - "assert", - "require", - ] - pruneopts = "" - revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c" - version = "v1.2.0" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/apache/thrift/lib/go/thrift", - "github.com/pkg/errors", - "github.com/samuel/go-zookeeper/zk", - "github.com/stretchr/testify/assert", - "github.com/stretchr/testify/require", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 6d4f1dd..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,16 +0,0 @@ -[[constraint]] - name = "github.com/apache/thrift" - version = "0.12.0" - -[[constraint]] - name = "github.com/pkg/errors" - revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc" - -[[constraint]] - name = "github.com/samuel/go-zookeeper" - revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5" - -[[constraint]] - name = "github.com/stretchr/testify" - version = "1.2.0" - diff --git a/README.md b/README.md index 7868f2c..0ce8bc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) [![Build Status](https://travis-ci.org/paypal/gorealis.svg?branch=master)](https://travis-ci.org/paypal/gorealis) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/master/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis) +# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) ![CI Build Status](https://github.com/paypal/gorealis/actions/workflows/main.yml/badge.svg) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/main/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis) -Go library for interacting with [Apache Aurora](https://github.com/apache/aurora). +Version 1 of Go library for interacting with [Aurora Scheduler](https://github.com/aurora-scheduler/aurora). + +Version 2 of this library can be found [here](https://github.com/aurora-scheduler/gorealis). ### Aurora version compatibility Please see [.auroraversion](./.auroraversion) to see the latest Aurora version against which this @@ -14,7 +16,7 @@ library has been tested. ## Projects using gorealis -* [australis](https://github.com/rdelval/australis) +* [australis](https://github.com/aurora-scheduler/australis) ## Contributions Contributions are always welcome. Please raise an issue to discuss a contribution before it is made. diff --git a/auroraAPI.thrift b/auroraAPI.thrift index 063774d..3e43f6f 100644 --- a/auroraAPI.thrift +++ b/auroraAPI.thrift @@ -716,9 +716,40 @@ struct JobUpdateKey { 2: string id } +/** Limits the amount of active changes being made to instances to groupSize. */ +struct QueueJobUpdateStrategy { + 1: i32 groupSize +} + +/** Similar to Queue strategy but will not start a new group until all instances in an active + * group have finished updating. + */ +struct BatchJobUpdateStrategy { + 1: i32 groupSize + /* Update will pause automatically after each batch completes */ + 2: bool autopauseAfterBatch +} + +/** Same as Batch strategy but each time an active group completes, the size of the next active + * group may change. + */ +struct VariableBatchJobUpdateStrategy { + 1: list groupSizes + /* Update will pause automatically after each batch completes */ + 2: bool autopauseAfterBatch +} + +union JobUpdateStrategy { + 1: QueueJobUpdateStrategy queueStrategy + 2: BatchJobUpdateStrategy batchStrategy + 3: VariableBatchJobUpdateStrategy varBatchStrategy +} + /** Job update thresholds and limits. */ struct JobUpdateSettings { - /** Max number of instances being updated at any given moment. */ + /** Deprecated, please set value inside of desired update strategy instead. + * Max number of instances being updated at any given moment. + */ 1: i32 updateGroupSize /** Max number of instance failures to tolerate before marking instance as FAILED. */ @@ -736,7 +767,7 @@ struct JobUpdateSettings { /** Instance IDs to act on. All instances will be affected if this is not set. */ 7: set updateOnlyTheseInstances - /** + /** Deprecated, please set updateStrategy to the Batch strategy instead. * If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another * batch until the preceding batch finishes updating. */ @@ -755,6 +786,9 @@ struct JobUpdateSettings { * differs between the old and new task configurations, updates will use the newest configuration. */ 10: optional bool slaAware + + /** Update strategy to be used for the update. See JobUpdateStrategy for choices. */ + 11: optional JobUpdateStrategy updateStrategy } /** Event marking a state transition in job update lifecycle. */ diff --git a/clusters.go b/clusters.go index 0d20db5..339dc38 100644 --- a/clusters.go +++ b/clusters.go @@ -21,6 +21,8 @@ import ( "github.com/pkg/errors" ) +// Cluster contains the definition of the clusters.json file used by the default Aurora +// client for configuration type Cluster struct { Name string `json:"name"` AgentRoot string `json:"slave_root"` @@ -33,7 +35,8 @@ type Cluster struct { AuthMechanism string `json:"auth_mechanism"` } -// Loads clusters.json file traditionally located at /etc/aurora/clusters.json +// LoadClusters loads clusters.json file traditionally located at /etc/aurora/clusters.json +// for use with a gorealis client func LoadClusters(config string) (map[string]Cluster, error) { file, err := os.Open(config) diff --git a/container.go b/container.go index 5735ec8..7c51d2f 100644 --- a/container.go +++ b/container.go @@ -18,31 +18,40 @@ import ( "github.com/paypal/gorealis/gen-go/apache/aurora" ) +// Container is an interface that defines a single function needed to create +// an Aurora container type. It exists because the code must support both Mesos +// and Docker containers. type Container interface { Build() *aurora.Container } +// MesosContainer is a Mesos style container that can be used by Aurora Jobs. type MesosContainer struct { container *aurora.MesosContainer } +// DockerContainer is a vanilla Docker style container that can be used by Aurora Jobs. type DockerContainer struct { container *aurora.DockerContainer } +// NewDockerContainer creates a new Aurora compatible Docker container configuration. func NewDockerContainer() DockerContainer { return DockerContainer{container: aurora.NewDockerContainer()} } +// Build creates an Aurora container based upon the configuration provided. func (c DockerContainer) Build() *aurora.Container { return &aurora.Container{Docker: c.container} } +// Image adds the name of a Docker image to be used by the Job when running. func (c DockerContainer) Image(image string) DockerContainer { c.container.Image = image return c } +// AddParameter adds a parameter to be passed to Docker when the container is run. func (c DockerContainer) AddParameter(name, value string) DockerContainer { c.container.Parameters = append(c.container.Parameters, &aurora.DockerParameter{ Name: name, @@ -51,14 +60,17 @@ func (c DockerContainer) AddParameter(name, value string) DockerContainer { return c } +// NewMesosContainer creates a Mesos style container to be configured and built for use by an Aurora Job. func NewMesosContainer() MesosContainer { return MesosContainer{container: aurora.NewMesosContainer()} } +// Build creates a Mesos style Aurora container configuration to be passed on to the Aurora Job. func (c MesosContainer) Build() *aurora.Container { return &aurora.Container{Mesos: c.container} } +// DockerImage configures the Mesos container to use a specific Docker image when being run. func (c MesosContainer) DockerImage(name, tag string) MesosContainer { if c.container.Image == nil { c.container.Image = aurora.NewImage() @@ -68,11 +80,12 @@ func (c MesosContainer) DockerImage(name, tag string) MesosContainer { return c } -func (c MesosContainer) AppcImage(name, imageId string) MesosContainer { +// AppcImage configures the Mesos container to use an image in the Appc format to run the container. +func (c MesosContainer) AppcImage(name, imageID string) MesosContainer { if c.container.Image == nil { c.container.Image = aurora.NewImage() } - c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageId} + c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageID} return c } diff --git a/docker-compose.yml b/docker-compose.yml index f0f8e3a..9c6169f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: ipv4_address: 192.168.33.2 master: - image: rdelvalle/mesos-master:1.5.1 + image: aurorascheduler/mesos-master:1.7.2 restart: on-failure ports: - "5050:5050" @@ -32,12 +32,13 @@ services: - zk agent-one: - image: rdelvalle/mesos-agent:1.5.1 + image: aurorascheduler/mesos-agent:1.7.2 pid: host restart: on-failure ports: - "5051:5051" environment: + MESOS_ATTRIBUTES: 'zone:west' MESOS_MASTER: zk://192.168.33.2:2181/mesos MESOS_CONTAINERIZERS: docker,mesos MESOS_PORT: 5051 @@ -56,12 +57,13 @@ services: - zk agent-two: - image: rdelvalle/mesos-agent:1.5.1 + image: aurorascheduler/mesos-agent:1.7.2 pid: host restart: on-failure ports: - "5061:5061" environment: + MESOS_ATTRIBUTES: 'zone:east' MESOS_MASTER: zk://192.168.33.2:2181/mesos MESOS_CONTAINERIZERS: docker,mesos MESOS_HOSTNAME: localhost @@ -80,7 +82,7 @@ services: - zk aurora-one: - image: rdelvalle/aurora:0.21.0 + image: aurorascheduler/scheduler:0.23.0 pid: host ports: - "8081:8081" diff --git a/docs/getting-started.md b/docs/getting-started.md index b16ac3f..d45477c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -88,12 +88,6 @@ On Ubuntu, restarting the aurora-scheduler can be achieved by running the follow $ sudo service aurora-scheduler restart ``` -### Using a custom client -Pystachio does not yet support launching tasks using custom executors. Therefore, a custom -client must be used in order to launch tasks using a custom executor. In this case, -we will be using [gorealis](https://github.com/paypal/gorealis) to launch a task with -the compose executor on Aurora. - ## Using [dce-go](https://github.com/paypal/dce-go) Instead of manually configuring Aurora to run the docker-compose executor, one can follow the instructions provided [here](https://github.com/paypal/dce-go/blob/develop/docs/environment.md) to quickly create a DCE environment that would include mesos, aurora, golang1.7, docker, docker-compose and DCE installed. @@ -107,80 +101,12 @@ Mesos endpoint --> http://192.168.33.8:5050 ### Installing Go -#### Linux +Follow the instructions at the official golang website: [golang.org/doc/install](https://golang.org/doc/install) -##### Ubuntu +### Installing docker-compose -###### Adding a PPA and install via apt-get -``` -$ sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable -$ sudo apt-get update -$ sudo apt-get install golang -``` - -###### Configuring the GOPATH - -Configure the environment to be able to compile and run Go code. -``` -$ mkdir $HOME/go -$ echo export GOPATH=$HOME/go >> $HOME/.bashrc -$ echo export GOROOT=/usr/lib/go >> $HOME/.bashrc -$ echo export PATH=$PATH:$GOPATH/bin >> $HOME/.bashrc -$ echo export PATH=$PATH:$GOROOT/bin >> $HOME/.bashrc -``` - -Finally we must reload the .bashrc configuration: -``` -$ source $HOME/.bashrc -``` - -#### OS X - -One way to install go on OS X is by using [Homebrew](http://brew.sh/) - -##### Installing Homebrew -Run the following command from the terminal to install Hombrew: -``` -$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -##### Installing Go using Hombrew - -Run the following command from the terminal to install Go: -``` -$ brew install go -``` - -##### Configuring the GOPATH - -Configure the environment to be able to compile and run Go code. -``` -$ mkdir $HOME/go -$ echo export GOPATH=$HOME/go >> $HOME/.profile -$ echo export GOROOT=/usr/local/opt/go/libexec >> $HOME/.profile -$ echo export PATH=$PATH:$GOPATH/bin >> $HOME/.profile -$ echo export PATH=$PATH:$GOROOT/bin >> $HOME/.profile -``` - -Finally we must reload the .profile configuration: -``` -$ source $HOME/.profile -``` - -#### Windows - -Download and run the msi installer from https://golang.org/dl/ - -## Installing Docker Compose (if manually configured Aurora) -To show Aurora's new multi executor feature, we need to use at least one custom executor. -In this case we will be using the [docker-compose-executor](https://github.com/mesos/docker-compose-executor). - -In order to run the docker-compose executor, each agent must have docker-compose installed on it. - -This can be done using pip: -``` -$ sudo pip install docker-compose -``` +Agents which will run dce-go will need docker-compose in order to sucessfully run the executor. +Instructions for installing docker-compose on various platforms may be found on Docker's webiste: [docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) ## Downloading gorealis Finally, we must get `gorealis` using the `go get` command: @@ -192,7 +118,7 @@ go get github.com/paypal/gorealis # Creating Aurora Jobs ## Creating a thermos job -To demonstrate that we are able to run jobs using different executors on the +To demonstrate that we are able to run jobs using different executors on the same scheduler, we'll first launch a thermos job using the default Aurora Client. We can use a sample job for this: @@ -259,8 +185,8 @@ go run $GOPATH/src/github.com/paypal/gorealis/examples/client.go -executor=compo ``` If everything went according to plan, a new job will be shown in the Aurora UI. -We can further investigate inside the Mesos task sandbox. Inside the sandbox, under -the sample-app folder, we can find a docker-compose.yml-generated.yml. If we inspect this file, +We can further investigate inside the Mesos task sandbox. Inside the sandbox, under +the sample-app folder, we can find a docker-compose.yml-generated.yml. If we inspect this file, we can find the port at which we can find the web server we launched. Under Web->Ports, we find the port Mesos allocated. We can then navigate to: @@ -269,10 +195,10 @@ Under Web->Ports, we find the port Mesos allocated. We can then navigate to: A message from the executor should greet us. ## Creating a Thermos job using gorealis -It is also possible to create a thermos job using gorealis. To do this, however, +It is also possible to create a thermos job using gorealis. To do this, however, a thermos payload is required. A thermos payload consists of a JSON blob that details the entire task as it exists inside the Aurora Scheduler. *Creating the blob is unfortunately -out of the scope of what gorealis does*, so a thermos payload must be generated beforehand or +out of the scope of what gorealis does*, so a thermos payload must be generated beforehand or retrieved from the structdump of an existing task for testing purposes. A sample thermos JSON payload may be found [here](../examples/thermos_payload.json) in the examples folder. diff --git a/docs/leveraging-the-library.md b/docs/leveraging-the-library.md index 464bddd..e13ca2c 100644 --- a/docs/leveraging-the-library.md +++ b/docs/leveraging-the-library.md @@ -57,4 +57,19 @@ updateJob := realis.NewUpdateJob(job) updateJob.InstanceCount(1) updateJob.Ram(128) msg, err := r.UpdateJob(updateJob, "") -``` \ No newline at end of file +``` + + +* Handling a timeout scenario: + +When sending an API call to Aurora, the call may timeout at the client side. +This means that the time limit has been reached while waiting for the scheduler +to reply. In such a case it is recommended that the timeout is increased through +the use of the `realis.TimeoutMS()` option. + +As these timeouts cannot be totally avoided, there exists a mechanism to mitigate such +scenarios. The `StartJobUpdate` and `CreateService` API will return an error that +implements the Timeout interface. + +An error can be checked to see if it is a Timeout error by using the `realis.IsTimeout()` +function. \ No newline at end of file diff --git a/docs/using-the-sample-client.md b/docs/using-the-sample-client.md index f2de6d9..7e20455 100644 --- a/docs/using-the-sample-client.md +++ b/docs/using-the-sample-client.md @@ -1,6 +1,6 @@ # Using the Sample client -## Usage: +## Usage: ``` Usage of ./client: -cluster string diff --git a/errors.go b/errors.go index 7411a5e..d865aea 100644 --- a/errors.go +++ b/errors.go @@ -23,6 +23,8 @@ type timeout interface { Timedout() bool } +// IsTimeout returns true if the error being passed as an argument implements the Timeout interface +// and the Timedout function returns true. func IsTimeout(err error) bool { temp, ok := err.(timeout) return ok && temp.Timedout() @@ -61,41 +63,42 @@ func (r *retryErr) RetryCount() int { return r.retryCount } -// Helper function for testing verification to avoid whitebox testing +// ToRetryCount is a helper function for testing verification to avoid whitebox testing // as well as keeping retryErr as a private. // Should NOT be used under any other context. func ToRetryCount(err error) *retryErr { if retryErr, ok := err.(*retryErr); ok { return retryErr - } else { - return nil } + return nil } func newRetryError(err error, retryCount int) *retryErr { return &retryErr{error: err, timedout: true, retryCount: retryCount} } -// Temporary errors indicate that the action may and should be retried. +// Temporary errors indicate that the action may or should be retried. type temporary interface { Temporary() bool } +// IsTemporary indicates whether the error passed in as an argument implements the temporary interface +// and if the Temporary function returns true. func IsTemporary(err error) bool { temp, ok := err.(temporary) return ok && temp.Temporary() } -type TemporaryErr struct { +type temporaryErr struct { error temporary bool } -func (t *TemporaryErr) Temporary() bool { +func (t *temporaryErr) Temporary() bool { return t.temporary } -// Retrying after receiving this error is advised -func NewTemporaryError(err error) *TemporaryErr { - return &TemporaryErr{error: err, temporary: true} +// NewTemporaryError creates a new error which satisfies the Temporary interface. +func NewTemporaryError(err error) *temporaryErr { + return &temporaryErr{error: err, temporary: true} } diff --git a/examples/client.go b/examples/client.go index 7425542..69e3751 100644 --- a/examples/client.go +++ b/examples/client.go @@ -31,7 +31,7 @@ var cmd, executor, url, clustersConfig, clusterName, updateId, username, passwor var caCertsPath string var clientKey, clientCert string -var CONNECTION_TIMEOUT = 20000 +var ConnectionTimeout = 20000 func init() { flag.StringVar(&cmd, "cmd", "", "Job request type to send to Aurora Scheduler") @@ -82,7 +82,7 @@ func main() { clientOptions := []realis.ClientOption{ realis.BasicAuth(username, password), realis.ThriftJSON(), - realis.TimeoutMS(CONNECTION_TIMEOUT), + realis.TimeoutMS(ConnectionTimeout), realis.BackOff(realis.Backoff{ Steps: 2, Duration: 10 * time.Second, @@ -92,7 +92,6 @@ func main() { realis.Debug(), } - //check if zkUrl is available. if zkUrl != "" { fmt.Println("zkUrl: ", zkUrl) clientOptions = append(clientOptions, realis.ZKUrl(zkUrl)) @@ -112,7 +111,7 @@ func main() { if err != nil { log.Fatalln(err) } - monitor = &realis.Monitor{r} + monitor = &realis.Monitor{Client: r} defer r.Close() switch executor { diff --git a/gen-go/apache/aurora/GoUnusedProtection__.go b/gen-go/apache/aurora/GoUnusedProtection__.go index 6ba25e0..462b3b4 100644 --- a/gen-go/apache/aurora/GoUnusedProtection__.go +++ b/gen-go/apache/aurora/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora diff --git a/gen-go/apache/aurora/auroraAPI-consts.go b/gen-go/apache/aurora/auroraAPI-consts.go index 6e79077..d4a319e 100644 --- a/gen-go/apache/aurora/auroraAPI-consts.go +++ b/gen-go/apache/aurora/auroraAPI-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora -import ( +import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import ( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal const AURORA_EXECUTOR_NAME = "AuroraExecutor" diff --git a/gen-go/apache/aurora/auroraAPI.go b/gen-go/apache/aurora/auroraAPI.go index 36cde22..914d268 100644 --- a/gen-go/apache/aurora/auroraAPI.go +++ b/gen-go/apache/aurora/auroraAPI.go @@ -1,15 +1,14 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package aurora -import ( +import( "bytes" "context" - "reflect" "database/sql/driver" "errors" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -17,7 +16,7 @@ import ( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal type ResponseCode int64 @@ -567,14 +566,14 @@ func NewIdentity() *Identity { func (p *Identity) GetUser() string { return p.User } -func (p *Identity) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Identity) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -582,31 +581,31 @@ func (p *Identity) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Identity) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Identity) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.User = v @@ -614,29 +613,39 @@ func (p *Identity) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Identity) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Identity"); err != nil { +func (p *Identity) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Identity"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Identity) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 2); err != nil { +func (p *Identity) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:user: ", p), err) } return err } +func (p *Identity) Equals(other *Identity) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.User != other.User { return false } + return true +} + func (p *Identity) String() string { if p == nil { return "" @@ -666,14 +675,14 @@ func (p *Attribute) GetName() string { func (p *Attribute) GetValues() []string { return p.Values } -func (p *Attribute) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Attribute) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -681,41 +690,41 @@ func (p *Attribute) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Attribute) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Attribute) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -723,8 +732,8 @@ func (p *Attribute) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Attribute) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *Attribute) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } @@ -732,68 +741,86 @@ func (p *Attribute) ReadField2(iprot thrift.TProtocol) error { p.Values = tSet for i := 0; i < size; i ++ { var _elem0 string - if v, err := iprot.ReadString(); err != nil { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { _elem0 = v } p.Values = append(p.Values, _elem0) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *Attribute) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Attribute"); err != nil { +func (p *Attribute) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Attribute"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Attribute) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *Attribute) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *Attribute) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("values", thrift.SET, 2); err != nil { +func (p *Attribute) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:values: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Values)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Values)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -849,14 +876,14 @@ func (p *HostAttributes) IsSetSlaveId() bool { return p.SlaveId != nil } -func (p *HostAttributes) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostAttributes) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -864,61 +891,61 @@ func (p *HostAttributes) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostAttributes) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostAttributes) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -926,28 +953,28 @@ func (p *HostAttributes) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *HostAttributes) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Attribute, 0, size) p.Attributes = tSet for i := 0; i < size; i ++ { - _elem1 := &Attribute{} - if err := _elem1.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) + _elem2 := &Attribute{} + if err := _elem2.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) } - p.Attributes = append(p.Attributes, _elem1) + p.Attributes = append(p.Attributes, _elem2) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *HostAttributes) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *HostAttributes) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := MaintenanceMode(v) @@ -956,8 +983,8 @@ func (p *HostAttributes) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostAttributes) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.SlaveId = &v @@ -965,82 +992,112 @@ func (p *HostAttributes) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *HostAttributes) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostAttributes"); err != nil { +func (p *HostAttributes) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostAttributes"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostAttributes) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostAttributes) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostAttributes) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("attributes", thrift.SET, 2); err != nil { +func (p *HostAttributes) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "attributes", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:attributes: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Attributes)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Attributes)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -1071,14 +1128,14 @@ func (p *ValueConstraint) GetNegated() bool { func (p *ValueConstraint) GetValues() []string { return p.Values } -func (p *ValueConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ValueConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1086,41 +1143,41 @@ func (p *ValueConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ValueConstraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *ValueConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Negated = v @@ -1128,77 +1185,95 @@ func (p *ValueConstraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ValueConstraint) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ValueConstraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.Values = tSet for i := 0; i < size; i ++ { -var _elem2 string - if v, err := iprot.ReadString(); err != nil { +var _elem4 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem2 = v + _elem4 = v } - p.Values = append(p.Values, _elem2) + p.Values = append(p.Values, _elem4) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ValueConstraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ValueConstraint"); err != nil { +func (p *ValueConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ValueConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ValueConstraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("negated", thrift.BOOL, 1); err != nil { +func (p *ValueConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "negated", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:negated: ", p), err) } - if err := oprot.WriteBool(bool(p.Negated)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Negated)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.negated (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:negated: ", p), err) } return err } -func (p *ValueConstraint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("values", thrift.SET, 2); err != nil { +func (p *ValueConstraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "values", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:values: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Values)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Values)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -1223,14 +1298,14 @@ func NewLimitConstraint() *LimitConstraint { func (p *LimitConstraint) GetLimit() int32 { return p.Limit } -func (p *LimitConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *LimitConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1238,31 +1313,31 @@ func (p *LimitConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *LimitConstraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *LimitConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Limit = v @@ -1270,29 +1345,39 @@ func (p *LimitConstraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *LimitConstraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("LimitConstraint"); err != nil { +func (p *LimitConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "LimitConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *LimitConstraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 1); err != nil { +func (p *LimitConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "limit", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:limit: ", p), err) } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Limit)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.limit (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:limit: ", p), err) } return err } +func (p *LimitConstraint) Equals(other *LimitConstraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Limit != other.Limit { return false } + return true +} + func (p *LimitConstraint) String() string { if p == nil { return "" @@ -1348,14 +1433,14 @@ func (p *TaskConstraint) IsSetLimit() bool { return p.Limit != nil } -func (p *TaskConstraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskConstraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1363,98 +1448,109 @@ func (p *TaskConstraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskConstraint) ReadField1(iprot thrift.TProtocol) error { +func (p *TaskConstraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Value = &ValueConstraint{} - if err := p.Value.Read(iprot); err != nil { + if err := p.Value.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Value), err) } return nil } -func (p *TaskConstraint) ReadField2(iprot thrift.TProtocol) error { +func (p *TaskConstraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Limit = &LimitConstraint{} - if err := p.Limit.Read(iprot); err != nil { + if err := p.Limit.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Limit), err) } return nil } -func (p *TaskConstraint) Write(oprot thrift.TProtocol) error { +func (p *TaskConstraint) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsTaskConstraint(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("TaskConstraint"); err != nil { + if err := oprot.WriteStructBegin(ctx, "TaskConstraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskConstraint) writeField1(oprot thrift.TProtocol) (err error) { +func (p *TaskConstraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetValue() { - if err := oprot.WriteFieldBegin("value", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) } - if err := p.Value.Write(oprot); err != nil { + if err := p.Value.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Value), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) } } return err } -func (p *TaskConstraint) writeField2(oprot thrift.TProtocol) (err error) { +func (p *TaskConstraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetLimit() { - if err := oprot.WriteFieldBegin("limit", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "limit", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:limit: ", p), err) } - if err := p.Limit.Write(oprot); err != nil { + if err := p.Limit.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Limit), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:limit: ", p), err) } } return err } +func (p *TaskConstraint) Equals(other *TaskConstraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Value.Equals(other.Value) { return false } + if !p.Limit.Equals(other.Limit) { return false } + return true +} + func (p *TaskConstraint) String() string { if p == nil { return "" @@ -1491,14 +1587,14 @@ func (p *Constraint) IsSetConstraint() bool { return p.Constraint != nil } -func (p *Constraint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Constraint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1506,41 +1602,41 @@ func (p *Constraint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Constraint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Constraint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -1548,49 +1644,60 @@ func (p *Constraint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Constraint) ReadField2(iprot thrift.TProtocol) error { +func (p *Constraint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Constraint = &TaskConstraint{} - if err := p.Constraint.Read(iprot); err != nil { + if err := p.Constraint.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Constraint), err) } return nil } -func (p *Constraint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Constraint"); err != nil { +func (p *Constraint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Constraint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Constraint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *Constraint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *Constraint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("constraint", thrift.STRUCT, 2); err != nil { +func (p *Constraint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "constraint", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:constraint: ", p), err) } - if err := p.Constraint.Write(oprot); err != nil { + if err := p.Constraint.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Constraint), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:constraint: ", p), err) } return err } +func (p *Constraint) Equals(other *Constraint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if !p.Constraint.Equals(other.Constraint) { return false } + return true +} + func (p *Constraint) String() string { if p == nil { return "" @@ -1624,14 +1731,14 @@ func (p *Package) GetName() string { func (p *Package) GetVersion() int32 { return p.Version } -func (p *Package) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Package) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1639,51 +1746,51 @@ func (p *Package) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Package) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Package) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -1691,8 +1798,8 @@ func (p *Package) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Package) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Package) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Name = v @@ -1700,8 +1807,8 @@ func (p *Package) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Package) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Package) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Version = v @@ -1709,51 +1816,63 @@ func (p *Package) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Package) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Package"); err != nil { +func (p *Package) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Package"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Package) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *Package) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *Package) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 2); err != nil { +func (p *Package) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:name: ", p), err) } return err } -func (p *Package) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("version", thrift.I32, 3); err != nil { +func (p *Package) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "version", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:version: ", p), err) } - if err := oprot.WriteI32(int32(p.Version)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Version)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.version (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:version: ", p), err) } return err } +func (p *Package) Equals(other *Package) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.Name != other.Name { return false } + if p.Version != other.Version { return false } + return true +} + func (p *Package) String() string { if p == nil { return "" @@ -1783,14 +1902,14 @@ func (p *Metadata) GetKey() string { func (p *Metadata) GetValue() string { return p.Value } -func (p *Metadata) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Metadata) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1798,41 +1917,41 @@ func (p *Metadata) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Metadata) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Metadata) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Key = v @@ -1840,8 +1959,8 @@ func (p *Metadata) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Metadata) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Metadata) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -1849,40 +1968,51 @@ func (p *Metadata) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Metadata) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Metadata"); err != nil { +func (p *Metadata) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Metadata"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Metadata) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { +func (p *Metadata) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := oprot.WriteString(string(p.Key)); err != nil { + if err := oprot.WriteString(ctx, string(p.Key)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *Metadata) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *Metadata) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } +func (p *Metadata) Equals(other *Metadata) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Key != other.Key { return false } + if p.Value != other.Value { return false } + return true +} + func (p *Metadata) String() string { if p == nil { return "" @@ -1918,14 +2048,14 @@ func (p *JobKey) GetEnvironment() string { func (p *JobKey) GetName() string { return p.Name } -func (p *JobKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1933,51 +2063,51 @@ func (p *JobKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobKey) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -1985,8 +2115,8 @@ func (p *JobKey) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Environment = v @@ -1994,8 +2124,8 @@ func (p *JobKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobKey) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Name = v @@ -2003,51 +2133,63 @@ func (p *JobKey) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobKey"); err != nil { +func (p *JobKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *JobKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *JobKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("environment", thrift.STRING, 2); err != nil { +func (p *JobKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "environment", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:environment: ", p), err) } - if err := oprot.WriteString(string(p.Environment)); err != nil { + if err := oprot.WriteString(ctx, string(p.Environment)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.environment (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:environment: ", p), err) } return err } -func (p *JobKey) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 3); err != nil { +func (p *JobKey) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) } return err } +func (p *JobKey) Equals(other *JobKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.Environment != other.Environment { return false } + if p.Name != other.Name { return false } + return true +} + func (p *JobKey) String() string { if p == nil { return "" @@ -2087,14 +2229,14 @@ func (p *LockKey) IsSetJob() bool { return p.Job != nil } -func (p *LockKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *LockKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2102,66 +2244,76 @@ func (p *LockKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *LockKey) ReadField1(iprot thrift.TProtocol) error { +func (p *LockKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *LockKey) Write(oprot thrift.TProtocol) error { +func (p *LockKey) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsLockKey(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("LockKey"); err != nil { + if err := oprot.WriteStructBegin(ctx, "LockKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *LockKey) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LockKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJob() { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } } return err } +func (p *LockKey) Equals(other *LockKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + return true +} + func (p *LockKey) String() string { if p == nil { return "" @@ -2223,14 +2375,14 @@ func (p *Lock) IsSetMessage() bool { return p.Message != nil } -func (p *Lock) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Lock) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2238,79 +2390,79 @@ func (p *Lock) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRING { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Lock) ReadField1(iprot thrift.TProtocol) error { +func (p *Lock) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &LockKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *Lock) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Token = v @@ -2318,8 +2470,8 @@ func (p *Lock) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = v @@ -2327,8 +2479,8 @@ func (p *Lock) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Lock) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.TimestampMs = v @@ -2336,8 +2488,8 @@ func (p *Lock) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Lock) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Lock) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.Message = &v @@ -2345,76 +2497,95 @@ func (p *Lock) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Lock) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Lock"); err != nil { +func (p *Lock) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Lock"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Lock) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *Lock) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *Lock) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("token", thrift.STRING, 2); err != nil { +func (p *Lock) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "token", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:token: ", p), err) } - if err := oprot.WriteString(string(p.Token)); err != nil { + if err := oprot.WriteString(ctx, string(p.Token)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.token (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:token: ", p), err) } return err } -func (p *Lock) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { +func (p *Lock) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } return err } -func (p *Lock) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 4); err != nil { +func (p *Lock) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:timestampMs: ", p), err) } return err } -func (p *Lock) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Lock) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:message: ", p), err) } } return err } +func (p *Lock) Equals(other *Lock) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Key.Equals(other.Key) { return false } + if p.Token != other.Token { return false } + if p.User != other.User { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *Lock) String() string { if p == nil { return "" @@ -2451,14 +2622,14 @@ func (p *InstanceKey) IsSetJobKey() bool { return p.JobKey != nil } -func (p *InstanceKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *InstanceKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2466,49 +2637,49 @@ func (p *InstanceKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *InstanceKey) ReadField1(iprot thrift.TProtocol) error { +func (p *InstanceKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.JobKey = &JobKey{} - if err := p.JobKey.Read(iprot); err != nil { + if err := p.JobKey.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobKey), err) } return nil } -func (p *InstanceKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *InstanceKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.InstanceId = v @@ -2516,41 +2687,52 @@ func (p *InstanceKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *InstanceKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InstanceKey"); err != nil { +func (p *InstanceKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "InstanceKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *InstanceKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobKey", thrift.STRUCT, 1); err != nil { +func (p *InstanceKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobKey", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobKey: ", p), err) } - if err := p.JobKey.Write(oprot); err != nil { + if err := p.JobKey.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobKey: ", p), err) } return err } -func (p *InstanceKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 2); err != nil { +func (p *InstanceKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceId: ", p), err) } return err } +func (p *InstanceKey) Equals(other *InstanceKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.JobKey.Equals(other.JobKey) { return false } + if p.InstanceId != other.InstanceId { return false } + return true +} + func (p *InstanceKey) String() string { if p == nil { return "" @@ -2600,14 +2782,14 @@ func (p *MesosFetcherURI) IsSetCache() bool { return p.Cache != nil } -func (p *MesosFetcherURI) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MesosFetcherURI) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2615,51 +2797,51 @@ func (p *MesosFetcherURI) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.BOOL { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.BOOL { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MesosFetcherURI) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *MesosFetcherURI) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Value = v @@ -2667,8 +2849,8 @@ func (p *MesosFetcherURI) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *MesosFetcherURI) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Extract = &v @@ -2676,8 +2858,8 @@ func (p *MesosFetcherURI) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *MesosFetcherURI) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Cache = &v @@ -2685,55 +2867,77 @@ func (p *MesosFetcherURI) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *MesosFetcherURI) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MesosFetcherURI"); err != nil { +func (p *MesosFetcherURI) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MesosFetcherURI"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MesosFetcherURI) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 1); err != nil { +func (p *MesosFetcherURI) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:value: ", p), err) } return err } -func (p *MesosFetcherURI) writeField2(oprot thrift.TProtocol) (err error) { +func (p *MesosFetcherURI) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetExtract() { - if err := oprot.WriteFieldBegin("extract", thrift.BOOL, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "extract", thrift.BOOL, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:extract: ", p), err) } - if err := oprot.WriteBool(bool(*p.Extract)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Extract)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.extract (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:extract: ", p), err) } } return err } -func (p *MesosFetcherURI) writeField3(oprot thrift.TProtocol) (err error) { +func (p *MesosFetcherURI) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCache() { - if err := oprot.WriteFieldBegin("cache", thrift.BOOL, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "cache", thrift.BOOL, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:cache: ", p), err) } - if err := oprot.WriteBool(bool(*p.Cache)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Cache)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cache (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cache: ", p), err) } } return err } +func (p *MesosFetcherURI) Equals(other *MesosFetcherURI) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Value != other.Value { return false } + if p.Extract != other.Extract { + if p.Extract == nil || other.Extract == nil { + return false + } + if (*p.Extract) != (*other.Extract) { return false } + } + if p.Cache != other.Cache { + if p.Cache == nil || other.Cache == nil { + return false + } + if (*p.Cache) != (*other.Cache) { return false } + } + return true +} + func (p *MesosFetcherURI) String() string { if p == nil { return "" @@ -2761,14 +2965,14 @@ func (p *ExecutorConfig) GetName() string { func (p *ExecutorConfig) GetData() string { return p.Data } -func (p *ExecutorConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ExecutorConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2776,41 +2980,41 @@ func (p *ExecutorConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ExecutorConfig) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ExecutorConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -2818,8 +3022,8 @@ func (p *ExecutorConfig) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ExecutorConfig) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ExecutorConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Data = v @@ -2827,40 +3031,51 @@ func (p *ExecutorConfig) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *ExecutorConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExecutorConfig"); err != nil { +func (p *ExecutorConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ExecutorConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ExecutorConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *ExecutorConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *ExecutorConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("data", thrift.STRING, 2); err != nil { +func (p *ExecutorConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "data", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:data: ", p), err) } - if err := oprot.WriteString(string(p.Data)); err != nil { + if err := oprot.WriteString(ctx, string(p.Data)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.data (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:data: ", p), err) } return err } +func (p *ExecutorConfig) Equals(other *ExecutorConfig) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Data != other.Data { return false } + return true +} + func (p *ExecutorConfig) String() string { if p == nil { return "" @@ -2896,14 +3111,14 @@ func (p *Volume) GetHostPath() string { func (p *Volume) GetMode() Mode { return p.Mode } -func (p *Volume) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Volume) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2911,51 +3126,51 @@ func (p *Volume) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Volume) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Volume) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ContainerPath = v @@ -2963,8 +3178,8 @@ func (p *Volume) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Volume) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Volume) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.HostPath = v @@ -2972,8 +3187,8 @@ func (p *Volume) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Volume) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Volume) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := Mode(v) @@ -2982,51 +3197,63 @@ func (p *Volume) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Volume) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Volume"); err != nil { +func (p *Volume) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Volume"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Volume) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("containerPath", thrift.STRING, 1); err != nil { +func (p *Volume) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "containerPath", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:containerPath: ", p), err) } - if err := oprot.WriteString(string(p.ContainerPath)); err != nil { + if err := oprot.WriteString(ctx, string(p.ContainerPath)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.containerPath (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:containerPath: ", p), err) } return err } -func (p *Volume) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hostPath", thrift.STRING, 2); err != nil { +func (p *Volume) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hostPath", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hostPath: ", p), err) } - if err := oprot.WriteString(string(p.HostPath)); err != nil { + if err := oprot.WriteString(ctx, string(p.HostPath)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.hostPath (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hostPath: ", p), err) } return err } -func (p *Volume) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("mode", thrift.I32, 3); err != nil { +func (p *Volume) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "mode", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:mode: ", p), err) } - if err := oprot.WriteI32(int32(p.Mode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Mode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.mode (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:mode: ", p), err) } return err } +func (p *Volume) Equals(other *Volume) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ContainerPath != other.ContainerPath { return false } + if p.HostPath != other.HostPath { return false } + if p.Mode != other.Mode { return false } + return true +} + func (p *Volume) String() string { if p == nil { return "" @@ -3056,14 +3283,14 @@ func (p *DockerImage) GetName() string { func (p *DockerImage) GetTag() string { return p.Tag } -func (p *DockerImage) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerImage) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3071,41 +3298,41 @@ func (p *DockerImage) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerImage) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerImage) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3113,8 +3340,8 @@ func (p *DockerImage) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerImage) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerImage) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Tag = v @@ -3122,40 +3349,51 @@ func (p *DockerImage) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *DockerImage) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerImage"); err != nil { +func (p *DockerImage) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerImage"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerImage) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *DockerImage) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *DockerImage) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tag", thrift.STRING, 2); err != nil { +func (p *DockerImage) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tag", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tag: ", p), err) } - if err := oprot.WriteString(string(p.Tag)); err != nil { + if err := oprot.WriteString(ctx, string(p.Tag)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.tag (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tag: ", p), err) } return err } +func (p *DockerImage) Equals(other *DockerImage) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Tag != other.Tag { return false } + return true +} + func (p *DockerImage) String() string { if p == nil { return "" @@ -3185,14 +3423,14 @@ func (p *AppcImage) GetName() string { func (p *AppcImage) GetImageId() string { return p.ImageId } -func (p *AppcImage) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AppcImage) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3200,41 +3438,41 @@ func (p *AppcImage) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AppcImage) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AppcImage) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3242,8 +3480,8 @@ func (p *AppcImage) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AppcImage) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AppcImage) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.ImageId = v @@ -3251,40 +3489,51 @@ func (p *AppcImage) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *AppcImage) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("AppcImage"); err != nil { +func (p *AppcImage) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "AppcImage"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AppcImage) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *AppcImage) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *AppcImage) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("imageId", thrift.STRING, 2); err != nil { +func (p *AppcImage) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "imageId", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:imageId: ", p), err) } - if err := oprot.WriteString(string(p.ImageId)); err != nil { + if err := oprot.WriteString(ctx, string(p.ImageId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.imageId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:imageId: ", p), err) } return err } +func (p *AppcImage) Equals(other *AppcImage) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.ImageId != other.ImageId { return false } + return true +} + func (p *AppcImage) String() string { if p == nil { return "" @@ -3340,14 +3589,14 @@ func (p *Image) IsSetAppc() bool { return p.Appc != nil } -func (p *Image) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Image) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3355,98 +3604,109 @@ func (p *Image) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Image) ReadField1(iprot thrift.TProtocol) error { +func (p *Image) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Docker = &DockerImage{} - if err := p.Docker.Read(iprot); err != nil { + if err := p.Docker.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Docker), err) } return nil } -func (p *Image) ReadField2(iprot thrift.TProtocol) error { +func (p *Image) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Appc = &AppcImage{} - if err := p.Appc.Read(iprot); err != nil { + if err := p.Appc.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Appc), err) } return nil } -func (p *Image) Write(oprot thrift.TProtocol) error { +func (p *Image) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsImage(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Image"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Image"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Image) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Image) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDocker() { - if err := oprot.WriteFieldBegin("docker", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "docker", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:docker: ", p), err) } - if err := p.Docker.Write(oprot); err != nil { + if err := p.Docker.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:docker: ", p), err) } } return err } -func (p *Image) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Image) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetAppc() { - if err := oprot.WriteFieldBegin("appc", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "appc", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:appc: ", p), err) } - if err := p.Appc.Write(oprot); err != nil { + if err := p.Appc.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Appc), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:appc: ", p), err) } } return err } +func (p *Image) Equals(other *Image) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Docker.Equals(other.Docker) { return false } + if !p.Appc.Equals(other.Appc) { return false } + return true +} + func (p *Image) String() string { if p == nil { return "" @@ -3488,14 +3748,14 @@ func (p *MesosContainer) IsSetVolumes() bool { return p.Volumes != nil } -func (p *MesosContainer) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MesosContainer) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3503,115 +3763,130 @@ func (p *MesosContainer) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MesosContainer) ReadField1(iprot thrift.TProtocol) error { +func (p *MesosContainer) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Image = &Image{} - if err := p.Image.Read(iprot); err != nil { + if err := p.Image.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Image), err) } return nil } -func (p *MesosContainer) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *MesosContainer) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Volume, 0, size) p.Volumes = tSlice for i := 0; i < size; i ++ { - _elem3 := &Volume{} - if err := _elem3.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) + _elem6 := &Volume{} + if err := _elem6.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err) } - p.Volumes = append(p.Volumes, _elem3) + p.Volumes = append(p.Volumes, _elem6) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *MesosContainer) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MesosContainer"); err != nil { +func (p *MesosContainer) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MesosContainer"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MesosContainer) writeField1(oprot thrift.TProtocol) (err error) { +func (p *MesosContainer) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetImage() { - if err := oprot.WriteFieldBegin("image", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "image", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:image: ", p), err) } - if err := p.Image.Write(oprot); err != nil { + if err := p.Image.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Image), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:image: ", p), err) } } return err } -func (p *MesosContainer) writeField2(oprot thrift.TProtocol) (err error) { +func (p *MesosContainer) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVolumes() { - if err := oprot.WriteFieldBegin("volumes", thrift.LIST, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "volumes", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:volumes: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Volumes)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Volumes)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Volumes { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:volumes: ", p), err) } } return err } +func (p *MesosContainer) Equals(other *MesosContainer) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Image.Equals(other.Image) { return false } + if len(p.Volumes) != len(other.Volumes) { return false } + for i, _tgt := range p.Volumes { + _src7 := other.Volumes[i] + if !_tgt.Equals(_src7) { return false } + } + return true +} + func (p *MesosContainer) String() string { if p == nil { return "" @@ -3641,14 +3916,14 @@ func (p *DockerParameter) GetName() string { func (p *DockerParameter) GetValue() string { return p.Value } -func (p *DockerParameter) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerParameter) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3656,41 +3931,41 @@ func (p *DockerParameter) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerParameter) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerParameter) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -3698,8 +3973,8 @@ func (p *DockerParameter) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerParameter) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerParameter) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -3707,40 +3982,51 @@ func (p *DockerParameter) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *DockerParameter) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerParameter"); err != nil { +func (p *DockerParameter) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerParameter"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerParameter) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *DockerParameter) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *DockerParameter) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *DockerParameter) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } +func (p *DockerParameter) Equals(other *DockerParameter) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if p.Value != other.Value { return false } + return true +} + func (p *DockerParameter) String() string { if p == nil { return "" @@ -3775,14 +4061,14 @@ func (p *DockerContainer) IsSetParameters() bool { return p.Parameters != nil } -func (p *DockerContainer) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DockerContainer) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3790,41 +4076,41 @@ func (p *DockerContainer) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DockerContainer) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *DockerContainer) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Image = v @@ -3832,71 +4118,86 @@ func (p *DockerContainer) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *DockerContainer) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *DockerContainer) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*DockerParameter, 0, size) p.Parameters = tSlice for i := 0; i < size; i ++ { - _elem4 := &DockerParameter{} - if err := _elem4.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) + _elem8 := &DockerParameter{} + if err := _elem8.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err) } - p.Parameters = append(p.Parameters, _elem4) + p.Parameters = append(p.Parameters, _elem8) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *DockerContainer) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DockerContainer"); err != nil { +func (p *DockerContainer) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DockerContainer"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DockerContainer) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("image", thrift.STRING, 1); err != nil { +func (p *DockerContainer) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "image", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:image: ", p), err) } - if err := oprot.WriteString(string(p.Image)); err != nil { + if err := oprot.WriteString(ctx, string(p.Image)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.image (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:image: ", p), err) } return err } -func (p *DockerContainer) writeField2(oprot thrift.TProtocol) (err error) { +func (p *DockerContainer) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetParameters() { - if err := oprot.WriteFieldBegin("parameters", thrift.LIST, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "parameters", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:parameters: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Parameters)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Parameters)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Parameters { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parameters: ", p), err) } } return err } +func (p *DockerContainer) Equals(other *DockerContainer) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Image != other.Image { return false } + if len(p.Parameters) != len(other.Parameters) { return false } + for i, _tgt := range p.Parameters { + _src9 := other.Parameters[i] + if !_tgt.Equals(_src9) { return false } + } + return true +} + func (p *DockerContainer) String() string { if p == nil { return "" @@ -3952,14 +4253,14 @@ func (p *Container) IsSetDocker() bool { return p.Docker != nil } -func (p *Container) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Container) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -3967,98 +4268,109 @@ func (p *Container) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Container) ReadField1(iprot thrift.TProtocol) error { +func (p *Container) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Mesos = &MesosContainer{} - if err := p.Mesos.Read(iprot); err != nil { + if err := p.Mesos.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Mesos), err) } return nil } -func (p *Container) ReadField2(iprot thrift.TProtocol) error { +func (p *Container) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Docker = &DockerContainer{} - if err := p.Docker.Read(iprot); err != nil { + if err := p.Docker.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Docker), err) } return nil } -func (p *Container) Write(oprot thrift.TProtocol) error { +func (p *Container) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsContainer(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Container"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Container"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Container) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Container) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMesos() { - if err := oprot.WriteFieldBegin("mesos", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "mesos", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:mesos: ", p), err) } - if err := p.Mesos.Write(oprot); err != nil { + if err := p.Mesos.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Mesos), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:mesos: ", p), err) } } return err } -func (p *Container) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Container) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDocker() { - if err := oprot.WriteFieldBegin("docker", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "docker", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:docker: ", p), err) } - if err := p.Docker.Write(oprot); err != nil { + if err := p.Docker.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:docker: ", p), err) } } return err } +func (p *Container) Equals(other *Container) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Mesos.Equals(other.Mesos) { return false } + if !p.Docker.Equals(other.Docker) { return false } + return true +} + func (p *Container) String() string { if p == nil { return "" @@ -4162,14 +4474,14 @@ func (p *Resource) IsSetNumGpus() bool { return p.NumGpus != nil } -func (p *Resource) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Resource) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4177,71 +4489,71 @@ func (p *Resource) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I64 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Resource) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *Resource) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.NumCpus = &v @@ -4249,8 +4561,8 @@ func (p *Resource) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.RamMb = &v @@ -4258,8 +4570,8 @@ func (p *Resource) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.DiskMb = &v @@ -4267,8 +4579,8 @@ func (p *Resource) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Resource) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.NamedPort = &v @@ -4276,8 +4588,8 @@ func (p *Resource) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Resource) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Resource) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.NumGpus = &v @@ -4285,86 +4597,125 @@ func (p *Resource) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Resource) Write(oprot thrift.TProtocol) error { +func (p *Resource) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsResource(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Resource"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Resource"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Resource) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNumCpus() { - if err := oprot.WriteFieldBegin("numCpus", thrift.DOUBLE, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "numCpus", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:numCpus: ", p), err) } - if err := oprot.WriteDouble(float64(*p.NumCpus)); err != nil { + if err := oprot.WriteDouble(ctx, float64(*p.NumCpus)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.numCpus (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:numCpus: ", p), err) } } return err } -func (p *Resource) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRamMb() { - if err := oprot.WriteFieldBegin("ramMb", thrift.I64, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "ramMb", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:ramMb: ", p), err) } - if err := oprot.WriteI64(int64(*p.RamMb)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.RamMb)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ramMb (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:ramMb: ", p), err) } } return err } -func (p *Resource) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDiskMb() { - if err := oprot.WriteFieldBegin("diskMb", thrift.I64, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "diskMb", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:diskMb: ", p), err) } - if err := oprot.WriteI64(int64(*p.DiskMb)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.DiskMb)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.diskMb (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:diskMb: ", p), err) } } return err } -func (p *Resource) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNamedPort() { - if err := oprot.WriteFieldBegin("namedPort", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "namedPort", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:namedPort: ", p), err) } - if err := oprot.WriteString(string(*p.NamedPort)); err != nil { + if err := oprot.WriteString(ctx, string(*p.NamedPort)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.namedPort (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:namedPort: ", p), err) } } return err } -func (p *Resource) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Resource) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNumGpus() { - if err := oprot.WriteFieldBegin("numGpus", thrift.I64, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "numGpus", thrift.I64, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:numGpus: ", p), err) } - if err := oprot.WriteI64(int64(*p.NumGpus)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.NumGpus)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.numGpus (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:numGpus: ", p), err) } } return err } +func (p *Resource) Equals(other *Resource) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.NumCpus != other.NumCpus { + if p.NumCpus == nil || other.NumCpus == nil { + return false + } + if (*p.NumCpus) != (*other.NumCpus) { return false } + } + if p.RamMb != other.RamMb { + if p.RamMb == nil || other.RamMb == nil { + return false + } + if (*p.RamMb) != (*other.RamMb) { return false } + } + if p.DiskMb != other.DiskMb { + if p.DiskMb == nil || other.DiskMb == nil { + return false + } + if (*p.DiskMb) != (*other.DiskMb) { return false } + } + if p.NamedPort != other.NamedPort { + if p.NamedPort == nil || other.NamedPort == nil { + return false + } + if (*p.NamedPort) != (*other.NamedPort) { return false } + } + if p.NumGpus != other.NumGpus { + if p.NumGpus == nil || other.NumGpus == nil { + return false + } + if (*p.NumGpus) != (*other.NumGpus) { return false } + } + return true +} + func (p *Resource) String() string { if p == nil { return "" @@ -4399,14 +4750,14 @@ func (p *PartitionPolicy) IsSetDelaySecs() bool { return p.DelaySecs != nil } -func (p *PartitionPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PartitionPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4414,41 +4765,41 @@ func (p *PartitionPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PartitionPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *PartitionPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Reschedule = v @@ -4456,8 +4807,8 @@ func (p *PartitionPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PartitionPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *PartitionPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DelaySecs = &v @@ -4465,42 +4816,58 @@ func (p *PartitionPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PartitionPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PartitionPolicy"); err != nil { +func (p *PartitionPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PartitionPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PartitionPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reschedule", thrift.BOOL, 1); err != nil { +func (p *PartitionPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reschedule", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:reschedule: ", p), err) } - if err := oprot.WriteBool(bool(p.Reschedule)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Reschedule)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.reschedule (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:reschedule: ", p), err) } return err } -func (p *PartitionPolicy) writeField2(oprot thrift.TProtocol) (err error) { +func (p *PartitionPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDelaySecs() { - if err := oprot.WriteFieldBegin("delaySecs", thrift.I64, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "delaySecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:delaySecs: ", p), err) } - if err := oprot.WriteI64(int64(*p.DelaySecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.DelaySecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.delaySecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:delaySecs: ", p), err) } } return err } +func (p *PartitionPolicy) Equals(other *PartitionPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Reschedule != other.Reschedule { return false } + if p.DelaySecs != other.DelaySecs { + if p.DelaySecs == nil || other.DelaySecs == nil { + return false + } + if (*p.DelaySecs) != (*other.DelaySecs) { return false } + } + return true +} + func (p *PartitionPolicy) String() string { if p == nil { return "" @@ -4530,14 +4897,14 @@ func (p *PercentageSlaPolicy) GetPercentage() float64 { func (p *PercentageSlaPolicy) GetDurationSecs() int64 { return p.DurationSecs } -func (p *PercentageSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PercentageSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4545,41 +4912,41 @@ func (p *PercentageSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PercentageSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *PercentageSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Percentage = v @@ -4587,8 +4954,8 @@ func (p *PercentageSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PercentageSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *PercentageSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DurationSecs = v @@ -4596,40 +4963,51 @@ func (p *PercentageSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PercentageSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PercentageSlaPolicy"); err != nil { +func (p *PercentageSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PercentageSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PercentageSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("percentage", thrift.DOUBLE, 1); err != nil { +func (p *PercentageSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "percentage", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:percentage: ", p), err) } - if err := oprot.WriteDouble(float64(p.Percentage)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.Percentage)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.percentage (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:percentage: ", p), err) } return err } -func (p *PercentageSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("durationSecs", thrift.I64, 2); err != nil { +func (p *PercentageSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "durationSecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:durationSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.DurationSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.DurationSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.durationSecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:durationSecs: ", p), err) } return err } +func (p *PercentageSlaPolicy) Equals(other *PercentageSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Percentage != other.Percentage { return false } + if p.DurationSecs != other.DurationSecs { return false } + return true +} + func (p *PercentageSlaPolicy) String() string { if p == nil { return "" @@ -4659,14 +5037,14 @@ func (p *CountSlaPolicy) GetCount() int64 { func (p *CountSlaPolicy) GetDurationSecs() int64 { return p.DurationSecs } -func (p *CountSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CountSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4674,41 +5052,41 @@ func (p *CountSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CountSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *CountSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Count = v @@ -4716,8 +5094,8 @@ func (p *CountSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CountSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *CountSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DurationSecs = v @@ -4725,40 +5103,51 @@ func (p *CountSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *CountSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("CountSlaPolicy"); err != nil { +func (p *CountSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "CountSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CountSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("count", thrift.I64, 1); err != nil { +func (p *CountSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "count", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:count: ", p), err) } - if err := oprot.WriteI64(int64(p.Count)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Count)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.count (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:count: ", p), err) } return err } -func (p *CountSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("durationSecs", thrift.I64, 2); err != nil { +func (p *CountSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "durationSecs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:durationSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.DurationSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.DurationSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.durationSecs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:durationSecs: ", p), err) } return err } +func (p *CountSlaPolicy) Equals(other *CountSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Count != other.Count { return false } + if p.DurationSecs != other.DurationSecs { return false } + return true +} + func (p *CountSlaPolicy) String() string { if p == nil { return "" @@ -4788,14 +5177,14 @@ func (p *CoordinatorSlaPolicy) GetCoordinatorUrl() string { func (p *CoordinatorSlaPolicy) GetStatusKey() string { return p.StatusKey } -func (p *CoordinatorSlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CoordinatorSlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4803,41 +5192,41 @@ func (p *CoordinatorSlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CoordinatorSlaPolicy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *CoordinatorSlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.CoordinatorUrl = v @@ -4845,8 +5234,8 @@ func (p *CoordinatorSlaPolicy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CoordinatorSlaPolicy) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *CoordinatorSlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.StatusKey = v @@ -4854,40 +5243,51 @@ func (p *CoordinatorSlaPolicy) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *CoordinatorSlaPolicy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("CoordinatorSlaPolicy"); err != nil { +func (p *CoordinatorSlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "CoordinatorSlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CoordinatorSlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("coordinatorUrl", thrift.STRING, 1); err != nil { +func (p *CoordinatorSlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "coordinatorUrl", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:coordinatorUrl: ", p), err) } - if err := oprot.WriteString(string(p.CoordinatorUrl)); err != nil { + if err := oprot.WriteString(ctx, string(p.CoordinatorUrl)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.coordinatorUrl (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:coordinatorUrl: ", p), err) } return err } -func (p *CoordinatorSlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statusKey", thrift.STRING, 2); err != nil { +func (p *CoordinatorSlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statusKey", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:statusKey: ", p), err) } - if err := oprot.WriteString(string(p.StatusKey)); err != nil { + if err := oprot.WriteString(ctx, string(p.StatusKey)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.statusKey (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:statusKey: ", p), err) } return err } +func (p *CoordinatorSlaPolicy) Equals(other *CoordinatorSlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.CoordinatorUrl != other.CoordinatorUrl { return false } + if p.StatusKey != other.StatusKey { return false } + return true +} + func (p *CoordinatorSlaPolicy) String() string { if p == nil { return "" @@ -4959,14 +5359,14 @@ func (p *SlaPolicy) IsSetCoordinatorSlaPolicy() bool { return p.CoordinatorSlaPolicy != nil } -func (p *SlaPolicy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SlaPolicy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -4974,130 +5374,142 @@ func (p *SlaPolicy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *SlaPolicy) ReadField1(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.PercentageSlaPolicy = &PercentageSlaPolicy{} - if err := p.PercentageSlaPolicy.Read(iprot); err != nil { + if err := p.PercentageSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PercentageSlaPolicy), err) } return nil } -func (p *SlaPolicy) ReadField2(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.CountSlaPolicy = &CountSlaPolicy{} - if err := p.CountSlaPolicy.Read(iprot); err != nil { + if err := p.CountSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CountSlaPolicy), err) } return nil } -func (p *SlaPolicy) ReadField3(iprot thrift.TProtocol) error { +func (p *SlaPolicy) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.CoordinatorSlaPolicy = &CoordinatorSlaPolicy{} - if err := p.CoordinatorSlaPolicy.Read(iprot); err != nil { + if err := p.CoordinatorSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CoordinatorSlaPolicy), err) } return nil } -func (p *SlaPolicy) Write(oprot thrift.TProtocol) error { +func (p *SlaPolicy) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsSlaPolicy(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("SlaPolicy"); err != nil { + if err := oprot.WriteStructBegin(ctx, "SlaPolicy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SlaPolicy) writeField1(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPercentageSlaPolicy() { - if err := oprot.WriteFieldBegin("percentageSlaPolicy", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "percentageSlaPolicy", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:percentageSlaPolicy: ", p), err) } - if err := p.PercentageSlaPolicy.Write(oprot); err != nil { + if err := p.PercentageSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PercentageSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:percentageSlaPolicy: ", p), err) } } return err } -func (p *SlaPolicy) writeField2(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCountSlaPolicy() { - if err := oprot.WriteFieldBegin("countSlaPolicy", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "countSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:countSlaPolicy: ", p), err) } - if err := p.CountSlaPolicy.Write(oprot); err != nil { + if err := p.CountSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CountSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:countSlaPolicy: ", p), err) } } return err } -func (p *SlaPolicy) writeField3(oprot thrift.TProtocol) (err error) { +func (p *SlaPolicy) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCoordinatorSlaPolicy() { - if err := oprot.WriteFieldBegin("coordinatorSlaPolicy", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "coordinatorSlaPolicy", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:coordinatorSlaPolicy: ", p), err) } - if err := p.CoordinatorSlaPolicy.Write(oprot); err != nil { + if err := p.CoordinatorSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CoordinatorSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:coordinatorSlaPolicy: ", p), err) } } return err } +func (p *SlaPolicy) Equals(other *SlaPolicy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.PercentageSlaPolicy.Equals(other.PercentageSlaPolicy) { return false } + if !p.CountSlaPolicy.Equals(other.CountSlaPolicy) { return false } + if !p.CoordinatorSlaPolicy.Equals(other.CoordinatorSlaPolicy) { return false } + return true +} + func (p *SlaPolicy) String() string { if p == nil { return "" @@ -5308,14 +5720,14 @@ func (p *TaskConfig) IsSetContainer() bool { return p.Container != nil } -func (p *TaskConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -5323,207 +5735,207 @@ func (p *TaskConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 28: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField28(iprot); err != nil { + if err := p.ReadField28(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 17: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField17(iprot); err != nil { + if err := p.ReadField17(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.BOOL { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.I32 { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 13: if fieldTypeId == thrift.I32 { - if err := p.ReadField13(iprot); err != nil { + if err := p.ReadField13(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 18: if fieldTypeId == thrift.BOOL { - if err := p.ReadField18(iprot); err != nil { + if err := p.ReadField18(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 30: if fieldTypeId == thrift.STRING { - if err := p.ReadField30(iprot); err != nil { + if err := p.ReadField30(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 32: if fieldTypeId == thrift.SET { - if err := p.ReadField32(iprot); err != nil { + if err := p.ReadField32(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 20: if fieldTypeId == thrift.SET { - if err := p.ReadField20(iprot); err != nil { + if err := p.ReadField20(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 33: if fieldTypeId == thrift.SET { - if err := p.ReadField33(iprot); err != nil { + if err := p.ReadField33(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 22: if fieldTypeId == thrift.MAP { - if err := p.ReadField22(iprot); err != nil { + if err := p.ReadField22(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 23: if fieldTypeId == thrift.STRING { - if err := p.ReadField23(iprot); err != nil { + if err := p.ReadField23(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 25: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField25(iprot); err != nil { + if err := p.ReadField25(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 27: if fieldTypeId == thrift.SET { - if err := p.ReadField27(iprot); err != nil { + if err := p.ReadField27(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 34: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField34(iprot); err != nil { + if err := p.ReadField34(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 35: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField35(iprot); err != nil { + if err := p.ReadField35(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 29: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField29(iprot); err != nil { + if err := p.ReadField29(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskConfig) ReadField28(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField28(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *TaskConfig) ReadField17(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField17(ctx context.Context, iprot thrift.TProtocol) error { p.Owner = &Identity{} - if err := p.Owner.Read(iprot); err != nil { + if err := p.Owner.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Owner), err) } return nil } -func (p *TaskConfig) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *TaskConfig) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.IsService = v @@ -5531,8 +5943,8 @@ func (p *TaskConfig) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField11(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskConfig) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 11: ", err) } else { p.Priority = v @@ -5540,8 +5952,8 @@ func (p *TaskConfig) ReadField11(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField13(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskConfig) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 13: ", err) } else { p.MaxTaskFailures = v @@ -5549,8 +5961,8 @@ func (p *TaskConfig) ReadField13(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField18(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *TaskConfig) ReadField18(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 18: ", err) } else { p.Production = &v @@ -5558,8 +5970,8 @@ func (p *TaskConfig) ReadField18(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField30(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskConfig) ReadField30(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 30: ", err) } else { p.Tier = &v @@ -5567,96 +5979,96 @@ func (p *TaskConfig) ReadField30(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField32(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField32(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Resource, 0, size) p.Resources = tSet for i := 0; i < size; i ++ { - _elem5 := &Resource{} - if err := _elem5.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) + _elem10 := &Resource{} + if err := _elem10.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) } - p.Resources = append(p.Resources, _elem5) + p.Resources = append(p.Resources, _elem10) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField20(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField20(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Constraint, 0, size) p.Constraints = tSet for i := 0; i < size; i ++ { - _elem6 := &Constraint{} - if err := _elem6.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err) + _elem11 := &Constraint{} + if err := _elem11.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) } - p.Constraints = append(p.Constraints, _elem6) + p.Constraints = append(p.Constraints, _elem11) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField33(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField33(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*MesosFetcherURI, 0, size) p.MesosFetcherUris = tSet for i := 0; i < size; i ++ { - _elem7 := &MesosFetcherURI{} - if err := _elem7.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem7), err) + _elem12 := &MesosFetcherURI{} + if err := _elem12.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem12), err) } - p.MesosFetcherUris = append(p.MesosFetcherUris, _elem7) + p.MesosFetcherUris = append(p.MesosFetcherUris, _elem12) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField22(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *TaskConfig) ReadField22(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]string, size) p.TaskLinks = tMap for i := 0; i < size; i ++ { -var _key8 string - if v, err := iprot.ReadString(); err != nil { +var _key13 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key8 = v + _key13 = v } -var _val9 string - if v, err := iprot.ReadString(); err != nil { +var _val14 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val9 = v + _val14 = v } - p.TaskLinks[_key8] = _val9 + p.TaskLinks[_key13] = _val14 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *TaskConfig) ReadField23(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskConfig) ReadField23(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 23: ", err) } else { p.ContactEmail = &v @@ -5664,355 +6076,428 @@ func (p *TaskConfig) ReadField23(iprot thrift.TProtocol) error { return nil } -func (p *TaskConfig) ReadField25(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField25(ctx context.Context, iprot thrift.TProtocol) error { p.ExecutorConfig = &ExecutorConfig{} - if err := p.ExecutorConfig.Read(iprot); err != nil { + if err := p.ExecutorConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ExecutorConfig), err) } return nil } -func (p *TaskConfig) ReadField27(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskConfig) ReadField27(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem10 := &Metadata{} - if err := _elem10.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) + _elem15 := &Metadata{} + if err := _elem15.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem15), err) } - p.Metadata = append(p.Metadata, _elem10) + p.Metadata = append(p.Metadata, _elem15) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskConfig) ReadField34(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField34(ctx context.Context, iprot thrift.TProtocol) error { p.PartitionPolicy = &PartitionPolicy{} - if err := p.PartitionPolicy.Read(iprot); err != nil { + if err := p.PartitionPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PartitionPolicy), err) } return nil } -func (p *TaskConfig) ReadField35(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField35(ctx context.Context, iprot thrift.TProtocol) error { p.SlaPolicy = &SlaPolicy{} - if err := p.SlaPolicy.Read(iprot); err != nil { + if err := p.SlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.SlaPolicy), err) } return nil } -func (p *TaskConfig) ReadField29(iprot thrift.TProtocol) error { +func (p *TaskConfig) ReadField29(ctx context.Context, iprot thrift.TProtocol) error { p.Container = &Container{} - if err := p.Container.Read(iprot); err != nil { + if err := p.Container.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Container), err) } return nil } -func (p *TaskConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskConfig"); err != nil { +func (p *TaskConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField13(oprot); err != nil { return err } - if err := p.writeField17(oprot); err != nil { return err } - if err := p.writeField18(oprot); err != nil { return err } - if err := p.writeField20(oprot); err != nil { return err } - if err := p.writeField22(oprot); err != nil { return err } - if err := p.writeField23(oprot); err != nil { return err } - if err := p.writeField25(oprot); err != nil { return err } - if err := p.writeField27(oprot); err != nil { return err } - if err := p.writeField28(oprot); err != nil { return err } - if err := p.writeField29(oprot); err != nil { return err } - if err := p.writeField30(oprot); err != nil { return err } - if err := p.writeField32(oprot); err != nil { return err } - if err := p.writeField33(oprot); err != nil { return err } - if err := p.writeField34(oprot); err != nil { return err } - if err := p.writeField35(oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } + if err := p.writeField17(ctx, oprot); err != nil { return err } + if err := p.writeField18(ctx, oprot); err != nil { return err } + if err := p.writeField20(ctx, oprot); err != nil { return err } + if err := p.writeField22(ctx, oprot); err != nil { return err } + if err := p.writeField23(ctx, oprot); err != nil { return err } + if err := p.writeField25(ctx, oprot); err != nil { return err } + if err := p.writeField27(ctx, oprot); err != nil { return err } + if err := p.writeField28(ctx, oprot); err != nil { return err } + if err := p.writeField29(ctx, oprot); err != nil { return err } + if err := p.writeField30(ctx, oprot); err != nil { return err } + if err := p.writeField32(ctx, oprot); err != nil { return err } + if err := p.writeField33(ctx, oprot); err != nil { return err } + if err := p.writeField34(ctx, oprot); err != nil { return err } + if err := p.writeField35(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskConfig) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("isService", thrift.BOOL, 7); err != nil { +func (p *TaskConfig) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "isService", thrift.BOOL, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:isService: ", p), err) } - if err := oprot.WriteBool(bool(p.IsService)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.IsService)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.isService (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:isService: ", p), err) } return err } -func (p *TaskConfig) writeField11(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("priority", thrift.I32, 11); err != nil { +func (p *TaskConfig) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "priority", thrift.I32, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:priority: ", p), err) } - if err := oprot.WriteI32(int32(p.Priority)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Priority)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.priority (11) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:priority: ", p), err) } return err } -func (p *TaskConfig) writeField13(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxTaskFailures", thrift.I32, 13); err != nil { +func (p *TaskConfig) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxTaskFailures", thrift.I32, 13); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:maxTaskFailures: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxTaskFailures)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxTaskFailures)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxTaskFailures (13) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 13:maxTaskFailures: ", p), err) } return err } -func (p *TaskConfig) writeField17(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("owner", thrift.STRUCT, 17); err != nil { +func (p *TaskConfig) writeField17(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "owner", thrift.STRUCT, 17); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:owner: ", p), err) } - if err := p.Owner.Write(oprot); err != nil { + if err := p.Owner.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 17:owner: ", p), err) } return err } -func (p *TaskConfig) writeField18(oprot thrift.TProtocol) (err error) { +func (p *TaskConfig) writeField18(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProduction() { - if err := oprot.WriteFieldBegin("production", thrift.BOOL, 18); err != nil { + if err := oprot.WriteFieldBegin(ctx, "production", thrift.BOOL, 18); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 18:production: ", p), err) } - if err := oprot.WriteBool(bool(*p.Production)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.Production)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.production (18) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 18:production: ", p), err) } } return err } -func (p *TaskConfig) writeField20(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("constraints", thrift.SET, 20); err != nil { +func (p *TaskConfig) writeField20(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "constraints", thrift.SET, 20); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 20:constraints: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Constraints)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Constraints)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -6035,14 +6520,14 @@ func NewResourceAggregate() *ResourceAggregate { func (p *ResourceAggregate) GetResources() []*Resource { return p.Resources } -func (p *ResourceAggregate) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ResourceAggregate) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6050,88 +6535,105 @@ func (p *ResourceAggregate) Read(iprot thrift.TProtocol) error { switch fieldId { case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ResourceAggregate) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ResourceAggregate) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Resource, 0, size) p.Resources = tSet for i := 0; i < size; i ++ { - _elem11 := &Resource{} - if err := _elem11.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) + _elem21 := &Resource{} + if err := _elem21.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem21), err) } - p.Resources = append(p.Resources, _elem11) + p.Resources = append(p.Resources, _elem21) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ResourceAggregate) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ResourceAggregate"); err != nil { +func (p *ResourceAggregate) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ResourceAggregate"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ResourceAggregate) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("resources", thrift.SET, 4); err != nil { +func (p *ResourceAggregate) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "resources", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:resources: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Resources)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Resources)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -6216,14 +6718,14 @@ func (p *JobConfiguration) IsSetTaskConfig() bool { return p.TaskConfig != nil } -func (p *JobConfiguration) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobConfiguration) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6231,97 +6733,97 @@ func (p *JobConfiguration) Read(iprot thrift.TProtocol) error { switch fieldId { case 9: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I32 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.I32 { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobConfiguration) ReadField9(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobConfiguration) ReadField7(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { p.Owner = &Identity{} - if err := p.Owner.Read(iprot); err != nil { + if err := p.Owner.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Owner), err) } return nil } -func (p *JobConfiguration) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobConfiguration) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.CronSchedule = &v @@ -6329,8 +6831,8 @@ func (p *JobConfiguration) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobConfiguration) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { temp := CronCollisionPolicy(v) @@ -6339,16 +6841,16 @@ func (p *JobConfiguration) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) ReadField6(iprot thrift.TProtocol) error { +func (p *JobConfiguration) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *JobConfiguration) ReadField8(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobConfiguration) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { p.InstanceCount = v @@ -6356,89 +6858,109 @@ func (p *JobConfiguration) ReadField8(iprot thrift.TProtocol) error { return nil } -func (p *JobConfiguration) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobConfiguration"); err != nil { +func (p *JobConfiguration) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobConfiguration"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobConfiguration) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobConfiguration) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetCronSchedule() { - if err := oprot.WriteFieldBegin("cronSchedule", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "cronSchedule", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:cronSchedule: ", p), err) } - if err := oprot.WriteString(string(*p.CronSchedule)); err != nil { + if err := oprot.WriteString(ctx, string(*p.CronSchedule)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronSchedule (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:cronSchedule: ", p), err) } } return err } -func (p *JobConfiguration) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("cronCollisionPolicy", thrift.I32, 5); err != nil { +func (p *JobConfiguration) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "cronCollisionPolicy", thrift.I32, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:cronCollisionPolicy: ", p), err) } - if err := oprot.WriteI32(int32(p.CronCollisionPolicy)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.CronCollisionPolicy)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronCollisionPolicy (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:cronCollisionPolicy: ", p), err) } return err } -func (p *JobConfiguration) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 6); err != nil { +func (p *JobConfiguration) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:taskConfig: ", p), err) } return err } -func (p *JobConfiguration) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("owner", thrift.STRUCT, 7); err != nil { +func (p *JobConfiguration) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "owner", thrift.STRUCT, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:owner: ", p), err) } - if err := p.Owner.Write(oprot); err != nil { + if err := p.Owner.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:owner: ", p), err) } return err } -func (p *JobConfiguration) writeField8(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceCount", thrift.I32, 8); err != nil { +func (p *JobConfiguration) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceCount", thrift.I32, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:instanceCount: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceCount (8) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:instanceCount: ", p), err) } return err } -func (p *JobConfiguration) writeField9(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 9); err != nil { +func (p *JobConfiguration) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:key: ", p), err) } return err } +func (p *JobConfiguration) Equals(other *JobConfiguration) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.CronSchedule != other.CronSchedule { + if p.CronSchedule == nil || other.CronSchedule == nil { + return false + } + if (*p.CronSchedule) != (*other.CronSchedule) { return false } + } + if p.CronCollisionPolicy != other.CronCollisionPolicy { return false } + if !p.TaskConfig.Equals(other.TaskConfig) { return false } + if !p.Owner.Equals(other.Owner) { return false } + if p.InstanceCount != other.InstanceCount { return false } + if !p.Key.Equals(other.Key) { return false } + return true +} + func (p *JobConfiguration) String() string { if p == nil { return "" @@ -6478,14 +7000,14 @@ func (p *JobStats) GetFailedTaskCount() int32 { func (p *JobStats) GetPendingTaskCount() int32 { return p.PendingTaskCount } -func (p *JobStats) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobStats) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6493,61 +7015,61 @@ func (p *JobStats) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I32 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobStats) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ActiveTaskCount = v @@ -6555,8 +7077,8 @@ func (p *JobStats) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.FinishedTaskCount = v @@ -6564,8 +7086,8 @@ func (p *JobStats) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.FailedTaskCount = v @@ -6573,8 +7095,8 @@ func (p *JobStats) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobStats) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.PendingTaskCount = v @@ -6582,62 +7104,75 @@ func (p *JobStats) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobStats) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobStats"); err != nil { +func (p *JobStats) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobStats"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobStats) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("activeTaskCount", thrift.I32, 1); err != nil { +func (p *JobStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "activeTaskCount", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:activeTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.ActiveTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.ActiveTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.activeTaskCount (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:activeTaskCount: ", p), err) } return err } -func (p *JobStats) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("finishedTaskCount", thrift.I32, 2); err != nil { +func (p *JobStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "finishedTaskCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:finishedTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FinishedTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FinishedTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.finishedTaskCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:finishedTaskCount: ", p), err) } return err } -func (p *JobStats) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("failedTaskCount", thrift.I32, 3); err != nil { +func (p *JobStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "failedTaskCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FailedTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FailedTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.failedTaskCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedTaskCount: ", p), err) } return err } -func (p *JobStats) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("pendingTaskCount", thrift.I32, 4); err != nil { +func (p *JobStats) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "pendingTaskCount", thrift.I32, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:pendingTaskCount: ", p), err) } - if err := oprot.WriteI32(int32(p.PendingTaskCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.PendingTaskCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.pendingTaskCount (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:pendingTaskCount: ", p), err) } return err } +func (p *JobStats) Equals(other *JobStats) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ActiveTaskCount != other.ActiveTaskCount { return false } + if p.FinishedTaskCount != other.FinishedTaskCount { return false } + if p.FailedTaskCount != other.FailedTaskCount { return false } + if p.PendingTaskCount != other.PendingTaskCount { return false } + return true +} + func (p *JobStats) String() string { if p == nil { return "" @@ -6692,14 +7227,14 @@ func (p *JobSummary) IsSetNextCronRunMs() bool { return p.NextCronRunMs != nil } -func (p *JobSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6707,67 +7242,67 @@ func (p *JobSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobSummary) ReadField1(iprot thrift.TProtocol) error { +func (p *JobSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobConfiguration{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *JobSummary) ReadField2(iprot thrift.TProtocol) error { +func (p *JobSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Stats = &JobStats{} - if err := p.Stats.Read(iprot); err != nil { + if err := p.Stats.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err) } return nil } -func (p *JobSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.NextCronRunMs = &v @@ -6775,55 +7310,72 @@ func (p *JobSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobSummary"); err != nil { +func (p *JobSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *JobSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } -func (p *JobSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("stats", thrift.STRUCT, 2); err != nil { +func (p *JobSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:stats: ", p), err) } - if err := p.Stats.Write(oprot); err != nil { + if err := p.Stats.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:stats: ", p), err) } return err } -func (p *JobSummary) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNextCronRunMs() { - if err := oprot.WriteFieldBegin("nextCronRunMs", thrift.I64, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nextCronRunMs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nextCronRunMs: ", p), err) } - if err := oprot.WriteI64(int64(*p.NextCronRunMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.NextCronRunMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.nextCronRunMs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nextCronRunMs: ", p), err) } } return err } +func (p *JobSummary) Equals(other *JobSummary) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + if !p.Stats.Equals(other.Stats) { return false } + if p.NextCronRunMs != other.NextCronRunMs { + if p.NextCronRunMs == nil || other.NextCronRunMs == nil { + return false + } + if (*p.NextCronRunMs) != (*other.NextCronRunMs) { return false } + } + return true +} + func (p *JobSummary) String() string { if p == nil { return "" @@ -6853,14 +7405,14 @@ func (p *Range) GetFirst() int32 { func (p *Range) GetLast() int32 { return p.Last } -func (p *Range) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Range) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -6868,41 +7420,41 @@ func (p *Range) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Range) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Range) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.First = v @@ -6910,8 +7462,8 @@ func (p *Range) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Range) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Range) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Last = v @@ -6919,40 +7471,51 @@ func (p *Range) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Range) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Range"); err != nil { +func (p *Range) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Range"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Range) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("first", thrift.I32, 1); err != nil { +func (p *Range) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "first", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:first: ", p), err) } - if err := oprot.WriteI32(int32(p.First)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.First)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.first (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:first: ", p), err) } return err } -func (p *Range) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("last", thrift.I32, 2); err != nil { +func (p *Range) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "last", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:last: ", p), err) } - if err := oprot.WriteI32(int32(p.Last)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Last)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.last (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:last: ", p), err) } return err } +func (p *Range) Equals(other *Range) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.First != other.First { return false } + if p.Last != other.Last { return false } + return true +} + func (p *Range) String() string { if p == nil { return "" @@ -6988,14 +7551,14 @@ func (p *ConfigGroup) IsSetConfig() bool { return p.Config != nil } -func (p *ConfigGroup) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigGroup) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7003,118 +7566,136 @@ func (p *ConfigGroup) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigGroup) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigGroup) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Config = &TaskConfig{} - if err := p.Config.Read(iprot); err != nil { + if err := p.Config.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Config), err) } return nil } -func (p *ConfigGroup) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ConfigGroup) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.Instances = tSet for i := 0; i < size; i ++ { - _elem12 := &Range{} - if err := _elem12.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem12), err) + _elem23 := &Range{} + if err := _elem23.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem23), err) } - p.Instances = append(p.Instances, _elem12) + p.Instances = append(p.Instances, _elem23) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ConfigGroup) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigGroup"); err != nil { +func (p *ConfigGroup) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigGroup"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigGroup) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("config", thrift.STRUCT, 1); err != nil { +func (p *ConfigGroup) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "config", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:config: ", p), err) } - if err := p.Config.Write(oprot); err != nil { + if err := p.Config.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Config), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:config: ", p), err) } return err } -func (p *ConfigGroup) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instances", thrift.SET, 3); err != nil { +func (p *ConfigGroup) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instances", thrift.SET, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:instances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Instances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Instances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -7149,14 +7730,14 @@ func (p *ConfigSummary) IsSetKey() bool { return p.Key != nil } -func (p *ConfigSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7164,118 +7745,136 @@ func (p *ConfigSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigSummary) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *ConfigSummary) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ConfigSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Groups = tSet for i := 0; i < size; i ++ { - _elem13 := &ConfigGroup{} - if err := _elem13.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem13), err) + _elem25 := &ConfigGroup{} + if err := _elem25.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) } - p.Groups = append(p.Groups, _elem13) + p.Groups = append(p.Groups, _elem25) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ConfigSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigSummary"); err != nil { +func (p *ConfigSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *ConfigSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *ConfigSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("groups", thrift.SET, 2); err != nil { +func (p *ConfigSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groups", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:groups: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Groups)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Groups)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -7305,14 +7904,14 @@ func (p *PopulateJobResult_) IsSetTaskConfig() bool { return p.TaskConfig != nil } -func (p *PopulateJobResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PopulateJobResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7320,61 +7919,71 @@ func (p *PopulateJobResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PopulateJobResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *PopulateJobResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *PopulateJobResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PopulateJobResult"); err != nil { +func (p *PopulateJobResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PopulateJobResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PopulateJobResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 2); err != nil { +func (p *PopulateJobResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:taskConfig: ", p), err) } return err } +func (p *PopulateJobResult_) Equals(other *PopulateJobResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.TaskConfig.Equals(other.TaskConfig) { return false } + return true +} + func (p *PopulateJobResult_) String() string { if p == nil { return "" @@ -7455,14 +8064,14 @@ func (p *GetQuotaResult_) IsSetNonProdDedicatedConsumption() bool { return p.NonProdDedicatedConsumption != nil } -func (p *GetQuotaResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetQuotaResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7470,189 +8079,203 @@ func (p *GetQuotaResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetQuotaResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Quota = &ResourceAggregate{} - if err := p.Quota.Read(iprot); err != nil { + if err := p.Quota.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Quota), err) } return nil } -func (p *GetQuotaResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.ProdSharedConsumption = &ResourceAggregate{} - if err := p.ProdSharedConsumption.Read(iprot); err != nil { + if err := p.ProdSharedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProdSharedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField3(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.NonProdSharedConsumption = &ResourceAggregate{} - if err := p.NonProdSharedConsumption.Read(iprot); err != nil { + if err := p.NonProdSharedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonProdSharedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField4(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.ProdDedicatedConsumption = &ResourceAggregate{} - if err := p.ProdDedicatedConsumption.Read(iprot); err != nil { + if err := p.ProdDedicatedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProdDedicatedConsumption), err) } return nil } -func (p *GetQuotaResult_) ReadField5(iprot thrift.TProtocol) error { +func (p *GetQuotaResult_) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.NonProdDedicatedConsumption = &ResourceAggregate{} - if err := p.NonProdDedicatedConsumption.Read(iprot); err != nil { + if err := p.NonProdDedicatedConsumption.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NonProdDedicatedConsumption), err) } return nil } -func (p *GetQuotaResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetQuotaResult"); err != nil { +func (p *GetQuotaResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetQuotaResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetQuotaResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("quota", thrift.STRUCT, 1); err != nil { +func (p *GetQuotaResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "quota", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:quota: ", p), err) } - if err := p.Quota.Write(oprot); err != nil { + if err := p.Quota.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:quota: ", p), err) } return err } -func (p *GetQuotaResult_) writeField2(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProdSharedConsumption() { - if err := oprot.WriteFieldBegin("prodSharedConsumption", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "prodSharedConsumption", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:prodSharedConsumption: ", p), err) } - if err := p.ProdSharedConsumption.Write(oprot); err != nil { + if err := p.ProdSharedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdSharedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:prodSharedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField3(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNonProdSharedConsumption() { - if err := oprot.WriteFieldBegin("nonProdSharedConsumption", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nonProdSharedConsumption", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nonProdSharedConsumption: ", p), err) } - if err := p.NonProdSharedConsumption.Write(oprot); err != nil { + if err := p.NonProdSharedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdSharedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nonProdSharedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField4(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProdDedicatedConsumption() { - if err := oprot.WriteFieldBegin("prodDedicatedConsumption", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "prodDedicatedConsumption", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:prodDedicatedConsumption: ", p), err) } - if err := p.ProdDedicatedConsumption.Write(oprot); err != nil { + if err := p.ProdDedicatedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdDedicatedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:prodDedicatedConsumption: ", p), err) } } return err } -func (p *GetQuotaResult_) writeField5(oprot thrift.TProtocol) (err error) { +func (p *GetQuotaResult_) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetNonProdDedicatedConsumption() { - if err := oprot.WriteFieldBegin("nonProdDedicatedConsumption", thrift.STRUCT, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "nonProdDedicatedConsumption", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:nonProdDedicatedConsumption: ", p), err) } - if err := p.NonProdDedicatedConsumption.Write(oprot); err != nil { + if err := p.NonProdDedicatedConsumption.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdDedicatedConsumption), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:nonProdDedicatedConsumption: ", p), err) } } return err } +func (p *GetQuotaResult_) Equals(other *GetQuotaResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Quota.Equals(other.Quota) { return false } + if !p.ProdSharedConsumption.Equals(other.ProdSharedConsumption) { return false } + if !p.NonProdSharedConsumption.Equals(other.NonProdSharedConsumption) { return false } + if !p.ProdDedicatedConsumption.Equals(other.ProdDedicatedConsumption) { return false } + if !p.NonProdDedicatedConsumption.Equals(other.NonProdDedicatedConsumption) { return false } + return true +} + func (p *GetQuotaResult_) String() string { if p == nil { return "" @@ -7708,14 +8331,14 @@ func (p *TaskEvent) IsSetScheduler() bool { return p.Scheduler != nil } -func (p *TaskEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7723,61 +8346,61 @@ func (p *TaskEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *TaskEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Timestamp = v @@ -7785,8 +8408,8 @@ func (p *TaskEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -7795,8 +8418,8 @@ func (p *TaskEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Message = &v @@ -7804,8 +8427,8 @@ func (p *TaskEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Scheduler = &v @@ -7813,66 +8436,89 @@ func (p *TaskEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *TaskEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskEvent"); err != nil { +func (p *TaskEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { +func (p *TaskEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) } return err } -func (p *TaskEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *TaskEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } -func (p *TaskEvent) writeField3(oprot thrift.TProtocol) (err error) { +func (p *TaskEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) } } return err } -func (p *TaskEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *TaskEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetScheduler() { - if err := oprot.WriteFieldBegin("scheduler", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "scheduler", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:scheduler: ", p), err) } - if err := oprot.WriteString(string(*p.Scheduler)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Scheduler)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.scheduler (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:scheduler: ", p), err) } } return err } +func (p *TaskEvent) Equals(other *TaskEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Timestamp != other.Timestamp { return false } + if p.Status != other.Status { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + if p.Scheduler != other.Scheduler { + if p.Scheduler == nil || other.Scheduler == nil { + return false + } + if (*p.Scheduler) != (*other.Scheduler) { return false } + } + return true +} + func (p *TaskEvent) String() string { if p == nil { return "" @@ -7936,14 +8582,14 @@ func (p *AssignedTask) IsSetTask() bool { return p.Task != nil } -func (p *AssignedTask) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AssignedTask) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -7951,81 +8597,81 @@ func (p *AssignedTask) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.MAP { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AssignedTask) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -8033,8 +8679,8 @@ func (p *AssignedTask) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.SlaveId = v @@ -8042,8 +8688,8 @@ func (p *AssignedTask) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AssignedTask) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.SlaveHost = v @@ -8051,44 +8697,44 @@ func (p *AssignedTask) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) ReadField4(iprot thrift.TProtocol) error { +func (p *AssignedTask) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Task = &TaskConfig{} - if err := p.Task.Read(iprot); err != nil { + if err := p.Task.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Task), err) } return nil } -func (p *AssignedTask) ReadField5(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *AssignedTask) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]int32, size) p.AssignedPorts = tMap for i := 0; i < size; i ++ { -var _key14 string - if v, err := iprot.ReadString(); err != nil { +var _key27 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key14 = v + _key27 = v } -var _val15 int32 - if v, err := iprot.ReadI32(); err != nil { +var _val28 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val15 = v + _val28 = v } - p.AssignedPorts[_key14] = _val15 + p.AssignedPorts[_key27] = _val28 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *AssignedTask) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *AssignedTask) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.InstanceId = v @@ -8096,95 +8742,114 @@ func (p *AssignedTask) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *AssignedTask) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("AssignedTask"); err != nil { +func (p *AssignedTask) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "AssignedTask"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AssignedTask) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *AssignedTask) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *AssignedTask) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("slaveId", thrift.STRING, 2); err != nil { +func (p *AssignedTask) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "slaveId", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:slaveId: ", p), err) } - if err := oprot.WriteString(string(p.SlaveId)); err != nil { + if err := oprot.WriteString(ctx, string(p.SlaveId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.slaveId (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:slaveId: ", p), err) } return err } -func (p *AssignedTask) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("slaveHost", thrift.STRING, 3); err != nil { +func (p *AssignedTask) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "slaveHost", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:slaveHost: ", p), err) } - if err := oprot.WriteString(string(p.SlaveHost)); err != nil { + if err := oprot.WriteString(ctx, string(p.SlaveHost)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.slaveHost (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:slaveHost: ", p), err) } return err } -func (p *AssignedTask) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("task", thrift.STRUCT, 4); err != nil { +func (p *AssignedTask) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "task", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:task: ", p), err) } - if err := p.Task.Write(oprot); err != nil { + if err := p.Task.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:task: ", p), err) } return err } -func (p *AssignedTask) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("assignedPorts", thrift.MAP, 5); err != nil { +func (p *AssignedTask) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "assignedPorts", thrift.MAP, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:assignedPorts: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.I32, len(p.AssignedPorts)); err != nil { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.I32, len(p.AssignedPorts)); err != nil { return thrift.PrependError("error writing map begin: ", err) } for k, v := range p.AssignedPorts { - if err := oprot.WriteString(string(k)); err != nil { + if err := oprot.WriteString(ctx, string(k)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteI32(int32(v)); err != nil { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(); err != nil { + if err := oprot.WriteMapEnd(ctx); err != nil { return thrift.PrependError("error writing map end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:assignedPorts: ", p), err) } return err } -func (p *AssignedTask) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 6); err != nil { +func (p *AssignedTask) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:instanceId: ", p), err) } return err } +func (p *AssignedTask) Equals(other *AssignedTask) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TaskId != other.TaskId { return false } + if p.SlaveId != other.SlaveId { return false } + if p.SlaveHost != other.SlaveHost { return false } + if !p.Task.Equals(other.Task) { return false } + if len(p.AssignedPorts) != len(other.AssignedPorts) { return false } + for k, _tgt := range p.AssignedPorts { + _src29 := other.AssignedPorts[k] + if _tgt != _src29 { return false } + } + if p.InstanceId != other.InstanceId { return false } + return true +} + func (p *AssignedTask) String() string { if p == nil { return "" @@ -8247,14 +8912,14 @@ func (p *ScheduledTask) IsSetAssignedTask() bool { return p.AssignedTask != nil } -func (p *ScheduledTask) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ScheduledTask) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8262,89 +8927,89 @@ func (p *ScheduledTask) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.LIST { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRING { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ScheduledTask) ReadField1(iprot thrift.TProtocol) error { +func (p *ScheduledTask) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.AssignedTask = &AssignedTask{} - if err := p.AssignedTask.Read(iprot); err != nil { + if err := p.AssignedTask.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AssignedTask), err) } return nil } -func (p *ScheduledTask) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -8353,8 +9018,8 @@ func (p *ScheduledTask) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.FailureCount = v @@ -8362,8 +9027,8 @@ func (p *ScheduledTask) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ScheduledTask) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.TimesPartitioned = v @@ -8371,28 +9036,28 @@ func (p *ScheduledTask) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ScheduledTask) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*TaskEvent, 0, size) p.TaskEvents = tSlice for i := 0; i < size; i ++ { - _elem16 := &TaskEvent{} - if err := _elem16.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem16), err) + _elem30 := &TaskEvent{} + if err := _elem30.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem30), err) } - p.TaskEvents = append(p.TaskEvents, _elem16) + p.TaskEvents = append(p.TaskEvents, _elem30) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ScheduledTask) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ScheduledTask) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.AncestorId = v @@ -8400,94 +9065,113 @@ func (p *ScheduledTask) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *ScheduledTask) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ScheduledTask"); err != nil { +func (p *ScheduledTask) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ScheduledTask"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ScheduledTask) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("assignedTask", thrift.STRUCT, 1); err != nil { +func (p *ScheduledTask) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "assignedTask", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:assignedTask: ", p), err) } - if err := p.AssignedTask.Write(oprot); err != nil { + if err := p.AssignedTask.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AssignedTask), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:assignedTask: ", p), err) } return err } -func (p *ScheduledTask) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *ScheduledTask) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } -func (p *ScheduledTask) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("failureCount", thrift.I32, 3); err != nil { +func (p *ScheduledTask) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "failureCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failureCount: ", p), err) } - if err := oprot.WriteI32(int32(p.FailureCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.FailureCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.failureCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failureCount: ", p), err) } return err } -func (p *ScheduledTask) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskEvents", thrift.LIST, 4); err != nil { +func (p *ScheduledTask) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskEvents", thrift.LIST, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:taskEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.TaskEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.TaskEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.TaskEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:taskEvents: ", p), err) } return err } -func (p *ScheduledTask) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ancestorId", thrift.STRING, 5); err != nil { +func (p *ScheduledTask) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ancestorId", thrift.STRING, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:ancestorId: ", p), err) } - if err := oprot.WriteString(string(p.AncestorId)); err != nil { + if err := oprot.WriteString(ctx, string(p.AncestorId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ancestorId (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:ancestorId: ", p), err) } return err } -func (p *ScheduledTask) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timesPartitioned", thrift.I32, 6); err != nil { +func (p *ScheduledTask) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timesPartitioned", thrift.I32, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:timesPartitioned: ", p), err) } - if err := oprot.WriteI32(int32(p.TimesPartitioned)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.TimesPartitioned)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timesPartitioned (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:timesPartitioned: ", p), err) } return err } +func (p *ScheduledTask) Equals(other *ScheduledTask) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.AssignedTask.Equals(other.AssignedTask) { return false } + if p.Status != other.Status { return false } + if p.FailureCount != other.FailureCount { return false } + if len(p.TaskEvents) != len(other.TaskEvents) { return false } + for i, _tgt := range p.TaskEvents { + _src31 := other.TaskEvents[i] + if !_tgt.Equals(_src31) { return false } + } + if p.AncestorId != other.AncestorId { return false } + if p.TimesPartitioned != other.TimesPartitioned { return false } + return true +} + func (p *ScheduledTask) String() string { if p == nil { return "" @@ -8509,14 +9193,14 @@ func NewScheduleStatusResult_() *ScheduleStatusResult_ { func (p *ScheduleStatusResult_) GetTasks() []*ScheduledTask { return p.Tasks } -func (p *ScheduleStatusResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ScheduleStatusResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8524,81 +9208,95 @@ func (p *ScheduleStatusResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ScheduleStatusResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ScheduleStatusResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*ScheduledTask, 0, size) p.Tasks = tSlice for i := 0; i < size; i ++ { - _elem17 := &ScheduledTask{} - if err := _elem17.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err) + _elem32 := &ScheduledTask{} + if err := _elem32.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem32), err) } - p.Tasks = append(p.Tasks, _elem17) + p.Tasks = append(p.Tasks, _elem32) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ScheduleStatusResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ScheduleStatusResult"); err != nil { +func (p *ScheduleStatusResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ScheduleStatusResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ScheduleStatusResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tasks", thrift.LIST, 1); err != nil { +func (p *ScheduleStatusResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tasks", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:tasks: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tasks)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tasks)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Tasks { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:tasks: ", p), err) } return err } +func (p *ScheduleStatusResult_) Equals(other *ScheduleStatusResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.Tasks) != len(other.Tasks) { return false } + for i, _tgt := range p.Tasks { + _src33 := other.Tasks[i] + if !_tgt.Equals(_src33) { return false } + } + return true +} + func (p *ScheduleStatusResult_) String() string { if p == nil { return "" @@ -8620,14 +9318,14 @@ func NewGetJobsResult_() *GetJobsResult_ { func (p *GetJobsResult_) GetConfigs() []*JobConfiguration { return p.Configs } -func (p *GetJobsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8635,88 +9333,105 @@ func (p *GetJobsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobConfiguration, 0, size) p.Configs = tSet for i := 0; i < size; i ++ { - _elem18 := &JobConfiguration{} - if err := _elem18.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err) + _elem34 := &JobConfiguration{} + if err := _elem34.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem34), err) } - p.Configs = append(p.Configs, _elem18) + p.Configs = append(p.Configs, _elem34) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobsResult"); err != nil { +func (p *GetJobsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("configs", thrift.SET, 1); err != nil { +func (p *GetJobsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "configs", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:configs: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Configs)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Configs)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -8859,14 +9574,14 @@ func (p *TaskQuery) IsSetLimit() bool { return p.Limit != nil } -func (p *TaskQuery) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TaskQuery) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -8874,121 +9589,121 @@ func (p *TaskQuery) Read(iprot thrift.TProtocol) error { switch fieldId { case 14: if fieldTypeId == thrift.STRING { - if err := p.ReadField14(iprot); err != nil { + if err := p.ReadField14(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.STRING { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.SET { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.SET { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.SET { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.SET { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 12: if fieldTypeId == thrift.I32 { - if err := p.ReadField12(iprot); err != nil { + if err := p.ReadField12(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 13: if fieldTypeId == thrift.I32 { - if err := p.ReadField13(iprot); err != nil { + if err := p.ReadField13(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TaskQuery) ReadField14(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 14: ", err) } else { p.Role = &v @@ -8996,8 +9711,8 @@ func (p *TaskQuery) ReadField14(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.Environment = &v @@ -9005,8 +9720,8 @@ func (p *TaskQuery) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TaskQuery) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.JobName = &v @@ -9014,117 +9729,117 @@ func (p *TaskQuery) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.TaskIds = tSet for i := 0; i < size; i ++ { -var _elem19 string - if v, err := iprot.ReadString(); err != nil { +var _elem36 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem19 = v + _elem36 = v } - p.TaskIds = append(p.TaskIds, _elem19) + p.TaskIds = append(p.TaskIds, _elem36) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField5(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]ScheduleStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { -var _elem20 ScheduleStatus - if v, err := iprot.ReadI32(); err != nil { +var _elem37 ScheduleStatus + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := ScheduleStatus(v) - _elem20 = temp + _elem37 = temp } - p.Statuses = append(p.Statuses, _elem20) + p.Statuses = append(p.Statuses, _elem37) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]int32, 0, size) p.InstanceIds = tSet for i := 0; i < size; i ++ { -var _elem21 int32 - if v, err := iprot.ReadI32(); err != nil { +var _elem38 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem21 = v + _elem38 = v } - p.InstanceIds = append(p.InstanceIds, _elem21) + p.InstanceIds = append(p.InstanceIds, _elem38) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField10(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.SlaveHosts = tSet for i := 0; i < size; i ++ { -var _elem22 string - if v, err := iprot.ReadString(); err != nil { +var _elem39 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem22 = v + _elem39 = v } - p.SlaveHosts = append(p.SlaveHosts, _elem22) + p.SlaveHosts = append(p.SlaveHosts, _elem39) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField11(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *TaskQuery) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobKey, 0, size) p.JobKeys = tSet for i := 0; i < size; i ++ { - _elem23 := &JobKey{} - if err := _elem23.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem23), err) + _elem40 := &JobKey{} + if err := _elem40.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem40), err) } - p.JobKeys = append(p.JobKeys, _elem23) + p.JobKeys = append(p.JobKeys, _elem40) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *TaskQuery) ReadField12(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskQuery) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 12: ", err) } else { p.Offset = &v @@ -9132,8 +9847,8 @@ func (p *TaskQuery) ReadField12(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) ReadField13(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *TaskQuery) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 13: ", err) } else { p.Limit = &v @@ -9141,224 +9856,303 @@ func (p *TaskQuery) ReadField13(iprot thrift.TProtocol) error { return nil } -func (p *TaskQuery) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TaskQuery"); err != nil { +func (p *TaskQuery) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TaskQuery"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField12(oprot); err != nil { return err } - if err := p.writeField13(oprot); err != nil { return err } - if err := p.writeField14(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField12(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } + if err := p.writeField14(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TaskQuery) writeField2(oprot thrift.TProtocol) (err error) { +func (p *TaskQuery) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobName() { - if err := oprot.WriteFieldBegin("jobName", thrift.STRING, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobName", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:jobName: ", p), err) } - if err := oprot.WriteString(string(*p.JobName)); err != nil { + if err := oprot.WriteString(ctx, string(*p.JobName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.jobName (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:jobName: ", p), err) } } return err } -func (p *TaskQuery) writeField4(oprot thrift.TProtocol) (err error) { +func (p *TaskQuery) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTaskIds() { - if err := oprot.WriteFieldBegin("taskIds", thrift.SET, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "taskIds", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:taskIds: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.TaskIds)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.TaskIds)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -9386,14 +10180,14 @@ func (p *HostStatus) GetHost() string { func (p *HostStatus) GetMode() MaintenanceMode { return p.Mode } -func (p *HostStatus) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostStatus) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9401,41 +10195,41 @@ func (p *HostStatus) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostStatus) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostStatus) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -9443,8 +10237,8 @@ func (p *HostStatus) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostStatus) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *HostStatus) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := MaintenanceMode(v) @@ -9453,40 +10247,51 @@ func (p *HostStatus) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *HostStatus) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostStatus"); err != nil { +func (p *HostStatus) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostStatus"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostStatus) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostStatus) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostStatus) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("mode", thrift.I32, 2); err != nil { +func (p *HostStatus) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "mode", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:mode: ", p), err) } - if err := oprot.WriteI32(int32(p.Mode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Mode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.mode (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:mode: ", p), err) } return err } +func (p *HostStatus) Equals(other *HostStatus) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Host != other.Host { return false } + if p.Mode != other.Mode { return false } + return true +} + func (p *HostStatus) String() string { if p == nil { return "" @@ -9520,14 +10325,14 @@ func (p *RoleSummary) GetJobCount() int32 { func (p *RoleSummary) GetCronJobCount() int32 { return p.CronJobCount } -func (p *RoleSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *RoleSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9535,51 +10340,51 @@ func (p *RoleSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *RoleSummary) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *RoleSummary) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -9587,8 +10392,8 @@ func (p *RoleSummary) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *RoleSummary) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.JobCount = v @@ -9596,8 +10401,8 @@ func (p *RoleSummary) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *RoleSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.CronJobCount = v @@ -9605,51 +10410,63 @@ func (p *RoleSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *RoleSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RoleSummary"); err != nil { +func (p *RoleSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "RoleSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *RoleSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *RoleSummary) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } -func (p *RoleSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobCount", thrift.I32, 2); err != nil { +func (p *RoleSummary) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:jobCount: ", p), err) } - if err := oprot.WriteI32(int32(p.JobCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.JobCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.jobCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:jobCount: ", p), err) } return err } -func (p *RoleSummary) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("cronJobCount", thrift.I32, 3); err != nil { +func (p *RoleSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "cronJobCount", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:cronJobCount: ", p), err) } - if err := oprot.WriteI32(int32(p.CronJobCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.CronJobCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.cronJobCount (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cronJobCount: ", p), err) } return err } +func (p *RoleSummary) Equals(other *RoleSummary) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Role != other.Role { return false } + if p.JobCount != other.JobCount { return false } + if p.CronJobCount != other.CronJobCount { return false } + return true +} + func (p *RoleSummary) String() string { if p == nil { return "" @@ -9671,14 +10488,14 @@ func NewHosts() *Hosts { func (p *Hosts) GetHostNames() []string { return p.HostNames } -func (p *Hosts) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Hosts) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9686,89 +10503,106 @@ func (p *Hosts) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Hosts) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *Hosts) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.HostNames = tSet for i := 0; i < size; i ++ { -var _elem24 string - if v, err := iprot.ReadString(); err != nil { +var _elem46 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem24 = v + _elem46 = v } - p.HostNames = append(p.HostNames, _elem24) + p.HostNames = append(p.HostNames, _elem46) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *Hosts) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Hosts"); err != nil { +func (p *Hosts) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Hosts"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Hosts) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hostNames", thrift.SET, 1); err != nil { +func (p *Hosts) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hostNames", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hostNames: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.HostNames)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.HostNames)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -9796,14 +10630,14 @@ func (p *PendingReason) GetTaskId() string { func (p *PendingReason) GetReason() string { return p.Reason } -func (p *PendingReason) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PendingReason) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9811,41 +10645,41 @@ func (p *PendingReason) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PendingReason) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *PendingReason) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -9853,8 +10687,8 @@ func (p *PendingReason) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PendingReason) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *PendingReason) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Reason = v @@ -9862,40 +10696,51 @@ func (p *PendingReason) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *PendingReason) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PendingReason"); err != nil { +func (p *PendingReason) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PendingReason"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PendingReason) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *PendingReason) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *PendingReason) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reason", thrift.STRING, 2); err != nil { +func (p *PendingReason) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reason", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:reason: ", p), err) } - if err := oprot.WriteString(string(p.Reason)); err != nil { + if err := oprot.WriteString(ctx, string(p.Reason)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.reason (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:reason: ", p), err) } return err } +func (p *PendingReason) Equals(other *PendingReason) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TaskId != other.TaskId { return false } + if p.Reason != other.Reason { return false } + return true +} + func (p *PendingReason) String() string { if p == nil { return "" @@ -9932,14 +10777,14 @@ func (p *JobUpdateKey) IsSetJob() bool { return p.Job != nil } -func (p *JobUpdateKey) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateKey) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -9947,49 +10792,49 @@ func (p *JobUpdateKey) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateKey) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *JobUpdateKey) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.ID = v @@ -9997,41 +10842,52 @@ func (p *JobUpdateKey) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateKey) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateKey"); err != nil { +func (p *JobUpdateKey) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateKey"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateKey) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } -func (p *JobUpdateKey) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("id", thrift.STRING, 2); err != nil { +func (p *JobUpdateKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "id", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:id: ", p), err) } - if err := oprot.WriteString(string(p.ID)); err != nil { + if err := oprot.WriteString(ctx, string(p.ID)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.id (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:id: ", p), err) } return err } +func (p *JobUpdateKey) Equals(other *JobUpdateKey) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Job.Equals(other.Job) { return false } + if p.ID != other.ID { return false } + return true +} + func (p *JobUpdateKey) String() string { if p == nil { return "" @@ -10039,16 +10895,648 @@ func (p *JobUpdateKey) String() string { return fmt.Sprintf("JobUpdateKey(%+v)", *p) } +// Limits the amount of active changes being made to instances to groupSize. +// +// Attributes: +// - GroupSize +type QueueJobUpdateStrategy struct { + GroupSize int32 `thrift:"groupSize,1" db:"groupSize" json:"groupSize"` +} + +func NewQueueJobUpdateStrategy() *QueueJobUpdateStrategy { + return &QueueJobUpdateStrategy{} +} + + +func (p *QueueJobUpdateStrategy) GetGroupSize() int32 { + return p.GroupSize +} +func (p *QueueJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *QueueJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.GroupSize = v +} + return nil +} + +func (p *QueueJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "QueueJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *QueueJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSize", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.GroupSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.groupSize (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSize: ", p), err) } + return err +} + +func (p *QueueJobUpdateStrategy) Equals(other *QueueJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.GroupSize != other.GroupSize { return false } + return true +} + +func (p *QueueJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("QueueJobUpdateStrategy(%+v)", *p) +} + +// Similar to Queue strategy but will not start a new group until all instances in an active +// group have finished updating. +// +// Attributes: +// - GroupSize +// - AutopauseAfterBatch +type BatchJobUpdateStrategy struct { + GroupSize int32 `thrift:"groupSize,1" db:"groupSize" json:"groupSize"` + AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"` +} + +func NewBatchJobUpdateStrategy() *BatchJobUpdateStrategy { + return &BatchJobUpdateStrategy{} +} + + +func (p *BatchJobUpdateStrategy) GetGroupSize() int32 { + return p.GroupSize +} + +func (p *BatchJobUpdateStrategy) GetAutopauseAfterBatch() bool { + return p.AutopauseAfterBatch +} +func (p *BatchJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *BatchJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.GroupSize = v +} + return nil +} + +func (p *BatchJobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.AutopauseAfterBatch = v +} + return nil +} + +func (p *BatchJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "BatchJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *BatchJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSize", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSize: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.GroupSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.groupSize (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSize: ", p), err) } + return err +} + +func (p *BatchJobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "autopauseAfterBatch", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.AutopauseAfterBatch)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) } + return err +} + +func (p *BatchJobUpdateStrategy) Equals(other *BatchJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.GroupSize != other.GroupSize { return false } + if p.AutopauseAfterBatch != other.AutopauseAfterBatch { return false } + return true +} + +func (p *BatchJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("BatchJobUpdateStrategy(%+v)", *p) +} + +// Same as Batch strategy but each time an active group completes, the size of the next active +// group may change. +// +// Attributes: +// - GroupSizes +// - AutopauseAfterBatch +type VariableBatchJobUpdateStrategy struct { + GroupSizes []int32 `thrift:"groupSizes,1" db:"groupSizes" json:"groupSizes"` + AutopauseAfterBatch bool `thrift:"autopauseAfterBatch,2" db:"autopauseAfterBatch" json:"autopauseAfterBatch"` +} + +func NewVariableBatchJobUpdateStrategy() *VariableBatchJobUpdateStrategy { + return &VariableBatchJobUpdateStrategy{} +} + + +func (p *VariableBatchJobUpdateStrategy) GetGroupSizes() []int32 { + return p.GroupSizes +} + +func (p *VariableBatchJobUpdateStrategy) GetAutopauseAfterBatch() bool { + return p.AutopauseAfterBatch +} +func (p *VariableBatchJobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.LIST { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]int32, 0, size) + p.GroupSizes = tSlice + for i := 0; i < size; i ++ { +var _elem48 int32 + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem48 = v +} + p.GroupSizes = append(p.GroupSizes, _elem48) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.AutopauseAfterBatch = v +} + return nil +} + +func (p *VariableBatchJobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "VariableBatchJobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *VariableBatchJobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "groupSizes", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:groupSizes: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.GroupSizes)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.GroupSizes { + if err := oprot.WriteI32(ctx, int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:groupSizes: ", p), err) } + return err +} + +func (p *VariableBatchJobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "autopauseAfterBatch", thrift.BOOL, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:autopauseAfterBatch: ", p), err) } + if err := oprot.WriteBool(ctx, bool(p.AutopauseAfterBatch)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.autopauseAfterBatch (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:autopauseAfterBatch: ", p), err) } + return err +} + +func (p *VariableBatchJobUpdateStrategy) Equals(other *VariableBatchJobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.GroupSizes) != len(other.GroupSizes) { return false } + for i, _tgt := range p.GroupSizes { + _src49 := other.GroupSizes[i] + if _tgt != _src49 { return false } + } + if p.AutopauseAfterBatch != other.AutopauseAfterBatch { return false } + return true +} + +func (p *VariableBatchJobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("VariableBatchJobUpdateStrategy(%+v)", *p) +} + +// Attributes: +// - QueueStrategy +// - BatchStrategy +// - VarBatchStrategy +type JobUpdateStrategy struct { + QueueStrategy *QueueJobUpdateStrategy `thrift:"queueStrategy,1" db:"queueStrategy" json:"queueStrategy,omitempty"` + BatchStrategy *BatchJobUpdateStrategy `thrift:"batchStrategy,2" db:"batchStrategy" json:"batchStrategy,omitempty"` + VarBatchStrategy *VariableBatchJobUpdateStrategy `thrift:"varBatchStrategy,3" db:"varBatchStrategy" json:"varBatchStrategy,omitempty"` +} + +func NewJobUpdateStrategy() *JobUpdateStrategy { + return &JobUpdateStrategy{} +} + +var JobUpdateStrategy_QueueStrategy_DEFAULT *QueueJobUpdateStrategy +func (p *JobUpdateStrategy) GetQueueStrategy() *QueueJobUpdateStrategy { + if !p.IsSetQueueStrategy() { + return JobUpdateStrategy_QueueStrategy_DEFAULT + } +return p.QueueStrategy +} +var JobUpdateStrategy_BatchStrategy_DEFAULT *BatchJobUpdateStrategy +func (p *JobUpdateStrategy) GetBatchStrategy() *BatchJobUpdateStrategy { + if !p.IsSetBatchStrategy() { + return JobUpdateStrategy_BatchStrategy_DEFAULT + } +return p.BatchStrategy +} +var JobUpdateStrategy_VarBatchStrategy_DEFAULT *VariableBatchJobUpdateStrategy +func (p *JobUpdateStrategy) GetVarBatchStrategy() *VariableBatchJobUpdateStrategy { + if !p.IsSetVarBatchStrategy() { + return JobUpdateStrategy_VarBatchStrategy_DEFAULT + } +return p.VarBatchStrategy +} +func (p *JobUpdateStrategy) CountSetFieldsJobUpdateStrategy() int { + count := 0 + if (p.IsSetQueueStrategy()) { + count++ + } + if (p.IsSetBatchStrategy()) { + count++ + } + if (p.IsSetVarBatchStrategy()) { + count++ + } + return count + +} + +func (p *JobUpdateStrategy) IsSetQueueStrategy() bool { + return p.QueueStrategy != nil +} + +func (p *JobUpdateStrategy) IsSetBatchStrategy() bool { + return p.BatchStrategy != nil +} + +func (p *JobUpdateStrategy) IsSetVarBatchStrategy() bool { + return p.VarBatchStrategy != nil +} + +func (p *JobUpdateStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.QueueStrategy = &QueueJobUpdateStrategy{} + if err := p.QueueStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueueStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + p.BatchStrategy = &BatchJobUpdateStrategy{} + if err := p.BatchStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BatchStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + p.VarBatchStrategy = &VariableBatchJobUpdateStrategy{} + if err := p.VarBatchStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.VarBatchStrategy), err) + } + return nil +} + +func (p *JobUpdateStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if c := p.CountSetFieldsJobUpdateStrategy(); c != 1 { + return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) + } + if err := oprot.WriteStructBegin(ctx, "JobUpdateStrategy"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *JobUpdateStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetQueueStrategy() { + if err := oprot.WriteFieldBegin(ctx, "queueStrategy", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:queueStrategy: ", p), err) } + if err := p.QueueStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueueStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:queueStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetBatchStrategy() { + if err := oprot.WriteFieldBegin(ctx, "batchStrategy", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:batchStrategy: ", p), err) } + if err := p.BatchStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BatchStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:batchStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetVarBatchStrategy() { + if err := oprot.WriteFieldBegin(ctx, "varBatchStrategy", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:varBatchStrategy: ", p), err) } + if err := p.VarBatchStrategy.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.VarBatchStrategy), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:varBatchStrategy: ", p), err) } + } + return err +} + +func (p *JobUpdateStrategy) Equals(other *JobUpdateStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.QueueStrategy.Equals(other.QueueStrategy) { return false } + if !p.BatchStrategy.Equals(other.BatchStrategy) { return false } + if !p.VarBatchStrategy.Equals(other.VarBatchStrategy) { return false } + return true +} + +func (p *JobUpdateStrategy) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateStrategy(%+v)", *p) +} + // Job update thresholds and limits. // // Attributes: -// - UpdateGroupSize: Max number of instances being updated at any given moment. +// - UpdateGroupSize: Deprecated, please set value inside of desired update strategy instead. +// Max number of instances being updated at any given moment. // - MaxPerInstanceFailures: Max number of instance failures to tolerate before marking instance as FAILED. // - MaxFailedInstances: Max number of FAILED instances to tolerate before terminating the update. // - MinWaitInInstanceRunningMs: Min time to watch a RUNNING instance. // - RollbackOnFailure: If true, enables failed update rollback. // - UpdateOnlyTheseInstances: Instance IDs to act on. All instances will be affected if this is not set. -// - WaitForBatchCompletion: If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another +// - WaitForBatchCompletion: Deprecated, please set updateStrategy to the Batch strategy instead. +// If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another // batch until the preceding batch finishes updating. // - BlockIfNoPulsesAfterMs: If set, requires external calls to pulseJobUpdate RPC within the specified rate for the // update to make progress. If no pulses received within specified interval the update will @@ -10056,6 +11544,7 @@ func (p *JobUpdateKey) String() string { // unblocked by a fresh pulseJobUpdate call. // - SlaAware: If true, updates will obey the SLA requirements of the tasks being updated. If the SLA policy // differs between the old and new task configurations, updates will use the newest configuration. +// - UpdateStrategy: Update strategy to be used for the update. See JobUpdateStrategy for choices. type JobUpdateSettings struct { UpdateGroupSize int32 `thrift:"updateGroupSize,1" db:"updateGroupSize" json:"updateGroupSize"` MaxPerInstanceFailures int32 `thrift:"maxPerInstanceFailures,2" db:"maxPerInstanceFailures" json:"maxPerInstanceFailures"` @@ -10067,6 +11556,7 @@ type JobUpdateSettings struct { WaitForBatchCompletion bool `thrift:"waitForBatchCompletion,8" db:"waitForBatchCompletion" json:"waitForBatchCompletion"` BlockIfNoPulsesAfterMs *int32 `thrift:"blockIfNoPulsesAfterMs,9" db:"blockIfNoPulsesAfterMs" json:"blockIfNoPulsesAfterMs,omitempty"` SlaAware *bool `thrift:"slaAware,10" db:"slaAware" json:"slaAware,omitempty"` + UpdateStrategy *JobUpdateStrategy `thrift:"updateStrategy,11" db:"updateStrategy" json:"updateStrategy,omitempty"` } func NewJobUpdateSettings() *JobUpdateSettings { @@ -10115,6 +11605,13 @@ func (p *JobUpdateSettings) GetSlaAware() bool { } return *p.SlaAware } +var JobUpdateSettings_UpdateStrategy_DEFAULT *JobUpdateStrategy +func (p *JobUpdateSettings) GetUpdateStrategy() *JobUpdateStrategy { + if !p.IsSetUpdateStrategy() { + return JobUpdateSettings_UpdateStrategy_DEFAULT + } +return p.UpdateStrategy +} func (p *JobUpdateSettings) IsSetBlockIfNoPulsesAfterMs() bool { return p.BlockIfNoPulsesAfterMs != nil } @@ -10123,14 +11620,18 @@ func (p *JobUpdateSettings) IsSetSlaAware() bool { return p.SlaAware != nil } -func (p *JobUpdateSettings) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateSettings) IsSetUpdateStrategy() bool { + return p.UpdateStrategy != nil +} + +func (p *JobUpdateSettings) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10138,111 +11639,121 @@ func (p *JobUpdateSettings) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I32 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.BOOL { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.SET { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.BOOL { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.I32 { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.BOOL { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 11: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField11(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateSettings) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.UpdateGroupSize = v @@ -10250,8 +11761,8 @@ func (p *JobUpdateSettings) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.MaxPerInstanceFailures = v @@ -10259,8 +11770,8 @@ func (p *JobUpdateSettings) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.MaxFailedInstances = v @@ -10268,8 +11779,8 @@ func (p *JobUpdateSettings) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.MinWaitInInstanceRunningMs = v @@ -10277,8 +11788,8 @@ func (p *JobUpdateSettings) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.RollbackOnFailure = v @@ -10286,28 +11797,28 @@ func (p *JobUpdateSettings) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateSettings) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.UpdateOnlyTheseInstances = tSet for i := 0; i < size; i ++ { - _elem25 := &Range{} - if err := _elem25.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) + _elem50 := &Range{} + if err := _elem50.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem50), err) } - p.UpdateOnlyTheseInstances = append(p.UpdateOnlyTheseInstances, _elem25) + p.UpdateOnlyTheseInstances = append(p.UpdateOnlyTheseInstances, _elem50) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateSettings) ReadField8(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { p.WaitForBatchCompletion = v @@ -10315,8 +11826,8 @@ func (p *JobUpdateSettings) ReadField8(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateSettings) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.BlockIfNoPulsesAfterMs = &v @@ -10324,8 +11835,8 @@ func (p *JobUpdateSettings) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) ReadField10(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *JobUpdateSettings) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 10: ", err) } else { p.SlaAware = &v @@ -10333,137 +11844,195 @@ func (p *JobUpdateSettings) ReadField10(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSettings) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateSettings"); err != nil { +func (p *JobUpdateSettings) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + p.UpdateStrategy = &JobUpdateStrategy{} + if err := p.UpdateStrategy.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UpdateStrategy), err) + } + return nil +} + +func (p *JobUpdateSettings) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateSettings"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateSettings) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateGroupSize", thrift.I32, 1); err != nil { +func (p *JobUpdateSettings) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateGroupSize", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:updateGroupSize: ", p), err) } - if err := oprot.WriteI32(int32(p.UpdateGroupSize)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.UpdateGroupSize)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.updateGroupSize (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:updateGroupSize: ", p), err) } return err } -func (p *JobUpdateSettings) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxPerInstanceFailures", thrift.I32, 2); err != nil { +func (p *JobUpdateSettings) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxPerInstanceFailures", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxPerInstanceFailures: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxPerInstanceFailures)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxPerInstanceFailures)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxPerInstanceFailures (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxPerInstanceFailures: ", p), err) } return err } -func (p *JobUpdateSettings) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxFailedInstances", thrift.I32, 3); err != nil { +func (p *JobUpdateSettings) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxFailedInstances", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:maxFailedInstances: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxFailedInstances)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxFailedInstances)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxFailedInstances (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:maxFailedInstances: ", p), err) } return err } -func (p *JobUpdateSettings) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("minWaitInInstanceRunningMs", thrift.I32, 5); err != nil { +func (p *JobUpdateSettings) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "minWaitInInstanceRunningMs", thrift.I32, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:minWaitInInstanceRunningMs: ", p), err) } - if err := oprot.WriteI32(int32(p.MinWaitInInstanceRunningMs)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MinWaitInInstanceRunningMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.minWaitInInstanceRunningMs (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:minWaitInInstanceRunningMs: ", p), err) } return err } -func (p *JobUpdateSettings) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("rollbackOnFailure", thrift.BOOL, 6); err != nil { +func (p *JobUpdateSettings) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "rollbackOnFailure", thrift.BOOL, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:rollbackOnFailure: ", p), err) } - if err := oprot.WriteBool(bool(p.RollbackOnFailure)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.RollbackOnFailure)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.rollbackOnFailure (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:rollbackOnFailure: ", p), err) } return err } -func (p *JobUpdateSettings) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateOnlyTheseInstances", thrift.SET, 7); err != nil { +func (p *JobUpdateSettings) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateOnlyTheseInstances", thrift.SET, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:updateOnlyTheseInstances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.UpdateOnlyTheseInstances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.UpdateOnlyTheseInstances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -10520,14 +12089,14 @@ func (p *JobUpdateEvent) IsSetMessage() bool { return p.Message != nil } -func (p *JobUpdateEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10535,61 +12104,61 @@ func (p *JobUpdateEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdateStatus(v) @@ -10598,8 +12167,8 @@ func (p *JobUpdateEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TimestampMs = v @@ -10607,8 +12176,8 @@ func (p *JobUpdateEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = &v @@ -10616,8 +12185,8 @@ func (p *JobUpdateEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Message = &v @@ -10625,66 +12194,89 @@ func (p *JobUpdateEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateEvent"); err != nil { +func (p *JobUpdateEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *JobUpdateEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *JobUpdateEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 2); err != nil { +func (p *JobUpdateEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timestampMs: ", p), err) } return err } -func (p *JobUpdateEvent) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUser() { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(*p.User)); err != nil { + if err := oprot.WriteString(ctx, string(*p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } } return err } -func (p *JobUpdateEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:message: ", p), err) } } return err } +func (p *JobUpdateEvent) Equals(other *JobUpdateEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.User != other.User { + if p.User == nil || other.User == nil { + return false + } + if (*p.User) != (*other.User) { return false } + } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *JobUpdateEvent) String() string { if p == nil { return "" @@ -10733,14 +12325,14 @@ func (p *JobInstanceUpdateEvent) IsSetMessage() bool { return p.Message != nil } -func (p *JobInstanceUpdateEvent) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobInstanceUpdateEvent) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10748,61 +12340,61 @@ func (p *JobInstanceUpdateEvent) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobInstanceUpdateEvent) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.InstanceId = v @@ -10810,8 +12402,8 @@ func (p *JobInstanceUpdateEvent) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TimestampMs = v @@ -10819,8 +12411,8 @@ func (p *JobInstanceUpdateEvent) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := JobUpdateAction(v) @@ -10829,8 +12421,8 @@ func (p *JobInstanceUpdateEvent) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobInstanceUpdateEvent) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Message = &v @@ -10838,64 +12430,82 @@ func (p *JobInstanceUpdateEvent) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobInstanceUpdateEvent) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobInstanceUpdateEvent"); err != nil { +func (p *JobInstanceUpdateEvent) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobInstanceUpdateEvent"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobInstanceUpdateEvent) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceId", thrift.I32, 1); err != nil { +func (p *JobInstanceUpdateEvent) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceId", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:instanceId: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:instanceId: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestampMs", thrift.I64, 2); err != nil { +func (p *JobInstanceUpdateEvent) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:timestampMs: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("action", thrift.I32, 3); err != nil { +func (p *JobInstanceUpdateEvent) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "action", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:action: ", p), err) } - if err := oprot.WriteI32(int32(p.Action)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Action)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.action (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:action: ", p), err) } return err } -func (p *JobInstanceUpdateEvent) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobInstanceUpdateEvent) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMessage() { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:message: ", p), err) } - if err := oprot.WriteString(string(*p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:message: ", p), err) } } return err } +func (p *JobInstanceUpdateEvent) Equals(other *JobInstanceUpdateEvent) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.InstanceId != other.InstanceId { return false } + if p.TimestampMs != other.TimestampMs { return false } + if p.Action != other.Action { return false } + if p.Message != other.Message { + if p.Message == nil || other.Message == nil { + return false + } + if (*p.Message) != (*other.Message) { return false } + } + return true +} + func (p *JobInstanceUpdateEvent) String() string { if p == nil { return "" @@ -10932,14 +12542,14 @@ func (p *InstanceTaskConfig) IsSetTask() bool { return p.Task != nil } -func (p *InstanceTaskConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *InstanceTaskConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -10947,118 +12557,136 @@ func (p *InstanceTaskConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *InstanceTaskConfig) ReadField1(iprot thrift.TProtocol) error { +func (p *InstanceTaskConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Task = &TaskConfig{} - if err := p.Task.Read(iprot); err != nil { + if err := p.Task.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Task), err) } return nil } -func (p *InstanceTaskConfig) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *InstanceTaskConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Range, 0, size) p.Instances = tSet for i := 0; i < size; i ++ { - _elem26 := &Range{} - if err := _elem26.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem26), err) + _elem52 := &Range{} + if err := _elem52.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem52), err) } - p.Instances = append(p.Instances, _elem26) + p.Instances = append(p.Instances, _elem52) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *InstanceTaskConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("InstanceTaskConfig"); err != nil { +func (p *InstanceTaskConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "InstanceTaskConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *InstanceTaskConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("task", thrift.STRUCT, 1); err != nil { +func (p *InstanceTaskConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "task", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:task: ", p), err) } - if err := p.Task.Write(oprot); err != nil { + if err := p.Task.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:task: ", p), err) } return err } -func (p *InstanceTaskConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instances", thrift.SET, 2); err != nil { +func (p *InstanceTaskConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instances", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instances: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Instances)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Instances)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11094,14 +12722,14 @@ func (p *JobUpdateState) GetCreatedTimestampMs() int64 { func (p *JobUpdateState) GetLastModifiedTimestampMs() int64 { return p.LastModifiedTimestampMs } -func (p *JobUpdateState) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateState) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11109,51 +12737,51 @@ func (p *JobUpdateState) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateState) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateState) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdateStatus(v) @@ -11162,8 +12790,8 @@ func (p *JobUpdateState) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateState) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.CreatedTimestampMs = v @@ -11171,8 +12799,8 @@ func (p *JobUpdateState) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *JobUpdateState) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.LastModifiedTimestampMs = v @@ -11180,51 +12808,63 @@ func (p *JobUpdateState) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateState) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateState"); err != nil { +func (p *JobUpdateState) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateState"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateState) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *JobUpdateState) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } -func (p *JobUpdateState) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("createdTimestampMs", thrift.I64, 2); err != nil { +func (p *JobUpdateState) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "createdTimestampMs", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:createdTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.CreatedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.CreatedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.createdTimestampMs (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:createdTimestampMs: ", p), err) } return err } -func (p *JobUpdateState) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("lastModifiedTimestampMs", thrift.I64, 3); err != nil { +func (p *JobUpdateState) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "lastModifiedTimestampMs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:lastModifiedTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.LastModifiedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.LastModifiedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.lastModifiedTimestampMs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:lastModifiedTimestampMs: ", p), err) } return err } +func (p *JobUpdateState) Equals(other *JobUpdateState) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + if p.CreatedTimestampMs != other.CreatedTimestampMs { return false } + if p.LastModifiedTimestampMs != other.LastModifiedTimestampMs { return false } + return true +} + func (p *JobUpdateState) String() string { if p == nil { return "" @@ -11286,14 +12926,14 @@ func (p *JobUpdateSummary) IsSetMetadata() bool { return p.Metadata != nil } -func (p *JobUpdateSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateSummary) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11301,69 +12941,69 @@ func (p *JobUpdateSummary) Read(iprot thrift.TProtocol) error { switch fieldId { case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.SET { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateSummary) ReadField5(iprot thrift.TProtocol) error { +func (p *JobUpdateSummary) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobUpdateSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateSummary) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.User = v @@ -11371,110 +13011,130 @@ func (p *JobUpdateSummary) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateSummary) ReadField4(iprot thrift.TProtocol) error { +func (p *JobUpdateSummary) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.State = &JobUpdateState{} - if err := p.State.Read(iprot); err != nil { + if err := p.State.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.State), err) } return nil } -func (p *JobUpdateSummary) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateSummary) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem27 := &Metadata{} - if err := _elem27.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) + _elem54 := &Metadata{} + if err := _elem54.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem54), err) } - p.Metadata = append(p.Metadata, _elem27) + p.Metadata = append(p.Metadata, _elem54) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateSummary"); err != nil { +func (p *JobUpdateSummary) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateSummary"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateSummary) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 3); err != nil { +func (p *JobUpdateSummary) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) } - if err := oprot.WriteString(string(p.User)); err != nil { + if err := oprot.WriteString(ctx, string(p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:user: ", p), err) } return err } -func (p *JobUpdateSummary) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("state", thrift.STRUCT, 4); err != nil { +func (p *JobUpdateSummary) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "state", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:state: ", p), err) } - if err := p.State.Write(oprot); err != nil { + if err := p.State.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.State), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:state: ", p), err) } return err } -func (p *JobUpdateSummary) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 5); err != nil { +func (p *JobUpdateSummary) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:key: ", p), err) } return err } -func (p *JobUpdateSummary) writeField6(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateSummary) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMetadata() { - if err := oprot.WriteFieldBegin("metadata", thrift.SET, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "metadata", thrift.SET, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:metadata: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Metadata)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Metadata)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11524,14 +13184,14 @@ func (p *JobUpdateInstructions) IsSetSettings() bool { return p.Settings != nil } -func (p *JobUpdateInstructions) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateInstructions) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11539,148 +13199,167 @@ func (p *JobUpdateInstructions) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateInstructions) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateInstructions) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*InstanceTaskConfig, 0, size) p.InitialState = tSet for i := 0; i < size; i ++ { - _elem28 := &InstanceTaskConfig{} - if err := _elem28.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem28), err) + _elem56 := &InstanceTaskConfig{} + if err := _elem56.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem56), err) } - p.InitialState = append(p.InitialState, _elem28) + p.InitialState = append(p.InitialState, _elem56) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateInstructions) ReadField2(iprot thrift.TProtocol) error { +func (p *JobUpdateInstructions) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DesiredState = &InstanceTaskConfig{} - if err := p.DesiredState.Read(iprot); err != nil { + if err := p.DesiredState.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DesiredState), err) } return nil } -func (p *JobUpdateInstructions) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateInstructions) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &JobUpdateSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *JobUpdateInstructions) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateInstructions"); err != nil { +func (p *JobUpdateInstructions) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateInstructions"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateInstructions) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("initialState", thrift.SET, 1); err != nil { +func (p *JobUpdateInstructions) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "initialState", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:initialState: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.InitialState)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.InitialState)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -11724,14 +13403,14 @@ func (p *JobUpdate) IsSetInstructions() bool { return p.Instructions != nil } -func (p *JobUpdate) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdate) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11739,91 +13418,102 @@ func (p *JobUpdate) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdate) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdate) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Summary = &JobUpdateSummary{} - if err := p.Summary.Read(iprot); err != nil { + if err := p.Summary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Summary), err) } return nil } -func (p *JobUpdate) ReadField2(iprot thrift.TProtocol) error { +func (p *JobUpdate) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Instructions = &JobUpdateInstructions{} - if err := p.Instructions.Read(iprot); err != nil { + if err := p.Instructions.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Instructions), err) } return nil } -func (p *JobUpdate) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdate"); err != nil { +func (p *JobUpdate) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdate"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdate) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 1); err != nil { +func (p *JobUpdate) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summary", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) } - if err := p.Summary.Write(oprot); err != nil { + if err := p.Summary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summary: ", p), err) } return err } -func (p *JobUpdate) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instructions", thrift.STRUCT, 2); err != nil { +func (p *JobUpdate) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instructions", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instructions: ", p), err) } - if err := p.Instructions.Write(oprot); err != nil { + if err := p.Instructions.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Instructions), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instructions: ", p), err) } return err } +func (p *JobUpdate) Equals(other *JobUpdate) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Summary.Equals(other.Summary) { return false } + if !p.Instructions.Equals(other.Instructions) { return false } + return true +} + func (p *JobUpdate) String() string { if p == nil { return "" @@ -11864,14 +13554,14 @@ func (p *JobUpdateDetails) IsSetUpdate() bool { return p.Update != nil } -func (p *JobUpdateDetails) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateDetails) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -11879,161 +13569,181 @@ func (p *JobUpdateDetails) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.LIST { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateDetails) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateDetails) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Update = &JobUpdate{} - if err := p.Update.Read(iprot); err != nil { + if err := p.Update.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Update), err) } return nil } -func (p *JobUpdateDetails) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *JobUpdateDetails) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateEvent, 0, size) p.UpdateEvents = tSlice for i := 0; i < size; i ++ { - _elem29 := &JobUpdateEvent{} - if err := _elem29.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem29), err) + _elem58 := &JobUpdateEvent{} + if err := _elem58.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem58), err) } - p.UpdateEvents = append(p.UpdateEvents, _elem29) + p.UpdateEvents = append(p.UpdateEvents, _elem58) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *JobUpdateDetails) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *JobUpdateDetails) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobInstanceUpdateEvent, 0, size) p.InstanceEvents = tSlice for i := 0; i < size; i ++ { - _elem30 := &JobInstanceUpdateEvent{} - if err := _elem30.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem30), err) + _elem59 := &JobInstanceUpdateEvent{} + if err := _elem59.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem59), err) } - p.InstanceEvents = append(p.InstanceEvents, _elem30) + p.InstanceEvents = append(p.InstanceEvents, _elem59) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *JobUpdateDetails) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateDetails"); err != nil { +func (p *JobUpdateDetails) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateDetails"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateDetails) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("update", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateDetails) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "update", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:update: ", p), err) } - if err := p.Update.Write(oprot); err != nil { + if err := p.Update.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Update), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:update: ", p), err) } return err } -func (p *JobUpdateDetails) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateEvents", thrift.LIST, 2); err != nil { +func (p *JobUpdateDetails) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateEvents", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:updateEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UpdateEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.UpdateEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.UpdateEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:updateEvents: ", p), err) } return err } -func (p *JobUpdateDetails) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceEvents", thrift.LIST, 3); err != nil { +func (p *JobUpdateDetails) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceEvents", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:instanceEvents: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.InstanceEvents)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.InstanceEvents)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.InstanceEvents { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:instanceEvents: ", p), err) } return err } +func (p *JobUpdateDetails) Equals(other *JobUpdateDetails) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Update.Equals(other.Update) { return false } + if len(p.UpdateEvents) != len(other.UpdateEvents) { return false } + for i, _tgt := range p.UpdateEvents { + _src60 := other.UpdateEvents[i] + if !_tgt.Equals(_src60) { return false } + } + if len(p.InstanceEvents) != len(other.InstanceEvents) { return false } + for i, _tgt := range p.InstanceEvents { + _src61 := other.InstanceEvents[i] + if !_tgt.Equals(_src61) { return false } + } + return true +} + func (p *JobUpdateDetails) String() string { if p == nil { return "" @@ -12094,14 +13804,14 @@ func (p *JobUpdateRequest) IsSetMetadata() bool { return p.Metadata != nil } -func (p *JobUpdateRequest) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateRequest) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12109,69 +13819,69 @@ func (p *JobUpdateRequest) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateRequest) ReadField1(iprot thrift.TProtocol) error { +func (p *JobUpdateRequest) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.TaskConfig = &TaskConfig{} - if err := p.TaskConfig.Read(iprot); err != nil { + if err := p.TaskConfig.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TaskConfig), err) } return nil } -func (p *JobUpdateRequest) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateRequest) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.InstanceCount = v @@ -12179,110 +13889,130 @@ func (p *JobUpdateRequest) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateRequest) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateRequest) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &JobUpdateSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *JobUpdateRequest) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateRequest) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*Metadata, 0, size) p.Metadata = tSet for i := 0; i < size; i ++ { - _elem31 := &Metadata{} - if err := _elem31.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem31), err) + _elem62 := &Metadata{} + if err := _elem62.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem62), err) } - p.Metadata = append(p.Metadata, _elem31) + p.Metadata = append(p.Metadata, _elem62) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateRequest) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateRequest"); err != nil { +func (p *JobUpdateRequest) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateRequest"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskConfig", thrift.STRUCT, 1); err != nil { +func (p *JobUpdateRequest) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskConfig", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskConfig: ", p), err) } - if err := p.TaskConfig.Write(oprot); err != nil { + if err := p.TaskConfig.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskConfig: ", p), err) } return err } -func (p *JobUpdateRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("instanceCount", thrift.I32, 2); err != nil { +func (p *JobUpdateRequest) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "instanceCount", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceCount: ", p), err) } - if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.InstanceCount)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.instanceCount (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceCount: ", p), err) } return err } -func (p *JobUpdateRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.STRUCT, 3); err != nil { +func (p *JobUpdateRequest) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:settings: ", p), err) } - if err := p.Settings.Write(oprot); err != nil { + if err := p.Settings.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:settings: ", p), err) } return err } -func (p *JobUpdateRequest) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateRequest) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMetadata() { - if err := oprot.WriteFieldBegin("metadata", thrift.SET, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "metadata", thrift.SET, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:metadata: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Metadata)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Metadata)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -12377,14 +14107,14 @@ func (p *JobUpdateQuery) IsSetUpdateStatuses() bool { return p.UpdateStatuses != nil } -func (p *JobUpdateQuery) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobUpdateQuery) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12392,91 +14122,91 @@ func (p *JobUpdateQuery) Read(iprot thrift.TProtocol) error { switch fieldId { case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.SET { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I32 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.I32 { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobUpdateQuery) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateQuery) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Role = &v @@ -12484,24 +14214,24 @@ func (p *JobUpdateQuery) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField8(iprot thrift.TProtocol) error { +func (p *JobUpdateQuery) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *JobUpdateQuery) ReadField3(iprot thrift.TProtocol) error { +func (p *JobUpdateQuery) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.JobKey = &JobKey{} - if err := p.JobKey.Read(iprot); err != nil { + if err := p.JobKey.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobKey), err) } return nil } -func (p *JobUpdateQuery) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *JobUpdateQuery) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.User = &v @@ -12509,31 +14239,31 @@ func (p *JobUpdateQuery) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField5(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobUpdateQuery) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]JobUpdateStatus, 0, size) p.UpdateStatuses = tSet for i := 0; i < size; i ++ { -var _elem32 JobUpdateStatus - if v, err := iprot.ReadI32(); err != nil { +var _elem64 JobUpdateStatus + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := JobUpdateStatus(v) - _elem32 = temp + _elem64 = temp } - p.UpdateStatuses = append(p.UpdateStatuses, _elem32) + p.UpdateStatuses = append(p.UpdateStatuses, _elem64) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobUpdateQuery) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateQuery) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.Offset = v @@ -12541,8 +14271,8 @@ func (p *JobUpdateQuery) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *JobUpdateQuery) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.Limit = v @@ -12550,122 +14280,155 @@ func (p *JobUpdateQuery) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *JobUpdateQuery) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobUpdateQuery"); err != nil { +func (p *JobUpdateQuery) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobUpdateQuery"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobUpdateQuery) writeField2(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRole() { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:role: ", p), err) } - if err := oprot.WriteString(string(*p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(*p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:role: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField3(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobKey() { - if err := oprot.WriteFieldBegin("jobKey", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobKey", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:jobKey: ", p), err) } - if err := p.JobKey.Write(oprot); err != nil { + if err := p.JobKey.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:jobKey: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField4(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUser() { - if err := oprot.WriteFieldBegin("user", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "user", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:user: ", p), err) } - if err := oprot.WriteString(string(*p.User)); err != nil { + if err := oprot.WriteString(ctx, string(*p.User)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.user (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:user: ", p), err) } } return err } -func (p *JobUpdateQuery) writeField5(oprot thrift.TProtocol) (err error) { +func (p *JobUpdateQuery) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUpdateStatuses() { - if err := oprot.WriteFieldBegin("updateStatuses", thrift.SET, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "updateStatuses", thrift.SET, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:updateStatuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.I32, len(p.UpdateStatuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.I32, len(p.UpdateStatuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -12712,14 +14475,14 @@ func (p *HostMaintenanceRequest) IsSetDefaultSlaPolicy() bool { return p.DefaultSlaPolicy != nil } -func (p *HostMaintenanceRequest) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *HostMaintenanceRequest) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12727,61 +14490,61 @@ func (p *HostMaintenanceRequest) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *HostMaintenanceRequest) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *HostMaintenanceRequest) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Host = v @@ -12789,16 +14552,16 @@ func (p *HostMaintenanceRequest) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) ReadField2(iprot thrift.TProtocol) error { +func (p *HostMaintenanceRequest) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DefaultSlaPolicy = &SlaPolicy{} - if err := p.DefaultSlaPolicy.Read(iprot); err != nil { + if err := p.DefaultSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DefaultSlaPolicy), err) } return nil } -func (p *HostMaintenanceRequest) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *HostMaintenanceRequest) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.TimeoutSecs = v @@ -12806,8 +14569,8 @@ func (p *HostMaintenanceRequest) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *HostMaintenanceRequest) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.CreatedTimestampMs = v @@ -12815,63 +14578,76 @@ func (p *HostMaintenanceRequest) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *HostMaintenanceRequest) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("HostMaintenanceRequest"); err != nil { +func (p *HostMaintenanceRequest) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "HostMaintenanceRequest"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *HostMaintenanceRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRING, 1); err != nil { +func (p *HostMaintenanceRequest) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) } - if err := oprot.WriteString(string(p.Host)); err != nil { + if err := oprot.WriteString(ctx, string(p.Host)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:host: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSlaPolicy", thrift.STRUCT, 2); err != nil { +func (p *HostMaintenanceRequest) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultSlaPolicy: ", p), err) } - if err := p.DefaultSlaPolicy.Write(oprot); err != nil { + if err := p.DefaultSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DefaultSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultSlaPolicy: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timeoutSecs", thrift.I64, 3); err != nil { +func (p *HostMaintenanceRequest) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeoutSecs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timeoutSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimeoutSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimeoutSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timeoutSecs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timeoutSecs: ", p), err) } return err } -func (p *HostMaintenanceRequest) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("createdTimestampMs", thrift.I64, 4); err != nil { +func (p *HostMaintenanceRequest) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "createdTimestampMs", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:createdTimestampMs: ", p), err) } - if err := oprot.WriteI64(int64(p.CreatedTimestampMs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.CreatedTimestampMs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.createdTimestampMs (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:createdTimestampMs: ", p), err) } return err } +func (p *HostMaintenanceRequest) Equals(other *HostMaintenanceRequest) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Host != other.Host { return false } + if !p.DefaultSlaPolicy.Equals(other.DefaultSlaPolicy) { return false } + if p.TimeoutSecs != other.TimeoutSecs { return false } + if p.CreatedTimestampMs != other.CreatedTimestampMs { return false } + return true +} + func (p *HostMaintenanceRequest) String() string { if p == nil { return "" @@ -12893,14 +14669,14 @@ func NewListBackupsResult_() *ListBackupsResult_ { func (p *ListBackupsResult_) GetBackups() []string { return p.Backups } -func (p *ListBackupsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ListBackupsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -12908,89 +14684,106 @@ func (p *ListBackupsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ListBackupsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *ListBackupsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]string, 0, size) p.Backups = tSet for i := 0; i < size; i ++ { -var _elem33 string - if v, err := iprot.ReadString(); err != nil { +var _elem66 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem33 = v + _elem66 = v } - p.Backups = append(p.Backups, _elem33) + p.Backups = append(p.Backups, _elem66) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *ListBackupsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ListBackupsResult"); err != nil { +func (p *ListBackupsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ListBackupsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ListBackupsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("backups", thrift.SET, 1); err != nil { +func (p *ListBackupsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "backups", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:backups: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Backups)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRING, len(p.Backups)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13012,14 +14805,14 @@ func NewStartMaintenanceResult_() *StartMaintenanceResult_ { func (p *StartMaintenanceResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *StartMaintenanceResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *StartMaintenanceResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13027,88 +14820,105 @@ func (p *StartMaintenanceResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *StartMaintenanceResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *StartMaintenanceResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem34 := &HostStatus{} - if err := _elem34.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem34), err) + _elem68 := &HostStatus{} + if err := _elem68.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem68), err) } - p.Statuses = append(p.Statuses, _elem34) + p.Statuses = append(p.Statuses, _elem68) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *StartMaintenanceResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("StartMaintenanceResult"); err != nil { +func (p *StartMaintenanceResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "StartMaintenanceResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *StartMaintenanceResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *StartMaintenanceResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13130,14 +14940,14 @@ func NewDrainHostsResult_() *DrainHostsResult_ { func (p *DrainHostsResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *DrainHostsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *DrainHostsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13145,88 +14955,105 @@ func (p *DrainHostsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *DrainHostsResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *DrainHostsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem35 := &HostStatus{} - if err := _elem35.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem35), err) + _elem70 := &HostStatus{} + if err := _elem70.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem70), err) } - p.Statuses = append(p.Statuses, _elem35) + p.Statuses = append(p.Statuses, _elem70) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *DrainHostsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DrainHostsResult"); err != nil { +func (p *DrainHostsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "DrainHostsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *DrainHostsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *DrainHostsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13248,14 +15075,14 @@ func NewQueryRecoveryResult_() *QueryRecoveryResult_ { func (p *QueryRecoveryResult_) GetTasks() []*ScheduledTask { return p.Tasks } -func (p *QueryRecoveryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *QueryRecoveryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13263,88 +15090,105 @@ func (p *QueryRecoveryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *QueryRecoveryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *QueryRecoveryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ScheduledTask, 0, size) p.Tasks = tSet for i := 0; i < size; i ++ { - _elem36 := &ScheduledTask{} - if err := _elem36.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem36), err) + _elem72 := &ScheduledTask{} + if err := _elem72.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem72), err) } - p.Tasks = append(p.Tasks, _elem36) + p.Tasks = append(p.Tasks, _elem72) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *QueryRecoveryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("QueryRecoveryResult"); err != nil { +func (p *QueryRecoveryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "QueryRecoveryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *QueryRecoveryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tasks", thrift.SET, 1); err != nil { +func (p *QueryRecoveryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tasks", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:tasks: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Tasks)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Tasks)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13366,14 +15210,14 @@ func NewMaintenanceStatusResult_() *MaintenanceStatusResult_ { func (p *MaintenanceStatusResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *MaintenanceStatusResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *MaintenanceStatusResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13381,88 +15225,105 @@ func (p *MaintenanceStatusResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *MaintenanceStatusResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *MaintenanceStatusResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem37 := &HostStatus{} - if err := _elem37.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem37), err) + _elem74 := &HostStatus{} + if err := _elem74.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem74), err) } - p.Statuses = append(p.Statuses, _elem37) + p.Statuses = append(p.Statuses, _elem74) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *MaintenanceStatusResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("MaintenanceStatusResult"); err != nil { +func (p *MaintenanceStatusResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "MaintenanceStatusResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *MaintenanceStatusResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *MaintenanceStatusResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13484,14 +15345,14 @@ func NewEndMaintenanceResult_() *EndMaintenanceResult_ { func (p *EndMaintenanceResult_) GetStatuses() []*HostStatus { return p.Statuses } -func (p *EndMaintenanceResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *EndMaintenanceResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13499,88 +15360,105 @@ func (p *EndMaintenanceResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *EndMaintenanceResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *EndMaintenanceResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*HostStatus, 0, size) p.Statuses = tSet for i := 0; i < size; i ++ { - _elem38 := &HostStatus{} - if err := _elem38.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem38), err) + _elem76 := &HostStatus{} + if err := _elem76.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem76), err) } - p.Statuses = append(p.Statuses, _elem38) + p.Statuses = append(p.Statuses, _elem76) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *EndMaintenanceResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("EndMaintenanceResult"); err != nil { +func (p *EndMaintenanceResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "EndMaintenanceResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *EndMaintenanceResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statuses", thrift.SET, 1); err != nil { +func (p *EndMaintenanceResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statuses", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:statuses: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Statuses)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Statuses)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13602,14 +15480,14 @@ func NewRoleSummaryResult_() *RoleSummaryResult_ { func (p *RoleSummaryResult_) GetSummaries() []*RoleSummary { return p.Summaries } -func (p *RoleSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *RoleSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13617,88 +15495,105 @@ func (p *RoleSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *RoleSummaryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *RoleSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*RoleSummary, 0, size) p.Summaries = tSet for i := 0; i < size; i ++ { - _elem39 := &RoleSummary{} - if err := _elem39.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem39), err) + _elem78 := &RoleSummary{} + if err := _elem78.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem78), err) } - p.Summaries = append(p.Summaries, _elem39) + p.Summaries = append(p.Summaries, _elem78) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *RoleSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RoleSummaryResult"); err != nil { +func (p *RoleSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "RoleSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *RoleSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summaries", thrift.SET, 1); err != nil { +func (p *RoleSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summaries", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summaries: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Summaries)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Summaries)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13720,14 +15615,14 @@ func NewJobSummaryResult_() *JobSummaryResult_ { func (p *JobSummaryResult_) GetSummaries() []*JobSummary { return p.Summaries } -func (p *JobSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *JobSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13735,88 +15630,105 @@ func (p *JobSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *JobSummaryResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *JobSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*JobSummary, 0, size) p.Summaries = tSet for i := 0; i < size; i ++ { - _elem40 := &JobSummary{} - if err := _elem40.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem40), err) + _elem80 := &JobSummary{} + if err := _elem80.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem80), err) } - p.Summaries = append(p.Summaries, _elem40) + p.Summaries = append(p.Summaries, _elem80) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *JobSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("JobSummaryResult"); err != nil { +func (p *JobSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "JobSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *JobSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summaries", thrift.SET, 1); err != nil { +func (p *JobSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summaries", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summaries: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Summaries)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Summaries)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -13845,14 +15757,14 @@ func (p *ConfigSummaryResult_) IsSetSummary() bool { return p.Summary != nil } -func (p *ConfigSummaryResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ConfigSummaryResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13860,61 +15772,71 @@ func (p *ConfigSummaryResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ConfigSummaryResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *ConfigSummaryResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Summary = &ConfigSummary{} - if err := p.Summary.Read(iprot); err != nil { + if err := p.Summary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Summary), err) } return nil } -func (p *ConfigSummaryResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ConfigSummaryResult"); err != nil { +func (p *ConfigSummaryResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ConfigSummaryResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ConfigSummaryResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 1); err != nil { +func (p *ConfigSummaryResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "summary", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) } - if err := p.Summary.Write(oprot); err != nil { + if err := p.Summary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summary: ", p), err) } return err } +func (p *ConfigSummaryResult_) Equals(other *ConfigSummaryResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Summary.Equals(other.Summary) { return false } + return true +} + func (p *ConfigSummaryResult_) String() string { if p == nil { return "" @@ -13936,14 +15858,14 @@ func NewGetPendingReasonResult_() *GetPendingReasonResult_ { func (p *GetPendingReasonResult_) GetReasons() []*PendingReason { return p.Reasons } -func (p *GetPendingReasonResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetPendingReasonResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -13951,88 +15873,105 @@ func (p *GetPendingReasonResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetPendingReasonResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetPendingReasonResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*PendingReason, 0, size) p.Reasons = tSet for i := 0; i < size; i ++ { - _elem41 := &PendingReason{} - if err := _elem41.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem41), err) + _elem82 := &PendingReason{} + if err := _elem82.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem82), err) } - p.Reasons = append(p.Reasons, _elem41) + p.Reasons = append(p.Reasons, _elem82) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetPendingReasonResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetPendingReasonResult"); err != nil { +func (p *GetPendingReasonResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetPendingReasonResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetPendingReasonResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("reasons", thrift.SET, 1); err != nil { +func (p *GetPendingReasonResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "reasons", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:reasons: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Reasons)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Reasons)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -14076,14 +16015,14 @@ func (p *StartJobUpdateResult_) IsSetUpdateSummary() bool { return p.UpdateSummary != nil } -func (p *StartJobUpdateResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *StartJobUpdateResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14091,93 +16030,104 @@ func (p *StartJobUpdateResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *StartJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *StartJobUpdateResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Key = &JobUpdateKey{} - if err := p.Key.Read(iprot); err != nil { + if err := p.Key.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) } return nil } -func (p *StartJobUpdateResult_) ReadField2(iprot thrift.TProtocol) error { +func (p *StartJobUpdateResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.UpdateSummary = &JobUpdateSummary{} - if err := p.UpdateSummary.Read(iprot); err != nil { + if err := p.UpdateSummary.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UpdateSummary), err) } return nil } -func (p *StartJobUpdateResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("StartJobUpdateResult"); err != nil { +func (p *StartJobUpdateResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "StartJobUpdateResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *StartJobUpdateResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 1); err != nil { +func (p *StartJobUpdateResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := p.Key.Write(oprot); err != nil { + if err := p.Key.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *StartJobUpdateResult_) writeField2(oprot thrift.TProtocol) (err error) { +func (p *StartJobUpdateResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetUpdateSummary() { - if err := oprot.WriteFieldBegin("updateSummary", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "updateSummary", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:updateSummary: ", p), err) } - if err := p.UpdateSummary.Write(oprot); err != nil { + if err := p.UpdateSummary.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UpdateSummary), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:updateSummary: ", p), err) } } return err } +func (p *StartJobUpdateResult_) Equals(other *StartJobUpdateResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Key.Equals(other.Key) { return false } + if !p.UpdateSummary.Equals(other.UpdateSummary) { return false } + return true +} + func (p *StartJobUpdateResult_) String() string { if p == nil { return "" @@ -14201,14 +16151,14 @@ func NewGetJobUpdateSummariesResult_() *GetJobUpdateSummariesResult_ { func (p *GetJobUpdateSummariesResult_) GetUpdateSummaries() []*JobUpdateSummary { return p.UpdateSummaries } -func (p *GetJobUpdateSummariesResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateSummariesResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14216,81 +16166,95 @@ func (p *GetJobUpdateSummariesResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateSummariesResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *GetJobUpdateSummariesResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateSummary, 0, size) p.UpdateSummaries = tSlice for i := 0; i < size; i ++ { - _elem42 := &JobUpdateSummary{} - if err := _elem42.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem42), err) + _elem84 := &JobUpdateSummary{} + if err := _elem84.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem84), err) } - p.UpdateSummaries = append(p.UpdateSummaries, _elem42) + p.UpdateSummaries = append(p.UpdateSummaries, _elem84) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *GetJobUpdateSummariesResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateSummariesResult"); err != nil { +func (p *GetJobUpdateSummariesResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateSummariesResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateSummariesResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("updateSummaries", thrift.LIST, 1); err != nil { +func (p *GetJobUpdateSummariesResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "updateSummaries", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:updateSummaries: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UpdateSummaries)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.UpdateSummaries)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.UpdateSummaries { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:updateSummaries: ", p), err) } return err } +func (p *GetJobUpdateSummariesResult_) Equals(other *GetJobUpdateSummariesResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if len(p.UpdateSummaries) != len(other.UpdateSummaries) { return false } + for i, _tgt := range p.UpdateSummaries { + _src85 := other.UpdateSummaries[i] + if !_tgt.Equals(_src85) { return false } + } + return true +} + func (p *GetJobUpdateSummariesResult_) String() string { if p == nil { return "" @@ -14327,14 +16291,14 @@ func (p *GetJobUpdateDetailsResult_) IsSetDetails() bool { return p.Details != nil } -func (p *GetJobUpdateDetailsResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateDetailsResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14342,111 +16306,126 @@ func (p *GetJobUpdateDetailsResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateDetailsResult_) ReadField1(iprot thrift.TProtocol) error { +func (p *GetJobUpdateDetailsResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Details = &JobUpdateDetails{} - if err := p.Details.Read(iprot); err != nil { + if err := p.Details.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Details), err) } return nil } -func (p *GetJobUpdateDetailsResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *GetJobUpdateDetailsResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*JobUpdateDetails, 0, size) p.DetailsList = tSlice for i := 0; i < size; i ++ { - _elem43 := &JobUpdateDetails{} - if err := _elem43.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem43), err) + _elem86 := &JobUpdateDetails{} + if err := _elem86.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem86), err) } - p.DetailsList = append(p.DetailsList, _elem43) + p.DetailsList = append(p.DetailsList, _elem86) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *GetJobUpdateDetailsResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateDetailsResult"); err != nil { +func (p *GetJobUpdateDetailsResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateDetailsResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateDetailsResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("details", thrift.STRUCT, 1); err != nil { +func (p *GetJobUpdateDetailsResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "details", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:details: ", p), err) } - if err := p.Details.Write(oprot); err != nil { + if err := p.Details.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Details), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:details: ", p), err) } return err } -func (p *GetJobUpdateDetailsResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("detailsList", thrift.LIST, 2); err != nil { +func (p *GetJobUpdateDetailsResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "detailsList", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:detailsList: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.DetailsList)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.DetailsList)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.DetailsList { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:detailsList: ", p), err) } return err } +func (p *GetJobUpdateDetailsResult_) Equals(other *GetJobUpdateDetailsResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Details.Equals(other.Details) { return false } + if len(p.DetailsList) != len(other.DetailsList) { return false } + for i, _tgt := range p.DetailsList { + _src87 := other.DetailsList[i] + if !_tgt.Equals(_src87) { return false } + } + return true +} + func (p *GetJobUpdateDetailsResult_) String() string { if p == nil { return "" @@ -14470,14 +16449,14 @@ func NewPulseJobUpdateResult_() *PulseJobUpdateResult_ { func (p *PulseJobUpdateResult_) GetStatus() JobUpdatePulseStatus { return p.Status } -func (p *PulseJobUpdateResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PulseJobUpdateResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14485,31 +16464,31 @@ func (p *PulseJobUpdateResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *PulseJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *PulseJobUpdateResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := JobUpdatePulseStatus(v) @@ -14518,29 +16497,39 @@ func (p *PulseJobUpdateResult_) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *PulseJobUpdateResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PulseJobUpdateResult"); err != nil { +func (p *PulseJobUpdateResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PulseJobUpdateResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PulseJobUpdateResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 1); err != nil { +func (p *PulseJobUpdateResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) } return err } +func (p *PulseJobUpdateResult_) Equals(other *PulseJobUpdateResult_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Status != other.Status { return false } + return true +} + func (p *PulseJobUpdateResult_) String() string { if p == nil { return "" @@ -14580,14 +16569,14 @@ func (p *GetJobUpdateDiffResult_) GetUpdate() []*ConfigGroup { func (p *GetJobUpdateDiffResult_) GetUnchanged() []*ConfigGroup { return p.Unchanged } -func (p *GetJobUpdateDiffResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetJobUpdateDiffResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14595,259 +16584,300 @@ func (p *GetJobUpdateDiffResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.SET { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.SET { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Add = tSet for i := 0; i < size; i ++ { - _elem44 := &ConfigGroup{} - if err := _elem44.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem44), err) + _elem88 := &ConfigGroup{} + if err := _elem88.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem88), err) } - p.Add = append(p.Add, _elem44) + p.Add = append(p.Add, _elem88) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Remove = tSet for i := 0; i < size; i ++ { - _elem45 := &ConfigGroup{} - if err := _elem45.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem45), err) + _elem89 := &ConfigGroup{} + if err := _elem89.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem89), err) } - p.Remove = append(p.Remove, _elem45) + p.Remove = append(p.Remove, _elem89) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Update = tSet for i := 0; i < size; i ++ { - _elem46 := &ConfigGroup{} - if err := _elem46.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem46), err) + _elem90 := &ConfigGroup{} + if err := _elem90.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem90), err) } - p.Update = append(p.Update, _elem46) + p.Update = append(p.Update, _elem90) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetJobUpdateDiffResult_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*ConfigGroup, 0, size) p.Unchanged = tSet for i := 0; i < size; i ++ { - _elem47 := &ConfigGroup{} - if err := _elem47.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem47), err) + _elem91 := &ConfigGroup{} + if err := _elem91.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem91), err) } - p.Unchanged = append(p.Unchanged, _elem47) + p.Unchanged = append(p.Unchanged, _elem91) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetJobUpdateDiffResult"); err != nil { +func (p *GetJobUpdateDiffResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetJobUpdateDiffResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetJobUpdateDiffResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("add", thrift.SET, 1); err != nil { +func (p *GetJobUpdateDiffResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "add", thrift.SET, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:add: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Add)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Add)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -14877,14 +16907,14 @@ func (p *TierConfig) GetName() string { func (p *TierConfig) GetSettings() map[string]string { return p.Settings } -func (p *TierConfig) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *TierConfig) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -14892,41 +16922,41 @@ func (p *TierConfig) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.MAP { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *TierConfig) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *TierConfig) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Name = v @@ -14934,78 +16964,93 @@ func (p *TierConfig) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *TierConfig) ReadField2(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() +func (p *TierConfig) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin(ctx) if err != nil { return thrift.PrependError("error reading map begin: ", err) } tMap := make(map[string]string, size) p.Settings = tMap for i := 0; i < size; i ++ { -var _key48 string - if v, err := iprot.ReadString(); err != nil { +var _key96 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key48 = v + _key96 = v } -var _val49 string - if v, err := iprot.ReadString(); err != nil { +var _val97 string + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val49 = v + _val97 = v } - p.Settings[_key48] = _val49 + p.Settings[_key96] = _val97 } - if err := iprot.ReadMapEnd(); err != nil { + if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) } return nil } -func (p *TierConfig) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TierConfig"); err != nil { +func (p *TierConfig) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TierConfig"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *TierConfig) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { +func (p *TierConfig) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err) } return err } -func (p *TierConfig) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.MAP, 2); err != nil { +func (p *TierConfig) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.MAP, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:settings: ", p), err) } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Settings)); err != nil { + if err := oprot.WriteMapBegin(ctx, thrift.STRING, thrift.STRING, len(p.Settings)); err != nil { return thrift.PrependError("error writing map begin: ", err) } for k, v := range p.Settings { - if err := oprot.WriteString(string(k)); err != nil { + if err := oprot.WriteString(ctx, string(k)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } - if err := oprot.WriteString(string(v)); err != nil { + if err := oprot.WriteString(ctx, string(v)); err != nil { return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } } - if err := oprot.WriteMapEnd(); err != nil { + if err := oprot.WriteMapEnd(ctx); err != nil { return thrift.PrependError("error writing map end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:settings: ", p), err) } return err } +func (p *TierConfig) Equals(other *TierConfig) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Name != other.Name { return false } + if len(p.Settings) != len(other.Settings) { return false } + for k, _tgt := range p.Settings { + _src98 := other.Settings[k] + if _tgt != _src98 { return false } + } + return true +} + func (p *TierConfig) String() string { if p == nil { return "" @@ -15035,14 +17080,14 @@ func (p *GetTierConfigResult_) GetDefaultTierName() string { func (p *GetTierConfigResult_) GetTiers() []*TierConfig { return p.Tiers } -func (p *GetTierConfigResult_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *GetTierConfigResult_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15050,41 +17095,41 @@ func (p *GetTierConfigResult_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.SET { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *GetTierConfigResult_) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *GetTierConfigResult_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.DefaultTierName = v @@ -15092,76 +17137,94 @@ func (p *GetTierConfigResult_) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *GetTierConfigResult_) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *GetTierConfigResult_) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]*TierConfig, 0, size) p.Tiers = tSet for i := 0; i < size; i ++ { - _elem50 := &TierConfig{} - if err := _elem50.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem50), err) + _elem99 := &TierConfig{} + if err := _elem99.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem99), err) } - p.Tiers = append(p.Tiers, _elem50) + p.Tiers = append(p.Tiers, _elem99) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *GetTierConfigResult_) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("GetTierConfigResult"); err != nil { +func (p *GetTierConfigResult_) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "GetTierConfigResult"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *GetTierConfigResult_) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultTierName", thrift.STRING, 1); err != nil { +func (p *GetTierConfigResult_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultTierName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultTierName: ", p), err) } - if err := oprot.WriteString(string(p.DefaultTierName)); err != nil { + if err := oprot.WriteString(ctx, string(p.DefaultTierName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.defaultTierName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:defaultTierName: ", p), err) } return err } -func (p *GetTierConfigResult_) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tiers", thrift.SET, 2); err != nil { +func (p *GetTierConfigResult_) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tiers", thrift.SET, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tiers: ", p), err) } - if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Tiers)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.STRUCT, len(p.Tiers)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i" @@ -15192,14 +17255,14 @@ func (p *ServerInfo) GetClusterName() string { func (p *ServerInfo) GetStatsUrlPrefix() string { return p.StatsUrlPrefix } -func (p *ServerInfo) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ServerInfo) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15207,41 +17270,41 @@ func (p *ServerInfo) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ServerInfo) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ServerInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ClusterName = v @@ -15249,8 +17312,8 @@ func (p *ServerInfo) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ServerInfo) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ServerInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.StatsUrlPrefix = v @@ -15258,40 +17321,51 @@ func (p *ServerInfo) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *ServerInfo) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ServerInfo"); err != nil { +func (p *ServerInfo) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ServerInfo"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ServerInfo) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("clusterName", thrift.STRING, 1); err != nil { +func (p *ServerInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "clusterName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:clusterName: ", p), err) } - if err := oprot.WriteString(string(p.ClusterName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ClusterName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.clusterName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:clusterName: ", p), err) } return err } -func (p *ServerInfo) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("statsUrlPrefix", thrift.STRING, 3); err != nil { +func (p *ServerInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "statsUrlPrefix", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:statsUrlPrefix: ", p), err) } - if err := oprot.WriteString(string(p.StatsUrlPrefix)); err != nil { + if err := oprot.WriteString(ctx, string(p.StatsUrlPrefix)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.statsUrlPrefix (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:statsUrlPrefix: ", p), err) } return err } +func (p *ServerInfo) Equals(other *ServerInfo) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ClusterName != other.ClusterName { return false } + if p.StatsUrlPrefix != other.StatsUrlPrefix { return false } + return true +} + func (p *ServerInfo) String() string { if p == nil { return "" @@ -15636,14 +17710,14 @@ func (p *Result_) IsSetGetTierConfigResult_() bool { return p.GetTierConfigResult_ != nil } -func (p *Result_) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Result_) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -15651,674 +17725,703 @@ func (p *Result_) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 17: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField17(iprot); err != nil { + if err := p.ReadField17(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 18: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField18(iprot); err != nil { + if err := p.ReadField18(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 20: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField20(iprot); err != nil { + if err := p.ReadField20(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 21: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField21(iprot); err != nil { + if err := p.ReadField21(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 22: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField22(iprot); err != nil { + if err := p.ReadField22(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 23: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField23(iprot); err != nil { + if err := p.ReadField23(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 24: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField24(iprot); err != nil { + if err := p.ReadField24(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 25: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField25(iprot); err != nil { + if err := p.ReadField25(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 26: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField26(iprot); err != nil { + if err := p.ReadField26(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 27: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField27(iprot); err != nil { + if err := p.ReadField27(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Result_) ReadField1(iprot thrift.TProtocol) error { +func (p *Result_) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.PopulateJobResult_ = &PopulateJobResult_{} - if err := p.PopulateJobResult_.Read(iprot); err != nil { + if err := p.PopulateJobResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PopulateJobResult_), err) } return nil } -func (p *Result_) ReadField3(iprot thrift.TProtocol) error { +func (p *Result_) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.ScheduleStatusResult_ = &ScheduleStatusResult_{} - if err := p.ScheduleStatusResult_.Read(iprot); err != nil { + if err := p.ScheduleStatusResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ScheduleStatusResult_), err) } return nil } -func (p *Result_) ReadField4(iprot thrift.TProtocol) error { +func (p *Result_) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobsResult_ = &GetJobsResult_{} - if err := p.GetJobsResult_.Read(iprot); err != nil { + if err := p.GetJobsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobsResult_), err) } return nil } -func (p *Result_) ReadField5(iprot thrift.TProtocol) error { +func (p *Result_) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.GetQuotaResult_ = &GetQuotaResult_{} - if err := p.GetQuotaResult_.Read(iprot); err != nil { + if err := p.GetQuotaResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetQuotaResult_), err) } return nil } -func (p *Result_) ReadField6(iprot thrift.TProtocol) error { +func (p *Result_) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { p.ListBackupsResult_ = &ListBackupsResult_{} - if err := p.ListBackupsResult_.Read(iprot); err != nil { + if err := p.ListBackupsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ListBackupsResult_), err) } return nil } -func (p *Result_) ReadField7(iprot thrift.TProtocol) error { +func (p *Result_) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { p.StartMaintenanceResult_ = &StartMaintenanceResult_{} - if err := p.StartMaintenanceResult_.Read(iprot); err != nil { + if err := p.StartMaintenanceResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.StartMaintenanceResult_), err) } return nil } -func (p *Result_) ReadField8(iprot thrift.TProtocol) error { +func (p *Result_) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { p.DrainHostsResult_ = &DrainHostsResult_{} - if err := p.DrainHostsResult_.Read(iprot); err != nil { + if err := p.DrainHostsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DrainHostsResult_), err) } return nil } -func (p *Result_) ReadField9(iprot thrift.TProtocol) error { +func (p *Result_) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { p.QueryRecoveryResult_ = &QueryRecoveryResult_{} - if err := p.QueryRecoveryResult_.Read(iprot); err != nil { + if err := p.QueryRecoveryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueryRecoveryResult_), err) } return nil } -func (p *Result_) ReadField10(iprot thrift.TProtocol) error { +func (p *Result_) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { p.MaintenanceStatusResult_ = &MaintenanceStatusResult_{} - if err := p.MaintenanceStatusResult_.Read(iprot); err != nil { + if err := p.MaintenanceStatusResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MaintenanceStatusResult_), err) } return nil } -func (p *Result_) ReadField11(iprot thrift.TProtocol) error { +func (p *Result_) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { p.EndMaintenanceResult_ = &EndMaintenanceResult_{} - if err := p.EndMaintenanceResult_.Read(iprot); err != nil { + if err := p.EndMaintenanceResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EndMaintenanceResult_), err) } return nil } -func (p *Result_) ReadField17(iprot thrift.TProtocol) error { +func (p *Result_) ReadField17(ctx context.Context, iprot thrift.TProtocol) error { p.RoleSummaryResult_ = &RoleSummaryResult_{} - if err := p.RoleSummaryResult_.Read(iprot); err != nil { + if err := p.RoleSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RoleSummaryResult_), err) } return nil } -func (p *Result_) ReadField18(iprot thrift.TProtocol) error { +func (p *Result_) ReadField18(ctx context.Context, iprot thrift.TProtocol) error { p.JobSummaryResult_ = &JobSummaryResult_{} - if err := p.JobSummaryResult_.Read(iprot); err != nil { + if err := p.JobSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobSummaryResult_), err) } return nil } -func (p *Result_) ReadField20(iprot thrift.TProtocol) error { +func (p *Result_) ReadField20(ctx context.Context, iprot thrift.TProtocol) error { p.ConfigSummaryResult_ = &ConfigSummaryResult_{} - if err := p.ConfigSummaryResult_.Read(iprot); err != nil { + if err := p.ConfigSummaryResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ConfigSummaryResult_), err) } return nil } -func (p *Result_) ReadField21(iprot thrift.TProtocol) error { +func (p *Result_) ReadField21(ctx context.Context, iprot thrift.TProtocol) error { p.GetPendingReasonResult_ = &GetPendingReasonResult_{} - if err := p.GetPendingReasonResult_.Read(iprot); err != nil { + if err := p.GetPendingReasonResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetPendingReasonResult_), err) } return nil } -func (p *Result_) ReadField22(iprot thrift.TProtocol) error { +func (p *Result_) ReadField22(ctx context.Context, iprot thrift.TProtocol) error { p.StartJobUpdateResult_ = &StartJobUpdateResult_{} - if err := p.StartJobUpdateResult_.Read(iprot); err != nil { + if err := p.StartJobUpdateResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.StartJobUpdateResult_), err) } return nil } -func (p *Result_) ReadField23(iprot thrift.TProtocol) error { +func (p *Result_) ReadField23(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateSummariesResult_ = &GetJobUpdateSummariesResult_{} - if err := p.GetJobUpdateSummariesResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateSummariesResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateSummariesResult_), err) } return nil } -func (p *Result_) ReadField24(iprot thrift.TProtocol) error { +func (p *Result_) ReadField24(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateDetailsResult_ = &GetJobUpdateDetailsResult_{} - if err := p.GetJobUpdateDetailsResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateDetailsResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateDetailsResult_), err) } return nil } -func (p *Result_) ReadField25(iprot thrift.TProtocol) error { +func (p *Result_) ReadField25(ctx context.Context, iprot thrift.TProtocol) error { p.PulseJobUpdateResult_ = &PulseJobUpdateResult_{} - if err := p.PulseJobUpdateResult_.Read(iprot); err != nil { + if err := p.PulseJobUpdateResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.PulseJobUpdateResult_), err) } return nil } -func (p *Result_) ReadField26(iprot thrift.TProtocol) error { +func (p *Result_) ReadField26(ctx context.Context, iprot thrift.TProtocol) error { p.GetJobUpdateDiffResult_ = &GetJobUpdateDiffResult_{} - if err := p.GetJobUpdateDiffResult_.Read(iprot); err != nil { + if err := p.GetJobUpdateDiffResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetJobUpdateDiffResult_), err) } return nil } -func (p *Result_) ReadField27(iprot thrift.TProtocol) error { +func (p *Result_) ReadField27(ctx context.Context, iprot thrift.TProtocol) error { p.GetTierConfigResult_ = &GetTierConfigResult_{} - if err := p.GetTierConfigResult_.Read(iprot); err != nil { + if err := p.GetTierConfigResult_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.GetTierConfigResult_), err) } return nil } -func (p *Result_) Write(oprot thrift.TProtocol) error { +func (p *Result_) Write(ctx context.Context, oprot thrift.TProtocol) error { if c := p.CountSetFieldsResult_(); c != 1 { return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) } - if err := oprot.WriteStructBegin("Result"); err != nil { + if err := oprot.WriteStructBegin(ctx, "Result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField17(oprot); err != nil { return err } - if err := p.writeField18(oprot); err != nil { return err } - if err := p.writeField20(oprot); err != nil { return err } - if err := p.writeField21(oprot); err != nil { return err } - if err := p.writeField22(oprot); err != nil { return err } - if err := p.writeField23(oprot); err != nil { return err } - if err := p.writeField24(oprot); err != nil { return err } - if err := p.writeField25(oprot); err != nil { return err } - if err := p.writeField26(oprot); err != nil { return err } - if err := p.writeField27(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField17(ctx, oprot); err != nil { return err } + if err := p.writeField18(ctx, oprot); err != nil { return err } + if err := p.writeField20(ctx, oprot); err != nil { return err } + if err := p.writeField21(ctx, oprot); err != nil { return err } + if err := p.writeField22(ctx, oprot); err != nil { return err } + if err := p.writeField23(ctx, oprot); err != nil { return err } + if err := p.writeField24(ctx, oprot); err != nil { return err } + if err := p.writeField25(ctx, oprot); err != nil { return err } + if err := p.writeField26(ctx, oprot); err != nil { return err } + if err := p.writeField27(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Result_) writeField1(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPopulateJobResult_() { - if err := oprot.WriteFieldBegin("populateJobResult", thrift.STRUCT, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "populateJobResult", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:populateJobResult: ", p), err) } - if err := p.PopulateJobResult_.Write(oprot); err != nil { + if err := p.PopulateJobResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PopulateJobResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:populateJobResult: ", p), err) } } return err } -func (p *Result_) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetScheduleStatusResult_() { - if err := oprot.WriteFieldBegin("scheduleStatusResult", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "scheduleStatusResult", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:scheduleStatusResult: ", p), err) } - if err := p.ScheduleStatusResult_.Write(oprot); err != nil { + if err := p.ScheduleStatusResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ScheduleStatusResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:scheduleStatusResult: ", p), err) } } return err } -func (p *Result_) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobsResult_() { - if err := oprot.WriteFieldBegin("getJobsResult", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobsResult", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:getJobsResult: ", p), err) } - if err := p.GetJobsResult_.Write(oprot); err != nil { + if err := p.GetJobsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:getJobsResult: ", p), err) } } return err } -func (p *Result_) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetQuotaResult_() { - if err := oprot.WriteFieldBegin("getQuotaResult", thrift.STRUCT, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getQuotaResult", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:getQuotaResult: ", p), err) } - if err := p.GetQuotaResult_.Write(oprot); err != nil { + if err := p.GetQuotaResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetQuotaResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:getQuotaResult: ", p), err) } } return err } -func (p *Result_) writeField6(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetListBackupsResult_() { - if err := oprot.WriteFieldBegin("listBackupsResult", thrift.STRUCT, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "listBackupsResult", thrift.STRUCT, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:listBackupsResult: ", p), err) } - if err := p.ListBackupsResult_.Write(oprot); err != nil { + if err := p.ListBackupsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ListBackupsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:listBackupsResult: ", p), err) } } return err } -func (p *Result_) writeField7(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetStartMaintenanceResult_() { - if err := oprot.WriteFieldBegin("startMaintenanceResult", thrift.STRUCT, 7); err != nil { + if err := oprot.WriteFieldBegin(ctx, "startMaintenanceResult", thrift.STRUCT, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:startMaintenanceResult: ", p), err) } - if err := p.StartMaintenanceResult_.Write(oprot); err != nil { + if err := p.StartMaintenanceResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartMaintenanceResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:startMaintenanceResult: ", p), err) } } return err } -func (p *Result_) writeField8(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDrainHostsResult_() { - if err := oprot.WriteFieldBegin("drainHostsResult", thrift.STRUCT, 8); err != nil { + if err := oprot.WriteFieldBegin(ctx, "drainHostsResult", thrift.STRUCT, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:drainHostsResult: ", p), err) } - if err := p.DrainHostsResult_.Write(oprot); err != nil { + if err := p.DrainHostsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DrainHostsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:drainHostsResult: ", p), err) } } return err } -func (p *Result_) writeField9(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetQueryRecoveryResult_() { - if err := oprot.WriteFieldBegin("queryRecoveryResult", thrift.STRUCT, 9); err != nil { + if err := oprot.WriteFieldBegin(ctx, "queryRecoveryResult", thrift.STRUCT, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:queryRecoveryResult: ", p), err) } - if err := p.QueryRecoveryResult_.Write(oprot); err != nil { + if err := p.QueryRecoveryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryRecoveryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:queryRecoveryResult: ", p), err) } } return err } -func (p *Result_) writeField10(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetMaintenanceStatusResult_() { - if err := oprot.WriteFieldBegin("maintenanceStatusResult", thrift.STRUCT, 10); err != nil { + if err := oprot.WriteFieldBegin(ctx, "maintenanceStatusResult", thrift.STRUCT, 10); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:maintenanceStatusResult: ", p), err) } - if err := p.MaintenanceStatusResult_.Write(oprot); err != nil { + if err := p.MaintenanceStatusResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MaintenanceStatusResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 10:maintenanceStatusResult: ", p), err) } } return err } -func (p *Result_) writeField11(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetEndMaintenanceResult_() { - if err := oprot.WriteFieldBegin("endMaintenanceResult", thrift.STRUCT, 11); err != nil { + if err := oprot.WriteFieldBegin(ctx, "endMaintenanceResult", thrift.STRUCT, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:endMaintenanceResult: ", p), err) } - if err := p.EndMaintenanceResult_.Write(oprot); err != nil { + if err := p.EndMaintenanceResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EndMaintenanceResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:endMaintenanceResult: ", p), err) } } return err } -func (p *Result_) writeField17(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField17(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRoleSummaryResult_() { - if err := oprot.WriteFieldBegin("roleSummaryResult", thrift.STRUCT, 17); err != nil { + if err := oprot.WriteFieldBegin(ctx, "roleSummaryResult", thrift.STRUCT, 17); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:roleSummaryResult: ", p), err) } - if err := p.RoleSummaryResult_.Write(oprot); err != nil { + if err := p.RoleSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RoleSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 17:roleSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField18(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField18(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetJobSummaryResult_() { - if err := oprot.WriteFieldBegin("jobSummaryResult", thrift.STRUCT, 18); err != nil { + if err := oprot.WriteFieldBegin(ctx, "jobSummaryResult", thrift.STRUCT, 18); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 18:jobSummaryResult: ", p), err) } - if err := p.JobSummaryResult_.Write(oprot); err != nil { + if err := p.JobSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 18:jobSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField20(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField20(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetConfigSummaryResult_() { - if err := oprot.WriteFieldBegin("configSummaryResult", thrift.STRUCT, 20); err != nil { + if err := oprot.WriteFieldBegin(ctx, "configSummaryResult", thrift.STRUCT, 20); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 20:configSummaryResult: ", p), err) } - if err := p.ConfigSummaryResult_.Write(oprot); err != nil { + if err := p.ConfigSummaryResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ConfigSummaryResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 20:configSummaryResult: ", p), err) } } return err } -func (p *Result_) writeField21(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField21(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetPendingReasonResult_() { - if err := oprot.WriteFieldBegin("getPendingReasonResult", thrift.STRUCT, 21); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getPendingReasonResult", thrift.STRUCT, 21); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 21:getPendingReasonResult: ", p), err) } - if err := p.GetPendingReasonResult_.Write(oprot); err != nil { + if err := p.GetPendingReasonResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetPendingReasonResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 21:getPendingReasonResult: ", p), err) } } return err } -func (p *Result_) writeField22(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField22(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetStartJobUpdateResult_() { - if err := oprot.WriteFieldBegin("startJobUpdateResult", thrift.STRUCT, 22); err != nil { + if err := oprot.WriteFieldBegin(ctx, "startJobUpdateResult", thrift.STRUCT, 22); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 22:startJobUpdateResult: ", p), err) } - if err := p.StartJobUpdateResult_.Write(oprot); err != nil { + if err := p.StartJobUpdateResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartJobUpdateResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 22:startJobUpdateResult: ", p), err) } } return err } -func (p *Result_) writeField23(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField23(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateSummariesResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateSummariesResult", thrift.STRUCT, 23); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateSummariesResult", thrift.STRUCT, 23); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 23:getJobUpdateSummariesResult: ", p), err) } - if err := p.GetJobUpdateSummariesResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateSummariesResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateSummariesResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 23:getJobUpdateSummariesResult: ", p), err) } } return err } -func (p *Result_) writeField24(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField24(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateDetailsResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateDetailsResult", thrift.STRUCT, 24); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateDetailsResult", thrift.STRUCT, 24); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 24:getJobUpdateDetailsResult: ", p), err) } - if err := p.GetJobUpdateDetailsResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateDetailsResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDetailsResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 24:getJobUpdateDetailsResult: ", p), err) } } return err } -func (p *Result_) writeField25(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField25(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetPulseJobUpdateResult_() { - if err := oprot.WriteFieldBegin("pulseJobUpdateResult", thrift.STRUCT, 25); err != nil { + if err := oprot.WriteFieldBegin(ctx, "pulseJobUpdateResult", thrift.STRUCT, 25); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 25:pulseJobUpdateResult: ", p), err) } - if err := p.PulseJobUpdateResult_.Write(oprot); err != nil { + if err := p.PulseJobUpdateResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PulseJobUpdateResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 25:pulseJobUpdateResult: ", p), err) } } return err } -func (p *Result_) writeField26(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField26(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetJobUpdateDiffResult_() { - if err := oprot.WriteFieldBegin("getJobUpdateDiffResult", thrift.STRUCT, 26); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getJobUpdateDiffResult", thrift.STRUCT, 26); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 26:getJobUpdateDiffResult: ", p), err) } - if err := p.GetJobUpdateDiffResult_.Write(oprot); err != nil { + if err := p.GetJobUpdateDiffResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDiffResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 26:getJobUpdateDiffResult: ", p), err) } } return err } -func (p *Result_) writeField27(oprot thrift.TProtocol) (err error) { +func (p *Result_) writeField27(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetGetTierConfigResult_() { - if err := oprot.WriteFieldBegin("getTierConfigResult", thrift.STRUCT, 27); err != nil { + if err := oprot.WriteFieldBegin(ctx, "getTierConfigResult", thrift.STRUCT, 27); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 27:getTierConfigResult: ", p), err) } - if err := p.GetTierConfigResult_.Write(oprot); err != nil { + if err := p.GetTierConfigResult_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetTierConfigResult_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 27:getTierConfigResult: ", p), err) } } return err } +func (p *Result_) Equals(other *Result_) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.PopulateJobResult_.Equals(other.PopulateJobResult_) { return false } + if !p.ScheduleStatusResult_.Equals(other.ScheduleStatusResult_) { return false } + if !p.GetJobsResult_.Equals(other.GetJobsResult_) { return false } + if !p.GetQuotaResult_.Equals(other.GetQuotaResult_) { return false } + if !p.ListBackupsResult_.Equals(other.ListBackupsResult_) { return false } + if !p.StartMaintenanceResult_.Equals(other.StartMaintenanceResult_) { return false } + if !p.DrainHostsResult_.Equals(other.DrainHostsResult_) { return false } + if !p.QueryRecoveryResult_.Equals(other.QueryRecoveryResult_) { return false } + if !p.MaintenanceStatusResult_.Equals(other.MaintenanceStatusResult_) { return false } + if !p.EndMaintenanceResult_.Equals(other.EndMaintenanceResult_) { return false } + if !p.RoleSummaryResult_.Equals(other.RoleSummaryResult_) { return false } + if !p.JobSummaryResult_.Equals(other.JobSummaryResult_) { return false } + if !p.ConfigSummaryResult_.Equals(other.ConfigSummaryResult_) { return false } + if !p.GetPendingReasonResult_.Equals(other.GetPendingReasonResult_) { return false } + if !p.StartJobUpdateResult_.Equals(other.StartJobUpdateResult_) { return false } + if !p.GetJobUpdateSummariesResult_.Equals(other.GetJobUpdateSummariesResult_) { return false } + if !p.GetJobUpdateDetailsResult_.Equals(other.GetJobUpdateDetailsResult_) { return false } + if !p.PulseJobUpdateResult_.Equals(other.PulseJobUpdateResult_) { return false } + if !p.GetJobUpdateDiffResult_.Equals(other.GetJobUpdateDiffResult_) { return false } + if !p.GetTierConfigResult_.Equals(other.GetTierConfigResult_) { return false } + return true +} + func (p *Result_) String() string { if p == nil { return "" @@ -16340,14 +18443,14 @@ func NewResponseDetail() *ResponseDetail { func (p *ResponseDetail) GetMessage() string { return p.Message } -func (p *ResponseDetail) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ResponseDetail) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16355,31 +18458,31 @@ func (p *ResponseDetail) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ResponseDetail) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ResponseDetail) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Message = v @@ -16387,29 +18490,39 @@ func (p *ResponseDetail) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ResponseDetail) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ResponseDetail"); err != nil { +func (p *ResponseDetail) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ResponseDetail"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ResponseDetail) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 1); err != nil { +func (p *ResponseDetail) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "message", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:message: ", p), err) } - if err := oprot.WriteString(string(p.Message)); err != nil { + if err := oprot.WriteString(ctx, string(p.Message)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.message (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:message: ", p), err) } return err } +func (p *ResponseDetail) Equals(other *ResponseDetail) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Message != other.Message { return false } + return true +} + func (p *ResponseDetail) String() string { if p == nil { return "" @@ -16466,14 +18579,14 @@ func (p *Response) IsSetResult_() bool { return p.Result_ != nil } -func (p *Response) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Response) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16481,61 +18594,61 @@ func (p *Response) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.LIST { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Response) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := ResponseCode(v) @@ -16544,111 +18657,128 @@ func (p *Response) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Response) ReadField5(iprot thrift.TProtocol) error { +func (p *Response) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.ServerInfo = &ServerInfo{} - if err := p.ServerInfo.Read(iprot); err != nil { + if err := p.ServerInfo.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ServerInfo), err) } return nil } -func (p *Response) ReadField3(iprot thrift.TProtocol) error { +func (p *Response) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Result_ = &Result_{} - if err := p.Result_.Read(iprot); err != nil { + if err := p.Result_.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Result_), err) } return nil } -func (p *Response) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Response) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*ResponseDetail, 0, size) p.Details = tSlice for i := 0; i < size; i ++ { - _elem51 := &ResponseDetail{} - if err := _elem51.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem51), err) + _elem101 := &ResponseDetail{} + if err := _elem101.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem101), err) } - p.Details = append(p.Details, _elem51) + p.Details = append(p.Details, _elem101) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Response) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Response"); err != nil { +func (p *Response) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Response"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Response) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("responseCode", thrift.I32, 1); err != nil { +func (p *Response) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "responseCode", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:responseCode: ", p), err) } - if err := oprot.WriteI32(int32(p.ResponseCode)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.ResponseCode)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.responseCode (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:responseCode: ", p), err) } return err } -func (p *Response) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Response) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetResult_() { - if err := oprot.WriteFieldBegin("result", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "result", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:result: ", p), err) } - if err := p.Result_.Write(oprot); err != nil { + if err := p.Result_.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Result_), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:result: ", p), err) } } return err } -func (p *Response) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("serverInfo", thrift.STRUCT, 5); err != nil { +func (p *Response) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serverInfo", thrift.STRUCT, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:serverInfo: ", p), err) } - if err := p.ServerInfo.Write(oprot); err != nil { + if err := p.ServerInfo.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ServerInfo), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:serverInfo: ", p), err) } return err } -func (p *Response) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("details", thrift.LIST, 6); err != nil { +func (p *Response) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "details", thrift.LIST, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:details: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Details)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Details)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Details { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:details: ", p), err) } return err } +func (p *Response) Equals(other *Response) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ResponseCode != other.ResponseCode { return false } + if !p.Result_.Equals(other.Result_) { return false } + if !p.ServerInfo.Equals(other.ServerInfo) { return false } + if len(p.Details) != len(other.Details) { return false } + for i, _tgt := range p.Details { + _src102 := other.Details[i] + if !_tgt.Equals(_src102) { return false } + } + return true +} + func (p *Response) String() string { if p == nil { return "" @@ -16677,14 +18807,14 @@ func (p *ExplicitReconciliationSettings) IsSetBatchSize() bool { return p.BatchSize != nil } -func (p *ExplicitReconciliationSettings) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ExplicitReconciliationSettings) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -16692,31 +18822,31 @@ func (p *ExplicitReconciliationSettings) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ExplicitReconciliationSettings) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *ExplicitReconciliationSettings) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.BatchSize = &v @@ -16724,31 +18854,46 @@ func (p *ExplicitReconciliationSettings) ReadField1(iprot thrift.TProtocol) err return nil } -func (p *ExplicitReconciliationSettings) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ExplicitReconciliationSettings"); err != nil { +func (p *ExplicitReconciliationSettings) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ExplicitReconciliationSettings"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ExplicitReconciliationSettings) writeField1(oprot thrift.TProtocol) (err error) { +func (p *ExplicitReconciliationSettings) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetBatchSize() { - if err := oprot.WriteFieldBegin("batchSize", thrift.I32, 1); err != nil { + if err := oprot.WriteFieldBegin(ctx, "batchSize", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batchSize: ", p), err) } - if err := oprot.WriteI32(int32(*p.BatchSize)); err != nil { + if err := oprot.WriteI32(ctx, int32(*p.BatchSize)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.batchSize (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batchSize: ", p), err) } } return err } +func (p *ExplicitReconciliationSettings) Equals(other *ExplicitReconciliationSettings) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.BatchSize != other.BatchSize { + if p.BatchSize == nil || other.BatchSize == nil { + return false + } + if (*p.BatchSize) != (*other.BatchSize) { return false } + } + return true +} + func (p *ExplicitReconciliationSettings) String() string { if p == nil { return "" @@ -16823,6 +18968,7 @@ type ReadOnlyScheduler interface { type ReadOnlySchedulerClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewReadOnlySchedulerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ReadOnlySchedulerClient { @@ -16846,14 +18992,26 @@ func NewReadOnlySchedulerClient(c thrift.TClient) *ReadOnlySchedulerClient { func (p *ReadOnlySchedulerClient) Client_() thrift.TClient { return p.c } + +func (p *ReadOnlySchedulerClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *ReadOnlySchedulerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Returns a summary of the jobs grouped by role. func (p *ReadOnlySchedulerClient) GetRoleSummary(ctx context.Context) (r *Response, err error) { - var _args52 ReadOnlySchedulerGetRoleSummaryArgs - var _result53 ReadOnlySchedulerGetRoleSummaryResult - if err = p.Client_().Call(ctx, "getRoleSummary", &_args52, &_result53); err != nil { + var _args103 ReadOnlySchedulerGetRoleSummaryArgs + var _result104 ReadOnlySchedulerGetRoleSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getRoleSummary", &_args103, &_result104) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result53.GetSuccess(), nil + return _result104.GetSuccess(), nil } // Returns a summary of jobs, optionally only those owned by a specific role. @@ -16861,13 +19019,16 @@ func (p *ReadOnlySchedulerClient) GetRoleSummary(ctx context.Context) (r *Respon // Parameters: // - Role func (p *ReadOnlySchedulerClient) GetJobSummary(ctx context.Context, role string) (r *Response, err error) { - var _args54 ReadOnlySchedulerGetJobSummaryArgs - _args54.Role = role - var _result55 ReadOnlySchedulerGetJobSummaryResult - if err = p.Client_().Call(ctx, "getJobSummary", &_args54, &_result55); err != nil { + var _args105 ReadOnlySchedulerGetJobSummaryArgs + _args105.Role = role + var _result106 ReadOnlySchedulerGetJobSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobSummary", &_args105, &_result106) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result55.GetSuccess(), nil + return _result106.GetSuccess(), nil } // Fetches the status of tasks. @@ -16875,13 +19036,16 @@ func (p *ReadOnlySchedulerClient) GetJobSummary(ctx context.Context, role string // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args56 ReadOnlySchedulerGetTasksStatusArgs - _args56.Query = query - var _result57 ReadOnlySchedulerGetTasksStatusResult - if err = p.Client_().Call(ctx, "getTasksStatus", &_args56, &_result57); err != nil { + var _args107 ReadOnlySchedulerGetTasksStatusArgs + _args107.Query = query + var _result108 ReadOnlySchedulerGetTasksStatusResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTasksStatus", &_args107, &_result108) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result57.GetSuccess(), nil + return _result108.GetSuccess(), nil } // Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set. @@ -16890,13 +19054,16 @@ func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *Tas // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetTasksWithoutConfigs(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args58 ReadOnlySchedulerGetTasksWithoutConfigsArgs - _args58.Query = query - var _result59 ReadOnlySchedulerGetTasksWithoutConfigsResult - if err = p.Client_().Call(ctx, "getTasksWithoutConfigs", &_args58, &_result59); err != nil { + var _args109 ReadOnlySchedulerGetTasksWithoutConfigsArgs + _args109.Query = query + var _result110 ReadOnlySchedulerGetTasksWithoutConfigsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTasksWithoutConfigs", &_args109, &_result110) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result59.GetSuccess(), nil + return _result110.GetSuccess(), nil } // Returns user-friendly reasons (if available) for tasks retained in PENDING state. @@ -16904,13 +19071,16 @@ func (p *ReadOnlySchedulerClient) GetTasksWithoutConfigs(ctx context.Context, qu // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetPendingReason(ctx context.Context, query *TaskQuery) (r *Response, err error) { - var _args60 ReadOnlySchedulerGetPendingReasonArgs - _args60.Query = query - var _result61 ReadOnlySchedulerGetPendingReasonResult - if err = p.Client_().Call(ctx, "getPendingReason", &_args60, &_result61); err != nil { + var _args111 ReadOnlySchedulerGetPendingReasonArgs + _args111.Query = query + var _result112 ReadOnlySchedulerGetPendingReasonResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getPendingReason", &_args111, &_result112) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result61.GetSuccess(), nil + return _result112.GetSuccess(), nil } // Fetches the configuration summary of active tasks for the specified job. @@ -16918,13 +19088,16 @@ func (p *ReadOnlySchedulerClient) GetPendingReason(ctx context.Context, query *T // Parameters: // - Job func (p *ReadOnlySchedulerClient) GetConfigSummary(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args62 ReadOnlySchedulerGetConfigSummaryArgs - _args62.Job = job - var _result63 ReadOnlySchedulerGetConfigSummaryResult - if err = p.Client_().Call(ctx, "getConfigSummary", &_args62, &_result63); err != nil { + var _args113 ReadOnlySchedulerGetConfigSummaryArgs + _args113.Job = job + var _result114 ReadOnlySchedulerGetConfigSummaryResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getConfigSummary", &_args113, &_result114) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result63.GetSuccess(), nil + return _result114.GetSuccess(), nil } // Fetches the status of jobs. @@ -16933,13 +19106,16 @@ func (p *ReadOnlySchedulerClient) GetConfigSummary(ctx context.Context, job *Job // Parameters: // - OwnerRole func (p *ReadOnlySchedulerClient) GetJobs(ctx context.Context, ownerRole string) (r *Response, err error) { - var _args64 ReadOnlySchedulerGetJobsArgs - _args64.OwnerRole = ownerRole - var _result65 ReadOnlySchedulerGetJobsResult - if err = p.Client_().Call(ctx, "getJobs", &_args64, &_result65); err != nil { + var _args115 ReadOnlySchedulerGetJobsArgs + _args115.OwnerRole = ownerRole + var _result116 ReadOnlySchedulerGetJobsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobs", &_args115, &_result116) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result65.GetSuccess(), nil + return _result116.GetSuccess(), nil } // Fetches the quota allocated for a user. @@ -16947,13 +19123,16 @@ func (p *ReadOnlySchedulerClient) GetJobs(ctx context.Context, ownerRole string) // Parameters: // - OwnerRole func (p *ReadOnlySchedulerClient) GetQuota(ctx context.Context, ownerRole string) (r *Response, err error) { - var _args66 ReadOnlySchedulerGetQuotaArgs - _args66.OwnerRole = ownerRole - var _result67 ReadOnlySchedulerGetQuotaResult - if err = p.Client_().Call(ctx, "getQuota", &_args66, &_result67); err != nil { + var _args117 ReadOnlySchedulerGetQuotaArgs + _args117.OwnerRole = ownerRole + var _result118 ReadOnlySchedulerGetQuotaResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getQuota", &_args117, &_result118) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result67.GetSuccess(), nil + return _result118.GetSuccess(), nil } // Populates fields in a job configuration as though it were about to be run. @@ -16962,13 +19141,16 @@ func (p *ReadOnlySchedulerClient) GetQuota(ctx context.Context, ownerRole string // Parameters: // - Description func (p *ReadOnlySchedulerClient) PopulateJobConfig(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args68 ReadOnlySchedulerPopulateJobConfigArgs - _args68.Description = description - var _result69 ReadOnlySchedulerPopulateJobConfigResult - if err = p.Client_().Call(ctx, "populateJobConfig", &_args68, &_result69); err != nil { + var _args119 ReadOnlySchedulerPopulateJobConfigArgs + _args119.Description = description + var _result120 ReadOnlySchedulerPopulateJobConfigResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "populateJobConfig", &_args119, &_result120) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result69.GetSuccess(), nil + return _result120.GetSuccess(), nil } // Gets job update summaries. @@ -16976,13 +19158,16 @@ func (p *ReadOnlySchedulerClient) PopulateJobConfig(ctx context.Context, descrip // Parameters: // - JobUpdateQuery func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(ctx context.Context, jobUpdateQuery *JobUpdateQuery) (r *Response, err error) { - var _args70 ReadOnlySchedulerGetJobUpdateSummariesArgs - _args70.JobUpdateQuery = jobUpdateQuery - var _result71 ReadOnlySchedulerGetJobUpdateSummariesResult - if err = p.Client_().Call(ctx, "getJobUpdateSummaries", &_args70, &_result71); err != nil { + var _args121 ReadOnlySchedulerGetJobUpdateSummariesArgs + _args121.JobUpdateQuery = jobUpdateQuery + var _result122 ReadOnlySchedulerGetJobUpdateSummariesResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateSummaries", &_args121, &_result122) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result71.GetSuccess(), nil + return _result122.GetSuccess(), nil } // Gets job update details. @@ -16990,13 +19175,16 @@ func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(ctx context.Context, job // Parameters: // - Query func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(ctx context.Context, query *JobUpdateQuery) (r *Response, err error) { - var _args72 ReadOnlySchedulerGetJobUpdateDetailsArgs - _args72.Query = query - var _result73 ReadOnlySchedulerGetJobUpdateDetailsResult - if err = p.Client_().Call(ctx, "getJobUpdateDetails", &_args72, &_result73); err != nil { + var _args123 ReadOnlySchedulerGetJobUpdateDetailsArgs + _args123.Query = query + var _result124 ReadOnlySchedulerGetJobUpdateDetailsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateDetails", &_args123, &_result124) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result73.GetSuccess(), nil + return _result124.GetSuccess(), nil } // Gets the diff between client (desired) and server (current) job states. @@ -17004,23 +19192,29 @@ func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(ctx context.Context, query // Parameters: // - Request func (p *ReadOnlySchedulerClient) GetJobUpdateDiff(ctx context.Context, request *JobUpdateRequest) (r *Response, err error) { - var _args74 ReadOnlySchedulerGetJobUpdateDiffArgs - _args74.Request = request - var _result75 ReadOnlySchedulerGetJobUpdateDiffResult - if err = p.Client_().Call(ctx, "getJobUpdateDiff", &_args74, &_result75); err != nil { + var _args125 ReadOnlySchedulerGetJobUpdateDiffArgs + _args125.Request = request + var _result126 ReadOnlySchedulerGetJobUpdateDiffResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getJobUpdateDiff", &_args125, &_result126) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result75.GetSuccess(), nil + return _result126.GetSuccess(), nil } // Gets tier configurations. func (p *ReadOnlySchedulerClient) GetTierConfigs(ctx context.Context) (r *Response, err error) { - var _args76 ReadOnlySchedulerGetTierConfigsArgs - var _result77 ReadOnlySchedulerGetTierConfigsResult - if err = p.Client_().Call(ctx, "getTierConfigs", &_args76, &_result77); err != nil { + var _args127 ReadOnlySchedulerGetTierConfigsArgs + var _result128 ReadOnlySchedulerGetTierConfigsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "getTierConfigs", &_args127, &_result128) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result77.GetSuccess(), nil + return _result128.GetSuccess(), nil } type ReadOnlySchedulerProcessor struct { @@ -17043,37 +19237,37 @@ func (p *ReadOnlySchedulerProcessor) ProcessorMap() map[string]thrift.TProcessor func NewReadOnlySchedulerProcessor(handler ReadOnlyScheduler) *ReadOnlySchedulerProcessor { - self78 := &ReadOnlySchedulerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self78.processorMap["getRoleSummary"] = &readOnlySchedulerProcessorGetRoleSummary{handler:handler} - self78.processorMap["getJobSummary"] = &readOnlySchedulerProcessorGetJobSummary{handler:handler} - self78.processorMap["getTasksStatus"] = &readOnlySchedulerProcessorGetTasksStatus{handler:handler} - self78.processorMap["getTasksWithoutConfigs"] = &readOnlySchedulerProcessorGetTasksWithoutConfigs{handler:handler} - self78.processorMap["getPendingReason"] = &readOnlySchedulerProcessorGetPendingReason{handler:handler} - self78.processorMap["getConfigSummary"] = &readOnlySchedulerProcessorGetConfigSummary{handler:handler} - self78.processorMap["getJobs"] = &readOnlySchedulerProcessorGetJobs{handler:handler} - self78.processorMap["getQuota"] = &readOnlySchedulerProcessorGetQuota{handler:handler} - self78.processorMap["populateJobConfig"] = &readOnlySchedulerProcessorPopulateJobConfig{handler:handler} - self78.processorMap["getJobUpdateSummaries"] = &readOnlySchedulerProcessorGetJobUpdateSummaries{handler:handler} - self78.processorMap["getJobUpdateDetails"] = &readOnlySchedulerProcessorGetJobUpdateDetails{handler:handler} - self78.processorMap["getJobUpdateDiff"] = &readOnlySchedulerProcessorGetJobUpdateDiff{handler:handler} - self78.processorMap["getTierConfigs"] = &readOnlySchedulerProcessorGetTierConfigs{handler:handler} -return self78 + self129 := &ReadOnlySchedulerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self129.processorMap["getRoleSummary"] = &readOnlySchedulerProcessorGetRoleSummary{handler:handler} + self129.processorMap["getJobSummary"] = &readOnlySchedulerProcessorGetJobSummary{handler:handler} + self129.processorMap["getTasksStatus"] = &readOnlySchedulerProcessorGetTasksStatus{handler:handler} + self129.processorMap["getTasksWithoutConfigs"] = &readOnlySchedulerProcessorGetTasksWithoutConfigs{handler:handler} + self129.processorMap["getPendingReason"] = &readOnlySchedulerProcessorGetPendingReason{handler:handler} + self129.processorMap["getConfigSummary"] = &readOnlySchedulerProcessorGetConfigSummary{handler:handler} + self129.processorMap["getJobs"] = &readOnlySchedulerProcessorGetJobs{handler:handler} + self129.processorMap["getQuota"] = &readOnlySchedulerProcessorGetQuota{handler:handler} + self129.processorMap["populateJobConfig"] = &readOnlySchedulerProcessorPopulateJobConfig{handler:handler} + self129.processorMap["getJobUpdateSummaries"] = &readOnlySchedulerProcessorGetJobUpdateSummaries{handler:handler} + self129.processorMap["getJobUpdateDetails"] = &readOnlySchedulerProcessorGetJobUpdateDetails{handler:handler} + self129.processorMap["getJobUpdateDiff"] = &readOnlySchedulerProcessorGetJobUpdateDiff{handler:handler} + self129.processorMap["getTierConfigs"] = &readOnlySchedulerProcessorGetTierConfigs{handler:handler} +return self129 } func (p *ReadOnlySchedulerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x79 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x79.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x130 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x130.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x79 + return false, x130 } @@ -17083,41 +19277,72 @@ type readOnlySchedulerProcessorGetRoleSummary struct { func (p *readOnlySchedulerProcessorGetRoleSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetRoleSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getRoleSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetRoleSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetRoleSummary(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getRoleSummary: " + err2.Error()) - oprot.WriteMessageBegin("getRoleSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getRoleSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getRoleSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17131,41 +19356,72 @@ type readOnlySchedulerProcessorGetJobSummary struct { func (p *readOnlySchedulerProcessorGetJobSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobSummary(ctx, args.Role); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobSummary: " + err2.Error()) - oprot.WriteMessageBegin("getJobSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17179,41 +19435,72 @@ type readOnlySchedulerProcessorGetTasksStatus struct { func (p *readOnlySchedulerProcessorGetTasksStatus) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTasksStatusArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTasksStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTasksStatusResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTasksStatus(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksStatus: " + err2.Error()) - oprot.WriteMessageBegin("getTasksStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTasksStatus", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTasksStatus", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17227,41 +19514,72 @@ type readOnlySchedulerProcessorGetTasksWithoutConfigs struct { func (p *readOnlySchedulerProcessorGetTasksWithoutConfigs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTasksWithoutConfigsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTasksWithoutConfigsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTasksWithoutConfigs(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksWithoutConfigs: " + err2.Error()) - oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTasksWithoutConfigs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17275,41 +19593,72 @@ type readOnlySchedulerProcessorGetPendingReason struct { func (p *readOnlySchedulerProcessorGetPendingReason) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetPendingReasonArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getPendingReason", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetPendingReasonResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetPendingReason(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPendingReason: " + err2.Error()) - oprot.WriteMessageBegin("getPendingReason", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getPendingReason", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getPendingReason", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17323,41 +19672,72 @@ type readOnlySchedulerProcessorGetConfigSummary struct { func (p *readOnlySchedulerProcessorGetConfigSummary) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetConfigSummaryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getConfigSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetConfigSummaryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetConfigSummary(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getConfigSummary: " + err2.Error()) - oprot.WriteMessageBegin("getConfigSummary", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getConfigSummary", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getConfigSummary", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17371,41 +19751,72 @@ type readOnlySchedulerProcessorGetJobs struct { func (p *readOnlySchedulerProcessorGetJobs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobs(ctx, args.OwnerRole); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobs: " + err2.Error()) - oprot.WriteMessageBegin("getJobs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17419,41 +19830,72 @@ type readOnlySchedulerProcessorGetQuota struct { func (p *readOnlySchedulerProcessorGetQuota) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetQuotaArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetQuotaResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetQuota(ctx, args.OwnerRole); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getQuota: " + err2.Error()) - oprot.WriteMessageBegin("getQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getQuota", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getQuota", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17467,41 +19909,72 @@ type readOnlySchedulerProcessorPopulateJobConfig struct { func (p *readOnlySchedulerProcessorPopulateJobConfig) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerPopulateJobConfigArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("populateJobConfig", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerPopulateJobConfigResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PopulateJobConfig(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing populateJobConfig: " + err2.Error()) - oprot.WriteMessageBegin("populateJobConfig", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("populateJobConfig", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "populateJobConfig", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17515,41 +19988,72 @@ type readOnlySchedulerProcessorGetJobUpdateSummaries struct { func (p *readOnlySchedulerProcessorGetJobUpdateSummaries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateSummariesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateSummariesResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateSummaries(ctx, args.JobUpdateQuery); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateSummaries: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateSummaries", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17563,41 +20067,72 @@ type readOnlySchedulerProcessorGetJobUpdateDetails struct { func (p *readOnlySchedulerProcessorGetJobUpdateDetails) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateDetailsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateDetails", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateDetailsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateDetails(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDetails: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateDetails", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateDetails", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateDetails", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17611,41 +20146,72 @@ type readOnlySchedulerProcessorGetJobUpdateDiff struct { func (p *readOnlySchedulerProcessorGetJobUpdateDiff) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetJobUpdateDiffArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getJobUpdateDiff", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetJobUpdateDiffResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetJobUpdateDiff(ctx, args.Request); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDiff: " + err2.Error()) - oprot.WriteMessageBegin("getJobUpdateDiff", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getJobUpdateDiff", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getJobUpdateDiff", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17659,41 +20225,72 @@ type readOnlySchedulerProcessorGetTierConfigs struct { func (p *readOnlySchedulerProcessorGetTierConfigs) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ReadOnlySchedulerGetTierConfigsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTierConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ReadOnlySchedulerGetTierConfigsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.GetTierConfigs(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTierConfigs: " + err2.Error()) - oprot.WriteMessageBegin("getTierConfigs", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getTierConfigs", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getTierConfigs", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -17711,39 +20308,39 @@ func NewReadOnlySchedulerGetRoleSummaryArgs() *ReadOnlySchedulerGetRoleSummaryAr return &ReadOnlySchedulerGetRoleSummaryArgs{} } -func (p *ReadOnlySchedulerGetRoleSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getRoleSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getRoleSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -17776,14 +20373,14 @@ func (p *ReadOnlySchedulerGetRoleSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17791,58 +20388,58 @@ func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetRoleSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getRoleSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetRoleSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getRoleSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetRoleSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetRoleSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -17869,14 +20466,14 @@ func NewReadOnlySchedulerGetJobSummaryArgs() *ReadOnlySchedulerGetJobSummaryArgs func (p *ReadOnlySchedulerGetJobSummaryArgs) GetRole() string { return p.Role } -func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17884,31 +20481,31 @@ func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Role = v @@ -17916,25 +20513,25 @@ func (p *ReadOnlySchedulerGetJobSummaryArgs) ReadField1(iprot thrift.TProtocol) return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("role", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "role", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) } - if err := oprot.WriteString(string(p.Role)); err != nil { + if err := oprot.WriteString(ctx, string(p.Role)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) } return err } @@ -17967,14 +20564,14 @@ func (p *ReadOnlySchedulerGetJobSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -17982,58 +20579,58 @@ func (p *ReadOnlySchedulerGetJobSummaryResult) Read(iprot thrift.TProtocol) erro switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetJobSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18067,14 +20664,14 @@ func (p *ReadOnlySchedulerGetTasksStatusArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18082,57 +20679,57 @@ func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksStatusArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksStatus_args"); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksStatus_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18165,14 +20762,14 @@ func (p *ReadOnlySchedulerGetTasksStatusResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18180,58 +20777,58 @@ func (p *ReadOnlySchedulerGetTasksStatusResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksStatusResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksStatus_result"); err != nil { +func (p *ReadOnlySchedulerGetTasksStatusResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksStatus_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksStatusResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTasksStatusResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18265,14 +20862,14 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18280,57 +20877,57 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(iprot thrift.TProtoco switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksWithoutConfigs_args"); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksWithoutConfigs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18363,14 +20960,14 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18378,58 +20975,58 @@ func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(iprot thrift.TProto switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTasksWithoutConfigs_result"); err != nil { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTasksWithoutConfigs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18463,14 +21060,14 @@ func (p *ReadOnlySchedulerGetPendingReasonArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18478,57 +21075,57 @@ func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetPendingReasonArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getPendingReason_args"); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getPendingReason_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -18561,14 +21158,14 @@ func (p *ReadOnlySchedulerGetPendingReasonResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18576,58 +21173,58 @@ func (p *ReadOnlySchedulerGetPendingReasonResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetPendingReasonResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getPendingReason_result"); err != nil { +func (p *ReadOnlySchedulerGetPendingReasonResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getPendingReason_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetPendingReasonResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetPendingReasonResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18661,14 +21258,14 @@ func (p *ReadOnlySchedulerGetConfigSummaryArgs) IsSetJob() bool { return p.Job != nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18676,57 +21273,57 @@ func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getConfigSummary_args"); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getConfigSummary_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) } return err } @@ -18759,14 +21356,14 @@ func (p *ReadOnlySchedulerGetConfigSummaryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18774,58 +21371,58 @@ func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetConfigSummaryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getConfigSummary_result"); err != nil { +func (p *ReadOnlySchedulerGetConfigSummaryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getConfigSummary_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetConfigSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetConfigSummaryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -18852,14 +21449,14 @@ func NewReadOnlySchedulerGetJobsArgs() *ReadOnlySchedulerGetJobsArgs { func (p *ReadOnlySchedulerGetJobsArgs) GetOwnerRole() string { return p.OwnerRole } -func (p *ReadOnlySchedulerGetJobsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18867,31 +21464,31 @@ func (p *ReadOnlySchedulerGetJobsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -18899,25 +21496,25 @@ func (p *ReadOnlySchedulerGetJobsArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *ReadOnlySchedulerGetJobsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobs_args"); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetJobsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } @@ -18950,14 +21547,14 @@ func (p *ReadOnlySchedulerGetJobsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -18965,58 +21562,58 @@ func (p *ReadOnlySchedulerGetJobsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobs_result"); err != nil { +func (p *ReadOnlySchedulerGetJobsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19043,14 +21640,14 @@ func NewReadOnlySchedulerGetQuotaArgs() *ReadOnlySchedulerGetQuotaArgs { func (p *ReadOnlySchedulerGetQuotaArgs) GetOwnerRole() string { return p.OwnerRole } -func (p *ReadOnlySchedulerGetQuotaArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19058,31 +21655,31 @@ func (p *ReadOnlySchedulerGetQuotaArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -19090,25 +21687,25 @@ func (p *ReadOnlySchedulerGetQuotaArgs) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQuota_args"); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getQuota_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetQuotaArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *ReadOnlySchedulerGetQuotaArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } @@ -19141,14 +21738,14 @@ func (p *ReadOnlySchedulerGetQuotaResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetQuotaResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetQuotaResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19156,58 +21753,58 @@ func (p *ReadOnlySchedulerGetQuotaResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetQuotaResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getQuota_result"); err != nil { +func (p *ReadOnlySchedulerGetQuotaResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getQuota_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetQuotaResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19241,14 +21838,14 @@ func (p *ReadOnlySchedulerPopulateJobConfigArgs) IsSetDescription() bool { return p.Description != nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19256,57 +21853,57 @@ func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(iprot thrift.TProtocol) er switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("populateJobConfig_args"); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "populateJobConfig_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -19339,14 +21936,14 @@ func (p *ReadOnlySchedulerPopulateJobConfigResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19354,58 +21951,58 @@ func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(iprot thrift.TProtocol) switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerPopulateJobConfigResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("populateJobConfig_result"); err != nil { +func (p *ReadOnlySchedulerPopulateJobConfigResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "populateJobConfig_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerPopulateJobConfigResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerPopulateJobConfigResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19439,14 +22036,14 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) IsSetJobUpdateQuery() bool return p.JobUpdateQuery != nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19454,57 +22051,57 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(iprot thrift.TProtocol switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.JobUpdateQuery = &JobUpdateQuery{} - if err := p.JobUpdateQuery.Read(iprot); err != nil { + if err := p.JobUpdateQuery.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobUpdateQuery), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateSummaries_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateSummaries_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("jobUpdateQuery", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "jobUpdateQuery", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobUpdateQuery: ", p), err) } - if err := p.JobUpdateQuery.Write(oprot); err != nil { + if err := p.JobUpdateQuery.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobUpdateQuery), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobUpdateQuery: ", p), err) } return err } @@ -19537,14 +22134,14 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19552,58 +22149,58 @@ func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(iprot thrift.TProtoc switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateSummaries_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateSummaries_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19638,14 +22235,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) IsSetQuery() bool { return p.Query != nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19653,57 +22250,57 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(iprot thrift.TProtocol) switch fieldId { case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &JobUpdateQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDetails_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDetails_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 2); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:query: ", p), err) } return err } @@ -19736,14 +22333,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19751,58 +22348,58 @@ func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(iprot thrift.TProtocol switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDetails_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDetails_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -19836,14 +22433,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) IsSetRequest() bool { return p.Request != nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19851,57 +22448,57 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(iprot thrift.TProtocol) err switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Request = &JobUpdateRequest{} - if err := p.Request.Read(iprot); err != nil { + if err := p.Request.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Request), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDiff_args"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDiff_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "request", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:request: ", p), err) } - if err := p.Request.Write(oprot); err != nil { + if err := p.Request.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Request), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:request: ", p), err) } return err } @@ -19934,14 +22531,14 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -19949,58 +22546,58 @@ func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(iprot thrift.TProtocol) e switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getJobUpdateDiff_result"); err != nil { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getJobUpdateDiff_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetJobUpdateDiffResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -20020,39 +22617,39 @@ func NewReadOnlySchedulerGetTierConfigsArgs() *ReadOnlySchedulerGetTierConfigsAr return &ReadOnlySchedulerGetTierConfigsArgs{} } -func (p *ReadOnlySchedulerGetTierConfigsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTierConfigs_args"); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTierConfigs_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -20085,14 +22682,14 @@ func (p *ReadOnlySchedulerGetTierConfigsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -20100,58 +22697,58 @@ func (p *ReadOnlySchedulerGetTierConfigsResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *ReadOnlySchedulerGetTierConfigsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTierConfigs_result"); err != nil { +func (p *ReadOnlySchedulerGetTierConfigsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getTierConfigs_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ReadOnlySchedulerGetTierConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ReadOnlySchedulerGetTierConfigsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -20280,13 +22877,16 @@ func NewAuroraSchedulerManagerClient(c thrift.TClient) *AuroraSchedulerManagerCl // Parameters: // - Description func (p *AuroraSchedulerManagerClient) CreateJob(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args131 AuroraSchedulerManagerCreateJobArgs - _args131.Description = description - var _result132 AuroraSchedulerManagerCreateJobResult - if err = p.Client_().Call(ctx, "createJob", &_args131, &_result132); err != nil { + var _args182 AuroraSchedulerManagerCreateJobArgs + _args182.Description = description + var _result183 AuroraSchedulerManagerCreateJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "createJob", &_args182, &_result183) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result132.GetSuccess(), nil + return _result183.GetSuccess(), nil } // Enters a job into the cron schedule, without actually starting the job. @@ -20296,13 +22896,16 @@ func (p *AuroraSchedulerManagerClient) CreateJob(ctx context.Context, descriptio // Parameters: // - Description func (p *AuroraSchedulerManagerClient) ScheduleCronJob(ctx context.Context, description *JobConfiguration) (r *Response, err error) { - var _args133 AuroraSchedulerManagerScheduleCronJobArgs - _args133.Description = description - var _result134 AuroraSchedulerManagerScheduleCronJobResult - if err = p.Client_().Call(ctx, "scheduleCronJob", &_args133, &_result134); err != nil { + var _args184 AuroraSchedulerManagerScheduleCronJobArgs + _args184.Description = description + var _result185 AuroraSchedulerManagerScheduleCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "scheduleCronJob", &_args184, &_result185) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result134.GetSuccess(), nil + return _result185.GetSuccess(), nil } // Removes a job from the cron schedule. The request will be denied if the job was not previously @@ -20311,13 +22914,16 @@ func (p *AuroraSchedulerManagerClient) ScheduleCronJob(ctx context.Context, desc // Parameters: // - Job func (p *AuroraSchedulerManagerClient) DescheduleCronJob(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args135 AuroraSchedulerManagerDescheduleCronJobArgs - _args135.Job = job - var _result136 AuroraSchedulerManagerDescheduleCronJobResult - if err = p.Client_().Call(ctx, "descheduleCronJob", &_args135, &_result136); err != nil { + var _args186 AuroraSchedulerManagerDescheduleCronJobArgs + _args186.Job = job + var _result187 AuroraSchedulerManagerDescheduleCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "descheduleCronJob", &_args186, &_result187) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result136.GetSuccess(), nil + return _result187.GetSuccess(), nil } // Starts a cron job immediately. The request will be denied if the specified job does not @@ -20326,13 +22932,16 @@ func (p *AuroraSchedulerManagerClient) DescheduleCronJob(ctx context.Context, jo // Parameters: // - Job func (p *AuroraSchedulerManagerClient) StartCronJob(ctx context.Context, job *JobKey) (r *Response, err error) { - var _args137 AuroraSchedulerManagerStartCronJobArgs - _args137.Job = job - var _result138 AuroraSchedulerManagerStartCronJobResult - if err = p.Client_().Call(ctx, "startCronJob", &_args137, &_result138); err != nil { + var _args188 AuroraSchedulerManagerStartCronJobArgs + _args188.Job = job + var _result189 AuroraSchedulerManagerStartCronJobResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "startCronJob", &_args188, &_result189) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result138.GetSuccess(), nil + return _result189.GetSuccess(), nil } // Restarts a batch of shards. @@ -20341,14 +22950,17 @@ func (p *AuroraSchedulerManagerClient) StartCronJob(ctx context.Context, job *Jo // - Job // - ShardIds func (p *AuroraSchedulerManagerClient) RestartShards(ctx context.Context, job *JobKey, shardIds []int32) (r *Response, err error) { - var _args139 AuroraSchedulerManagerRestartShardsArgs - _args139.Job = job - _args139.ShardIds = shardIds - var _result140 AuroraSchedulerManagerRestartShardsResult - if err = p.Client_().Call(ctx, "restartShards", &_args139, &_result140); err != nil { + var _args190 AuroraSchedulerManagerRestartShardsArgs + _args190.Job = job + _args190.ShardIds = shardIds + var _result191 AuroraSchedulerManagerRestartShardsResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "restartShards", &_args190, &_result191) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result140.GetSuccess(), nil + return _result191.GetSuccess(), nil } // Initiates a kill on tasks. @@ -20358,15 +22970,18 @@ func (p *AuroraSchedulerManagerClient) RestartShards(ctx context.Context, job *J // - Instances // - Message func (p *AuroraSchedulerManagerClient) KillTasks(ctx context.Context, job *JobKey, instances []int32, message string) (r *Response, err error) { - var _args141 AuroraSchedulerManagerKillTasksArgs - _args141.Job = job - _args141.Instances = instances - _args141.Message = message - var _result142 AuroraSchedulerManagerKillTasksResult - if err = p.Client_().Call(ctx, "killTasks", &_args141, &_result142); err != nil { + var _args192 AuroraSchedulerManagerKillTasksArgs + _args192.Job = job + _args192.Instances = instances + _args192.Message = message + var _result193 AuroraSchedulerManagerKillTasksResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "killTasks", &_args192, &_result193) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result142.GetSuccess(), nil + return _result193.GetSuccess(), nil } // Adds new instances with the TaskConfig of the existing instance pointed by the key. @@ -20375,14 +22990,17 @@ func (p *AuroraSchedulerManagerClient) KillTasks(ctx context.Context, job *JobKe // - Key // - Count func (p *AuroraSchedulerManagerClient) AddInstances(ctx context.Context, key *InstanceKey, count int32) (r *Response, err error) { - var _args143 AuroraSchedulerManagerAddInstancesArgs - _args143.Key = key - _args143.Count = count - var _result144 AuroraSchedulerManagerAddInstancesResult - if err = p.Client_().Call(ctx, "addInstances", &_args143, &_result144); err != nil { + var _args194 AuroraSchedulerManagerAddInstancesArgs + _args194.Key = key + _args194.Count = count + var _result195 AuroraSchedulerManagerAddInstancesResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "addInstances", &_args194, &_result195) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result144.GetSuccess(), nil + return _result195.GetSuccess(), nil } // Replaces the template (configuration) for the existing cron job. @@ -20391,13 +23009,16 @@ func (p *AuroraSchedulerManagerClient) AddInstances(ctx context.Context, key *In // Parameters: // - Config func (p *AuroraSchedulerManagerClient) ReplaceCronTemplate(ctx context.Context, config *JobConfiguration) (r *Response, err error) { - var _args145 AuroraSchedulerManagerReplaceCronTemplateArgs - _args145.Config = config - var _result146 AuroraSchedulerManagerReplaceCronTemplateResult - if err = p.Client_().Call(ctx, "replaceCronTemplate", &_args145, &_result146); err != nil { + var _args196 AuroraSchedulerManagerReplaceCronTemplateArgs + _args196.Config = config + var _result197 AuroraSchedulerManagerReplaceCronTemplateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "replaceCronTemplate", &_args196, &_result197) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result146.GetSuccess(), nil + return _result197.GetSuccess(), nil } // Starts update of the existing service job. @@ -20406,14 +23027,17 @@ func (p *AuroraSchedulerManagerClient) ReplaceCronTemplate(ctx context.Context, // - Request: A description of how to change the job. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) StartJobUpdate(ctx context.Context, request *JobUpdateRequest, message string) (r *Response, err error) { - var _args147 AuroraSchedulerManagerStartJobUpdateArgs - _args147.Request = request - _args147.Message = message - var _result148 AuroraSchedulerManagerStartJobUpdateResult - if err = p.Client_().Call(ctx, "startJobUpdate", &_args147, &_result148); err != nil { + var _args198 AuroraSchedulerManagerStartJobUpdateArgs + _args198.Request = request + _args198.Message = message + var _result199 AuroraSchedulerManagerStartJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "startJobUpdate", &_args198, &_result199) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result148.GetSuccess(), nil + return _result199.GetSuccess(), nil } // Pauses the specified job update. Can be resumed by resumeUpdate call. @@ -20422,14 +23046,17 @@ func (p *AuroraSchedulerManagerClient) StartJobUpdate(ctx context.Context, reque // - Key: The update to pause. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) PauseJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args149 AuroraSchedulerManagerPauseJobUpdateArgs - _args149.Key = key - _args149.Message = message - var _result150 AuroraSchedulerManagerPauseJobUpdateResult - if err = p.Client_().Call(ctx, "pauseJobUpdate", &_args149, &_result150); err != nil { + var _args200 AuroraSchedulerManagerPauseJobUpdateArgs + _args200.Key = key + _args200.Message = message + var _result201 AuroraSchedulerManagerPauseJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "pauseJobUpdate", &_args200, &_result201) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result150.GetSuccess(), nil + return _result201.GetSuccess(), nil } // Resumes progress of a previously paused job update. @@ -20438,14 +23065,17 @@ func (p *AuroraSchedulerManagerClient) PauseJobUpdate(ctx context.Context, key * // - Key: The update to resume. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) ResumeJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args151 AuroraSchedulerManagerResumeJobUpdateArgs - _args151.Key = key - _args151.Message = message - var _result152 AuroraSchedulerManagerResumeJobUpdateResult - if err = p.Client_().Call(ctx, "resumeJobUpdate", &_args151, &_result152); err != nil { + var _args202 AuroraSchedulerManagerResumeJobUpdateArgs + _args202.Key = key + _args202.Message = message + var _result203 AuroraSchedulerManagerResumeJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "resumeJobUpdate", &_args202, &_result203) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result152.GetSuccess(), nil + return _result203.GetSuccess(), nil } // Permanently aborts the job update. Does not remove the update history. @@ -20454,14 +23084,17 @@ func (p *AuroraSchedulerManagerClient) ResumeJobUpdate(ctx context.Context, key // - Key: The update to abort. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) AbortJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args153 AuroraSchedulerManagerAbortJobUpdateArgs - _args153.Key = key - _args153.Message = message - var _result154 AuroraSchedulerManagerAbortJobUpdateResult - if err = p.Client_().Call(ctx, "abortJobUpdate", &_args153, &_result154); err != nil { + var _args204 AuroraSchedulerManagerAbortJobUpdateArgs + _args204.Key = key + _args204.Message = message + var _result205 AuroraSchedulerManagerAbortJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "abortJobUpdate", &_args204, &_result205) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result154.GetSuccess(), nil + return _result205.GetSuccess(), nil } // Rollbacks the specified active job update to the initial state. @@ -20470,14 +23103,17 @@ func (p *AuroraSchedulerManagerClient) AbortJobUpdate(ctx context.Context, key * // - Key: The update to rollback. // - Message: A user-specified message to include with the induced job update state change. func (p *AuroraSchedulerManagerClient) RollbackJobUpdate(ctx context.Context, key *JobUpdateKey, message string) (r *Response, err error) { - var _args155 AuroraSchedulerManagerRollbackJobUpdateArgs - _args155.Key = key - _args155.Message = message - var _result156 AuroraSchedulerManagerRollbackJobUpdateResult - if err = p.Client_().Call(ctx, "rollbackJobUpdate", &_args155, &_result156); err != nil { + var _args206 AuroraSchedulerManagerRollbackJobUpdateArgs + _args206.Key = key + _args206.Message = message + var _result207 AuroraSchedulerManagerRollbackJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "rollbackJobUpdate", &_args206, &_result207) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result156.GetSuccess(), nil + return _result207.GetSuccess(), nil } // Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in @@ -20487,13 +23123,16 @@ func (p *AuroraSchedulerManagerClient) RollbackJobUpdate(ctx context.Context, ke // Parameters: // - Key func (p *AuroraSchedulerManagerClient) PulseJobUpdate(ctx context.Context, key *JobUpdateKey) (r *Response, err error) { - var _args157 AuroraSchedulerManagerPulseJobUpdateArgs - _args157.Key = key - var _result158 AuroraSchedulerManagerPulseJobUpdateResult - if err = p.Client_().Call(ctx, "pulseJobUpdate", &_args157, &_result158); err != nil { + var _args208 AuroraSchedulerManagerPulseJobUpdateArgs + _args208.Key = key + var _result209 AuroraSchedulerManagerPulseJobUpdateResult + var meta thrift.ResponseMeta + meta, err = p.Client_().Call(ctx, "pulseJobUpdate", &_args208, &_result209) + p.SetLastResponseMeta_(meta) + if err != nil { return } - return _result158.GetSuccess(), nil + return _result209.GetSuccess(), nil } type AuroraSchedulerManagerProcessor struct { @@ -20501,22 +23140,22 @@ type AuroraSchedulerManagerProcessor struct { } func NewAuroraSchedulerManagerProcessor(handler AuroraSchedulerManager) *AuroraSchedulerManagerProcessor { - self159 := &AuroraSchedulerManagerProcessor{NewReadOnlySchedulerProcessor(handler)} - self159.AddToProcessorMap("createJob", &auroraSchedulerManagerProcessorCreateJob{handler:handler}) - self159.AddToProcessorMap("scheduleCronJob", &auroraSchedulerManagerProcessorScheduleCronJob{handler:handler}) - self159.AddToProcessorMap("descheduleCronJob", &auroraSchedulerManagerProcessorDescheduleCronJob{handler:handler}) - self159.AddToProcessorMap("startCronJob", &auroraSchedulerManagerProcessorStartCronJob{handler:handler}) - self159.AddToProcessorMap("restartShards", &auroraSchedulerManagerProcessorRestartShards{handler:handler}) - self159.AddToProcessorMap("killTasks", &auroraSchedulerManagerProcessorKillTasks{handler:handler}) - self159.AddToProcessorMap("addInstances", &auroraSchedulerManagerProcessorAddInstances{handler:handler}) - self159.AddToProcessorMap("replaceCronTemplate", &auroraSchedulerManagerProcessorReplaceCronTemplate{handler:handler}) - self159.AddToProcessorMap("startJobUpdate", &auroraSchedulerManagerProcessorStartJobUpdate{handler:handler}) - self159.AddToProcessorMap("pauseJobUpdate", &auroraSchedulerManagerProcessorPauseJobUpdate{handler:handler}) - self159.AddToProcessorMap("resumeJobUpdate", &auroraSchedulerManagerProcessorResumeJobUpdate{handler:handler}) - self159.AddToProcessorMap("abortJobUpdate", &auroraSchedulerManagerProcessorAbortJobUpdate{handler:handler}) - self159.AddToProcessorMap("rollbackJobUpdate", &auroraSchedulerManagerProcessorRollbackJobUpdate{handler:handler}) - self159.AddToProcessorMap("pulseJobUpdate", &auroraSchedulerManagerProcessorPulseJobUpdate{handler:handler}) - return self159 + self210 := &AuroraSchedulerManagerProcessor{NewReadOnlySchedulerProcessor(handler)} + self210.AddToProcessorMap("createJob", &auroraSchedulerManagerProcessorCreateJob{handler:handler}) + self210.AddToProcessorMap("scheduleCronJob", &auroraSchedulerManagerProcessorScheduleCronJob{handler:handler}) + self210.AddToProcessorMap("descheduleCronJob", &auroraSchedulerManagerProcessorDescheduleCronJob{handler:handler}) + self210.AddToProcessorMap("startCronJob", &auroraSchedulerManagerProcessorStartCronJob{handler:handler}) + self210.AddToProcessorMap("restartShards", &auroraSchedulerManagerProcessorRestartShards{handler:handler}) + self210.AddToProcessorMap("killTasks", &auroraSchedulerManagerProcessorKillTasks{handler:handler}) + self210.AddToProcessorMap("addInstances", &auroraSchedulerManagerProcessorAddInstances{handler:handler}) + self210.AddToProcessorMap("replaceCronTemplate", &auroraSchedulerManagerProcessorReplaceCronTemplate{handler:handler}) + self210.AddToProcessorMap("startJobUpdate", &auroraSchedulerManagerProcessorStartJobUpdate{handler:handler}) + self210.AddToProcessorMap("pauseJobUpdate", &auroraSchedulerManagerProcessorPauseJobUpdate{handler:handler}) + self210.AddToProcessorMap("resumeJobUpdate", &auroraSchedulerManagerProcessorResumeJobUpdate{handler:handler}) + self210.AddToProcessorMap("abortJobUpdate", &auroraSchedulerManagerProcessorAbortJobUpdate{handler:handler}) + self210.AddToProcessorMap("rollbackJobUpdate", &auroraSchedulerManagerProcessorRollbackJobUpdate{handler:handler}) + self210.AddToProcessorMap("pulseJobUpdate", &auroraSchedulerManagerProcessorPulseJobUpdate{handler:handler}) + return self210 } type auroraSchedulerManagerProcessorCreateJob struct { @@ -20525,41 +23164,72 @@ type auroraSchedulerManagerProcessorCreateJob struct { func (p *auroraSchedulerManagerProcessorCreateJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerCreateJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("createJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "createJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerCreateJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.CreateJob(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createJob: " + err2.Error()) - oprot.WriteMessageBegin("createJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "createJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("createJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "createJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20573,41 +23243,72 @@ type auroraSchedulerManagerProcessorScheduleCronJob struct { func (p *auroraSchedulerManagerProcessorScheduleCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerScheduleCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("scheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerScheduleCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ScheduleCronJob(ctx, args.Description); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing scheduleCronJob: " + err2.Error()) - oprot.WriteMessageBegin("scheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("scheduleCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "scheduleCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20621,41 +23322,72 @@ type auroraSchedulerManagerProcessorDescheduleCronJob struct { func (p *auroraSchedulerManagerProcessorDescheduleCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerDescheduleCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("descheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerDescheduleCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DescheduleCronJob(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing descheduleCronJob: " + err2.Error()) - oprot.WriteMessageBegin("descheduleCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("descheduleCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "descheduleCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20669,41 +23401,72 @@ type auroraSchedulerManagerProcessorStartCronJob struct { func (p *auroraSchedulerManagerProcessorStartCronJob) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerStartCronJobArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerStartCronJobResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartCronJob(ctx, args.Job); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startCronJob: " + err2.Error()) - oprot.WriteMessageBegin("startCronJob", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startCronJob", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startCronJob", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startCronJob", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20717,41 +23480,72 @@ type auroraSchedulerManagerProcessorRestartShards struct { func (p *auroraSchedulerManagerProcessorRestartShards) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerRestartShardsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("restartShards", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "restartShards", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerRestartShardsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.RestartShards(ctx, args.Job, args.ShardIds); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing restartShards: " + err2.Error()) - oprot.WriteMessageBegin("restartShards", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "restartShards", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("restartShards", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "restartShards", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20765,41 +23559,72 @@ type auroraSchedulerManagerProcessorKillTasks struct { func (p *auroraSchedulerManagerProcessorKillTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerKillTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("killTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "killTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerKillTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.KillTasks(ctx, args.Job, args.Instances, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing killTasks: " + err2.Error()) - oprot.WriteMessageBegin("killTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "killTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("killTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "killTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20813,41 +23638,72 @@ type auroraSchedulerManagerProcessorAddInstances struct { func (p *auroraSchedulerManagerProcessorAddInstances) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerAddInstancesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("addInstances", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "addInstances", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerAddInstancesResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.AddInstances(ctx, args.Key, args.Count); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing addInstances: " + err2.Error()) - oprot.WriteMessageBegin("addInstances", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "addInstances", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("addInstances", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "addInstances", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20861,41 +23717,72 @@ type auroraSchedulerManagerProcessorReplaceCronTemplate struct { func (p *auroraSchedulerManagerProcessorReplaceCronTemplate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerReplaceCronTemplateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("replaceCronTemplate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerReplaceCronTemplateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ReplaceCronTemplate(ctx, args.Config); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing replaceCronTemplate: " + err2.Error()) - oprot.WriteMessageBegin("replaceCronTemplate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("replaceCronTemplate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "replaceCronTemplate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20909,41 +23796,72 @@ type auroraSchedulerManagerProcessorStartJobUpdate struct { func (p *auroraSchedulerManagerProcessorStartJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerStartJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerStartJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartJobUpdate(ctx, args.Request, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("startJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -20957,41 +23875,72 @@ type auroraSchedulerManagerProcessorPauseJobUpdate struct { func (p *auroraSchedulerManagerProcessorPauseJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerPauseJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pauseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerPauseJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PauseJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pauseJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("pauseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pauseJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pauseJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21005,41 +23954,72 @@ type auroraSchedulerManagerProcessorResumeJobUpdate struct { func (p *auroraSchedulerManagerProcessorResumeJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerResumeJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("resumeJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerResumeJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ResumeJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing resumeJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("resumeJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("resumeJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "resumeJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21053,41 +24033,72 @@ type auroraSchedulerManagerProcessorAbortJobUpdate struct { func (p *auroraSchedulerManagerProcessorAbortJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerAbortJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("abortJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerAbortJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.AbortJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing abortJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("abortJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("abortJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "abortJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21101,41 +24112,72 @@ type auroraSchedulerManagerProcessorRollbackJobUpdate struct { func (p *auroraSchedulerManagerProcessorRollbackJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerRollbackJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("rollbackJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerRollbackJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.RollbackJobUpdate(ctx, args.Key, args.Message); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing rollbackJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("rollbackJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("rollbackJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "rollbackJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21149,41 +24191,72 @@ type auroraSchedulerManagerProcessorPulseJobUpdate struct { func (p *auroraSchedulerManagerProcessorPulseJobUpdate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraSchedulerManagerPulseJobUpdateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pulseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraSchedulerManagerPulseJobUpdateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PulseJobUpdate(ctx, args.Key); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pulseJobUpdate: " + err2.Error()) - oprot.WriteMessageBegin("pulseJobUpdate", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pulseJobUpdate", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pulseJobUpdate", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -21215,14 +24288,14 @@ func (p *AuroraSchedulerManagerCreateJobArgs) IsSetDescription() bool { return p.Description != nil } -func (p *AuroraSchedulerManagerCreateJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21230,57 +24303,57 @@ func (p *AuroraSchedulerManagerCreateJobArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerCreateJobArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("createJob_args"); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "createJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerCreateJobArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *AuroraSchedulerManagerCreateJobArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -21313,14 +24386,14 @@ func (p *AuroraSchedulerManagerCreateJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerCreateJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerCreateJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21328,58 +24401,58 @@ func (p *AuroraSchedulerManagerCreateJobResult) Read(iprot thrift.TProtocol) err switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerCreateJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("createJob_result"); err != nil { +func (p *AuroraSchedulerManagerCreateJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "createJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerCreateJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerCreateJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21413,14 +24486,14 @@ func (p *AuroraSchedulerManagerScheduleCronJobArgs) IsSetDescription() bool { return p.Description != nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21428,57 +24501,57 @@ func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(iprot thrift.TProtocol) switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Description = &JobConfiguration{} - if err := p.Description.Read(iprot); err != nil { + if err := p.Description.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Description), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("scheduleCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "scheduleCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("description", thrift.STRUCT, 1); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "description", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) } - if err := p.Description.Write(oprot); err != nil { + if err := p.Description.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) } return err } @@ -21511,14 +24584,14 @@ func (p *AuroraSchedulerManagerScheduleCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21526,58 +24599,58 @@ func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(iprot thrift.TProtoco switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerScheduleCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("scheduleCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerScheduleCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "scheduleCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerScheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerScheduleCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21612,14 +24685,14 @@ func (p *AuroraSchedulerManagerDescheduleCronJobArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21627,57 +24700,57 @@ func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(iprot thrift.TProtoco switch fieldId { case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) ReadField4(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("descheduleCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "descheduleCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 4); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) } return err } @@ -21710,14 +24783,14 @@ func (p *AuroraSchedulerManagerDescheduleCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21725,58 +24798,58 @@ func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(iprot thrift.TProto switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("descheduleCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "descheduleCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerDescheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerDescheduleCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -21811,14 +24884,14 @@ func (p *AuroraSchedulerManagerStartCronJobArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21826,57 +24899,57 @@ func (p *AuroraSchedulerManagerStartCronJobArgs) Read(iprot thrift.TProtocol) er switch fieldId { case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) ReadField4(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerStartCronJobArgs) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startCronJob_args"); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startCronJob_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 4); err != nil { +func (p *AuroraSchedulerManagerStartCronJobArgs) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "job", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) } - if err := p.Job.Write(oprot); err != nil { + if err := p.Job.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) } return err } @@ -21909,14 +24982,14 @@ func (p *AuroraSchedulerManagerStartCronJobResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraSchedulerManagerStartCronJobResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerStartCronJobResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -21924,58 +24997,58 @@ func (p *AuroraSchedulerManagerStartCronJobResult) Read(iprot thrift.TProtocol) switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerStartCronJobResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startCronJob_result"); err != nil { +func (p *AuroraSchedulerManagerStartCronJobResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startCronJob_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerStartCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraSchedulerManagerStartCronJobResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -22017,14 +25090,14 @@ func (p *AuroraSchedulerManagerRestartShardsArgs) IsSetJob() bool { return p.Job != nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -22032,115 +25105,118 @@ func (p *AuroraSchedulerManagerRestartShardsArgs) Read(iprot thrift.TProtocol) e switch fieldId { case 5: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.SET { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField5(iprot thrift.TProtocol) error { +func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { p.Job = &JobKey{} - if err := p.Job.Read(iprot); err != nil { + if err := p.Job.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() +func (p *AuroraSchedulerManagerRestartShardsArgs) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin(ctx) if err != nil { return thrift.PrependError("error reading set begin: ", err) } tSet := make([]int32, 0, size) p.ShardIds = tSet for i := 0; i < size; i ++ { -var _elem160 int32 - if v, err := iprot.ReadI32(); err != nil { +var _elem211 int32 + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem160 = v + _elem211 = v } - p.ShardIds = append(p.ShardIds, _elem160) + p.ShardIds = append(p.ShardIds, _elem211) } - if err := iprot.ReadSetEnd(); err != nil { + if err := iprot.ReadSetEnd(ctx); err != nil { return thrift.PrependError("error reading set end: ", err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("restartShards_args"); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "restartShards_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraSchedulerManagerRestartShardsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("shardIds", thrift.SET, 3); err != nil { +func (p *AuroraSchedulerManagerRestartShardsArgs) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "shardIds", thrift.SET, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:shardIds: ", p), err) } - if err := oprot.WriteSetBegin(thrift.I32, len(p.ShardIds)); err != nil { + if err := oprot.WriteSetBegin(ctx, thrift.I32, len(p.ShardIds)); err != nil { return thrift.PrependError("error writing set begin: ", err) } for i := 0; i 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSetQuotaResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.SetQuota(ctx, args.OwnerRole, args.Quota); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setQuota: " + err2.Error()) - oprot.WriteMessageBegin("setQuota", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "setQuota", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("setQuota", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "setQuota", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24784,41 +27948,72 @@ type auroraAdminProcessorForceTaskState struct { func (p *auroraAdminProcessorForceTaskState) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminForceTaskStateArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("forceTaskState", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminForceTaskStateResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ForceTaskState(ctx, args.TaskId, args.Status); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing forceTaskState: " + err2.Error()) - oprot.WriteMessageBegin("forceTaskState", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("forceTaskState", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "forceTaskState", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24832,41 +28027,72 @@ type auroraAdminProcessorPerformBackup struct { func (p *auroraAdminProcessorPerformBackup) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminPerformBackupArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("performBackup", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "performBackup", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminPerformBackupResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PerformBackup(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing performBackup: " + err2.Error()) - oprot.WriteMessageBegin("performBackup", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "performBackup", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("performBackup", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "performBackup", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24880,41 +28106,72 @@ type auroraAdminProcessorListBackups struct { func (p *auroraAdminProcessorListBackups) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminListBackupsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("listBackups", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "listBackups", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminListBackupsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.ListBackups(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing listBackups: " + err2.Error()) - oprot.WriteMessageBegin("listBackups", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "listBackups", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("listBackups", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "listBackups", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24928,41 +28185,72 @@ type auroraAdminProcessorStageRecovery struct { func (p *auroraAdminProcessorStageRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminStageRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("stageRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminStageRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StageRecovery(ctx, args.BackupId); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing stageRecovery: " + err2.Error()) - oprot.WriteMessageBegin("stageRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("stageRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "stageRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -24976,41 +28264,72 @@ type auroraAdminProcessorQueryRecovery struct { func (p *auroraAdminProcessorQueryRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminQueryRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("queryRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminQueryRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.QueryRecovery(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing queryRecovery: " + err2.Error()) - oprot.WriteMessageBegin("queryRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("queryRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "queryRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25024,41 +28343,72 @@ type auroraAdminProcessorDeleteRecoveryTasks struct { func (p *auroraAdminProcessorDeleteRecoveryTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminDeleteRecoveryTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminDeleteRecoveryTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DeleteRecoveryTasks(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteRecoveryTasks: " + err2.Error()) - oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "deleteRecoveryTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25072,41 +28422,72 @@ type auroraAdminProcessorCommitRecovery struct { func (p *auroraAdminProcessorCommitRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminCommitRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("commitRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminCommitRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.CommitRecovery(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing commitRecovery: " + err2.Error()) - oprot.WriteMessageBegin("commitRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("commitRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "commitRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25120,41 +28501,72 @@ type auroraAdminProcessorUnloadRecovery struct { func (p *auroraAdminProcessorUnloadRecovery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminUnloadRecoveryArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("unloadRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminUnloadRecoveryResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.UnloadRecovery(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing unloadRecovery: " + err2.Error()) - oprot.WriteMessageBegin("unloadRecovery", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("unloadRecovery", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "unloadRecovery", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25168,41 +28580,72 @@ type auroraAdminProcessorStartMaintenance struct { func (p *auroraAdminProcessorStartMaintenance) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminStartMaintenanceArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("startMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminStartMaintenanceResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.StartMaintenance(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startMaintenance: " + err2.Error()) - oprot.WriteMessageBegin("startMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("startMaintenance", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "startMaintenance", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25216,41 +28659,72 @@ type auroraAdminProcessorDrainHosts struct { func (p *auroraAdminProcessorDrainHosts) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminDrainHostsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("drainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "drainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminDrainHostsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.DrainHosts(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing drainHosts: " + err2.Error()) - oprot.WriteMessageBegin("drainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "drainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("drainHosts", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "drainHosts", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25264,41 +28738,72 @@ type auroraAdminProcessorMaintenanceStatus struct { func (p *auroraAdminProcessorMaintenanceStatus) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminMaintenanceStatusArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("maintenanceStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminMaintenanceStatusResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.MaintenanceStatus(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing maintenanceStatus: " + err2.Error()) - oprot.WriteMessageBegin("maintenanceStatus", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("maintenanceStatus", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "maintenanceStatus", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25312,41 +28817,72 @@ type auroraAdminProcessorEndMaintenance struct { func (p *auroraAdminProcessorEndMaintenance) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminEndMaintenanceArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("endMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminEndMaintenanceResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.EndMaintenance(ctx, args.Hosts); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing endMaintenance: " + err2.Error()) - oprot.WriteMessageBegin("endMaintenance", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("endMaintenance", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "endMaintenance", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25360,41 +28896,72 @@ type auroraAdminProcessorSlaDrainHosts struct { func (p *auroraAdminProcessorSlaDrainHosts) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminSlaDrainHostsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("slaDrainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSlaDrainHostsResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.SlaDrainHosts(ctx, args.Hosts, args.DefaultSlaPolicy, args.TimeoutSecs); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing slaDrainHosts: " + err2.Error()) - oprot.WriteMessageBegin("slaDrainHosts", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("slaDrainHosts", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "slaDrainHosts", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25408,41 +28975,72 @@ type auroraAdminProcessorSnapshot struct { func (p *auroraAdminProcessorSnapshot) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminSnapshotArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("snapshot", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "snapshot", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminSnapshotResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.Snapshot(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing snapshot: " + err2.Error()) - oprot.WriteMessageBegin("snapshot", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "snapshot", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("snapshot", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "snapshot", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25456,41 +29054,72 @@ type auroraAdminProcessorTriggerExplicitTaskReconciliation struct { func (p *auroraAdminProcessorTriggerExplicitTaskReconciliation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminTriggerExplicitTaskReconciliationArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminTriggerExplicitTaskReconciliationResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.TriggerExplicitTaskReconciliation(ctx, args.Settings); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing triggerExplicitTaskReconciliation: " + err2.Error()) - oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("triggerExplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "triggerExplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25504,41 +29133,72 @@ type auroraAdminProcessorTriggerImplicitTaskReconciliation struct { func (p *auroraAdminProcessorTriggerImplicitTaskReconciliation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminTriggerImplicitTaskReconciliationArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminTriggerImplicitTaskReconciliationResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.TriggerImplicitTaskReconciliation(ctx); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing triggerImplicitTaskReconciliation: " + err2.Error()) - oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("triggerImplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "triggerImplicitTaskReconciliation", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25552,41 +29212,72 @@ type auroraAdminProcessorPruneTasks struct { func (p *auroraAdminProcessorPruneTasks) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AuroraAdminPruneTasksArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("pruneTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := AuroraAdminPruneTasksResult{} -var retval *Response - var err2 error + var retval *Response if retval, err2 = p.handler.PruneTasks(ctx, args.Query); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pruneTasks: " + err2.Error()) - oprot.WriteMessageBegin("pruneTasks", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("pruneTasks", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "pruneTasks", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -25624,14 +29315,14 @@ func (p *AuroraAdminSetQuotaArgs) IsSetQuota() bool { return p.Quota != nil } -func (p *AuroraAdminSetQuotaArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSetQuotaArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25639,41 +29330,41 @@ func (p *AuroraAdminSetQuotaArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminSetQuotaArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.OwnerRole = v @@ -25681,45 +29372,45 @@ func (p *AuroraAdminSetQuotaArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *AuroraAdminSetQuotaArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *AuroraAdminSetQuotaArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.Quota = &ResourceAggregate{} - if err := p.Quota.Read(iprot); err != nil { + if err := p.Quota.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Quota), err) } return nil } -func (p *AuroraAdminSetQuotaArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setQuota_args"); err != nil { +func (p *AuroraAdminSetQuotaArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "setQuota_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSetQuotaArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ownerRole", thrift.STRING, 1); err != nil { +func (p *AuroraAdminSetQuotaArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ownerRole", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) } - if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + if err := oprot.WriteString(ctx, string(p.OwnerRole)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) } return err } -func (p *AuroraAdminSetQuotaArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("quota", thrift.STRUCT, 2); err != nil { +func (p *AuroraAdminSetQuotaArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "quota", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:quota: ", p), err) } - if err := p.Quota.Write(oprot); err != nil { + if err := p.Quota.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:quota: ", p), err) } return err } @@ -25752,14 +29443,14 @@ func (p *AuroraAdminSetQuotaResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSetQuotaResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSetQuotaResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25767,58 +29458,58 @@ func (p *AuroraAdminSetQuotaResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSetQuotaResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSetQuotaResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSetQuotaResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setQuota_result"); err != nil { +func (p *AuroraAdminSetQuotaResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "setQuota_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSetQuotaResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -25851,14 +29542,14 @@ func (p *AuroraAdminForceTaskStateArgs) GetTaskId() string { func (p *AuroraAdminForceTaskStateArgs) GetStatus() ScheduleStatus { return p.Status } -func (p *AuroraAdminForceTaskStateArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25866,41 +29557,41 @@ func (p *AuroraAdminForceTaskStateArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminForceTaskStateArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TaskId = v @@ -25908,8 +29599,8 @@ func (p *AuroraAdminForceTaskStateArgs) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *AuroraAdminForceTaskStateArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *AuroraAdminForceTaskStateArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := ScheduleStatus(v) @@ -25918,36 +29609,36 @@ func (p *AuroraAdminForceTaskStateArgs) ReadField2(iprot thrift.TProtocol) erro return nil } -func (p *AuroraAdminForceTaskStateArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("forceTaskState_args"); err != nil { +func (p *AuroraAdminForceTaskStateArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "forceTaskState_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminForceTaskStateArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("taskId", thrift.STRING, 1); err != nil { +func (p *AuroraAdminForceTaskStateArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "taskId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) } - if err := oprot.WriteString(string(p.TaskId)); err != nil { + if err := oprot.WriteString(ctx, string(p.TaskId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:taskId: ", p), err) } return err } -func (p *AuroraAdminForceTaskStateArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil { +func (p *AuroraAdminForceTaskStateArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "status", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) } - if err := oprot.WriteI32(int32(p.Status)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Status)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) } return err } @@ -25980,14 +29671,14 @@ func (p *AuroraAdminForceTaskStateResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminForceTaskStateResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminForceTaskStateResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -25995,58 +29686,58 @@ func (p *AuroraAdminForceTaskStateResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminForceTaskStateResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminForceTaskStateResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminForceTaskStateResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("forceTaskState_result"); err != nil { +func (p *AuroraAdminForceTaskStateResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "forceTaskState_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminForceTaskStateResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminForceTaskStateResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26066,39 +29757,39 @@ func NewAuroraAdminPerformBackupArgs() *AuroraAdminPerformBackupArgs { return &AuroraAdminPerformBackupArgs{} } -func (p *AuroraAdminPerformBackupArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPerformBackupArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPerformBackupArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("performBackup_args"); err != nil { +func (p *AuroraAdminPerformBackupArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "performBackup_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -26131,14 +29822,14 @@ func (p *AuroraAdminPerformBackupResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminPerformBackupResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPerformBackupResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26146,58 +29837,58 @@ func (p *AuroraAdminPerformBackupResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPerformBackupResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminPerformBackupResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminPerformBackupResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("performBackup_result"); err != nil { +func (p *AuroraAdminPerformBackupResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "performBackup_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPerformBackupResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminPerformBackupResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26217,39 +29908,39 @@ func NewAuroraAdminListBackupsArgs() *AuroraAdminListBackupsArgs { return &AuroraAdminListBackupsArgs{} } -func (p *AuroraAdminListBackupsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminListBackupsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminListBackupsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("listBackups_args"); err != nil { +func (p *AuroraAdminListBackupsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "listBackups_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -26282,14 +29973,14 @@ func (p *AuroraAdminListBackupsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminListBackupsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminListBackupsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26297,58 +29988,58 @@ func (p *AuroraAdminListBackupsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminListBackupsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminListBackupsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminListBackupsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("listBackups_result"); err != nil { +func (p *AuroraAdminListBackupsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "listBackups_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminListBackupsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminListBackupsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26375,14 +30066,14 @@ func NewAuroraAdminStageRecoveryArgs() *AuroraAdminStageRecoveryArgs { func (p *AuroraAdminStageRecoveryArgs) GetBackupId() string { return p.BackupId } -func (p *AuroraAdminStageRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStageRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26390,31 +30081,31 @@ func (p *AuroraAdminStageRecoveryArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStageRecoveryArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *AuroraAdminStageRecoveryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.BackupId = v @@ -26422,25 +30113,25 @@ func (p *AuroraAdminStageRecoveryArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *AuroraAdminStageRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("stageRecovery_args"); err != nil { +func (p *AuroraAdminStageRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "stageRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStageRecoveryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("backupId", thrift.STRING, 1); err != nil { +func (p *AuroraAdminStageRecoveryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "backupId", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:backupId: ", p), err) } - if err := oprot.WriteString(string(p.BackupId)); err != nil { + if err := oprot.WriteString(ctx, string(p.BackupId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.backupId (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:backupId: ", p), err) } return err } @@ -26473,14 +30164,14 @@ func (p *AuroraAdminStageRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminStageRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStageRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26488,58 +30179,58 @@ func (p *AuroraAdminStageRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStageRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminStageRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminStageRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("stageRecovery_result"); err != nil { +func (p *AuroraAdminStageRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "stageRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStageRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminStageRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26573,14 +30264,14 @@ func (p *AuroraAdminQueryRecoveryArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminQueryRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26588,57 +30279,57 @@ func (p *AuroraAdminQueryRecoveryArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminQueryRecoveryArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("queryRecovery_args"); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "queryRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminQueryRecoveryArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminQueryRecoveryArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -26671,14 +30362,14 @@ func (p *AuroraAdminQueryRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminQueryRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminQueryRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26686,58 +30377,58 @@ func (p *AuroraAdminQueryRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminQueryRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("queryRecovery_result"); err != nil { +func (p *AuroraAdminQueryRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "queryRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminQueryRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminQueryRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26771,14 +30462,14 @@ func (p *AuroraAdminDeleteRecoveryTasksArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26786,57 +30477,57 @@ func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(iprot thrift.TProtocol) error switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminDeleteRecoveryTasksArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deleteRecoveryTasks_args"); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deleteRecoveryTasks_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -26869,14 +30560,14 @@ func (p *AuroraAdminDeleteRecoveryTasksResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -26884,58 +30575,58 @@ func (p *AuroraAdminDeleteRecoveryTasksResult) Read(iprot thrift.TProtocol) erro switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminDeleteRecoveryTasksResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("deleteRecoveryTasks_result"); err != nil { +func (p *AuroraAdminDeleteRecoveryTasksResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "deleteRecoveryTasks_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDeleteRecoveryTasksResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminDeleteRecoveryTasksResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -26955,39 +30646,39 @@ func NewAuroraAdminCommitRecoveryArgs() *AuroraAdminCommitRecoveryArgs { return &AuroraAdminCommitRecoveryArgs{} } -func (p *AuroraAdminCommitRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminCommitRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminCommitRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("commitRecovery_args"); err != nil { +func (p *AuroraAdminCommitRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "commitRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -27020,14 +30711,14 @@ func (p *AuroraAdminCommitRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminCommitRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminCommitRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27035,58 +30726,58 @@ func (p *AuroraAdminCommitRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminCommitRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("commitRecovery_result"); err != nil { +func (p *AuroraAdminCommitRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "commitRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminCommitRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminCommitRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27106,39 +30797,39 @@ func NewAuroraAdminUnloadRecoveryArgs() *AuroraAdminUnloadRecoveryArgs { return &AuroraAdminUnloadRecoveryArgs{} } -func (p *AuroraAdminUnloadRecoveryArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminUnloadRecoveryArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminUnloadRecoveryArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("unloadRecovery_args"); err != nil { +func (p *AuroraAdminUnloadRecoveryArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "unloadRecovery_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -27171,14 +30862,14 @@ func (p *AuroraAdminUnloadRecoveryResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminUnloadRecoveryResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminUnloadRecoveryResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27186,58 +30877,58 @@ func (p *AuroraAdminUnloadRecoveryResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminUnloadRecoveryResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("unloadRecovery_result"); err != nil { +func (p *AuroraAdminUnloadRecoveryResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "unloadRecovery_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminUnloadRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminUnloadRecoveryResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27271,14 +30962,14 @@ func (p *AuroraAdminStartMaintenanceArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminStartMaintenanceArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27286,57 +30977,57 @@ func (p *AuroraAdminStartMaintenanceArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminStartMaintenanceArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startMaintenance_args"); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startMaintenance_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStartMaintenanceArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminStartMaintenanceArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27369,14 +31060,14 @@ func (p *AuroraAdminStartMaintenanceResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminStartMaintenanceResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminStartMaintenanceResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27384,58 +31075,58 @@ func (p *AuroraAdminStartMaintenanceResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminStartMaintenanceResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("startMaintenance_result"); err != nil { +func (p *AuroraAdminStartMaintenanceResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "startMaintenance_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminStartMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminStartMaintenanceResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27469,14 +31160,14 @@ func (p *AuroraAdminDrainHostsArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminDrainHostsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDrainHostsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27484,57 +31175,57 @@ func (p *AuroraAdminDrainHostsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDrainHostsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminDrainHostsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminDrainHostsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("drainHosts_args"); err != nil { +func (p *AuroraAdminDrainHostsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "drainHosts_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDrainHostsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminDrainHostsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27567,14 +31258,14 @@ func (p *AuroraAdminDrainHostsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminDrainHostsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminDrainHostsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27582,58 +31273,58 @@ func (p *AuroraAdminDrainHostsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminDrainHostsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminDrainHostsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminDrainHostsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("drainHosts_result"); err != nil { +func (p *AuroraAdminDrainHostsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "drainHosts_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminDrainHostsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminDrainHostsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27667,14 +31358,14 @@ func (p *AuroraAdminMaintenanceStatusArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminMaintenanceStatusArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27682,57 +31373,57 @@ func (p *AuroraAdminMaintenanceStatusArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminMaintenanceStatusArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("maintenanceStatus_args"); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "maintenanceStatus_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminMaintenanceStatusArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminMaintenanceStatusArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27765,14 +31456,14 @@ func (p *AuroraAdminMaintenanceStatusResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminMaintenanceStatusResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminMaintenanceStatusResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27780,58 +31471,58 @@ func (p *AuroraAdminMaintenanceStatusResult) Read(iprot thrift.TProtocol) error switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminMaintenanceStatusResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("maintenanceStatus_result"); err != nil { +func (p *AuroraAdminMaintenanceStatusResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "maintenanceStatus_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminMaintenanceStatusResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminMaintenanceStatusResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -27865,14 +31556,14 @@ func (p *AuroraAdminEndMaintenanceArgs) IsSetHosts() bool { return p.Hosts != nil } -func (p *AuroraAdminEndMaintenanceArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27880,57 +31571,57 @@ func (p *AuroraAdminEndMaintenanceArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminEndMaintenanceArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("endMaintenance_args"); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "endMaintenance_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminEndMaintenanceArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminEndMaintenanceArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } @@ -27963,14 +31654,14 @@ func (p *AuroraAdminEndMaintenanceResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminEndMaintenanceResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminEndMaintenanceResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -27978,58 +31669,58 @@ func (p *AuroraAdminEndMaintenanceResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminEndMaintenanceResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("endMaintenance_result"); err != nil { +func (p *AuroraAdminEndMaintenanceResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "endMaintenance_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminEndMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminEndMaintenanceResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28082,14 +31773,14 @@ func (p *AuroraAdminSlaDrainHostsArgs) IsSetDefaultSlaPolicy() bool { return p.DefaultSlaPolicy != nil } -func (p *AuroraAdminSlaDrainHostsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28097,67 +31788,67 @@ func (p *AuroraAdminSlaDrainHostsArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Hosts = &Hosts{} - if err := p.Hosts.Read(iprot); err != nil { + if err := p.Hosts.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hosts), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField2(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.DefaultSlaPolicy = &SlaPolicy{} - if err := p.DefaultSlaPolicy.Read(iprot); err != nil { + if err := p.DefaultSlaPolicy.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DefaultSlaPolicy), err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.TimeoutSecs = v @@ -28165,49 +31856,49 @@ func (p *AuroraAdminSlaDrainHostsArgs) ReadField3(iprot thrift.TProtocol) error return nil } -func (p *AuroraAdminSlaDrainHostsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("slaDrainHosts_args"); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "slaDrainHosts_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSlaDrainHostsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("hosts", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "hosts", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) } - if err := p.Hosts.Write(oprot); err != nil { + if err := p.Hosts.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) } return err } -func (p *AuroraAdminSlaDrainHostsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSlaPolicy", thrift.STRUCT, 2); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultSlaPolicy", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultSlaPolicy: ", p), err) } - if err := p.DefaultSlaPolicy.Write(oprot); err != nil { + if err := p.DefaultSlaPolicy.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DefaultSlaPolicy), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultSlaPolicy: ", p), err) } return err } -func (p *AuroraAdminSlaDrainHostsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timeoutSecs", thrift.I64, 3); err != nil { +func (p *AuroraAdminSlaDrainHostsArgs) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timeoutSecs", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:timeoutSecs: ", p), err) } - if err := oprot.WriteI64(int64(p.TimeoutSecs)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TimeoutSecs)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timeoutSecs (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:timeoutSecs: ", p), err) } return err } @@ -28240,14 +31931,14 @@ func (p *AuroraAdminSlaDrainHostsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSlaDrainHostsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSlaDrainHostsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28255,58 +31946,58 @@ func (p *AuroraAdminSlaDrainHostsResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSlaDrainHostsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("slaDrainHosts_result"); err != nil { +func (p *AuroraAdminSlaDrainHostsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "slaDrainHosts_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSlaDrainHostsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSlaDrainHostsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28326,39 +32017,39 @@ func NewAuroraAdminSnapshotArgs() *AuroraAdminSnapshotArgs { return &AuroraAdminSnapshotArgs{} } -func (p *AuroraAdminSnapshotArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSnapshotArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSnapshotArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("snapshot_args"); err != nil { +func (p *AuroraAdminSnapshotArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "snapshot_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -28391,14 +32082,14 @@ func (p *AuroraAdminSnapshotResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminSnapshotResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminSnapshotResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28406,58 +32097,58 @@ func (p *AuroraAdminSnapshotResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminSnapshotResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminSnapshotResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminSnapshotResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("snapshot_result"); err != nil { +func (p *AuroraAdminSnapshotResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "snapshot_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminSnapshotResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminSnapshotResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28491,14 +32182,14 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) IsSetSettings() bool return p.Settings != nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28506,57 +32197,57 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Read(iprot thrift.TPr switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Settings = &ExplicitReconciliationSettings{} - if err := p.Settings.Read(iprot); err != nil { + if err := p.Settings.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerExplicitTaskReconciliation_args"); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerExplicitTaskReconciliation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("settings", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "settings", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:settings: ", p), err) } - if err := p.Settings.Write(oprot); err != nil { + if err := p.Settings.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:settings: ", p), err) } return err } @@ -28589,14 +32280,14 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) IsSetSuccess() bool return p.Success != nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28604,58 +32295,58 @@ func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Read(iprot thrift.T switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerExplicitTaskReconciliation_result"); err != nil { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerExplicitTaskReconciliation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminTriggerExplicitTaskReconciliationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28675,39 +32366,39 @@ func NewAuroraAdminTriggerImplicitTaskReconciliationArgs() *AuroraAdminTriggerIm return &AuroraAdminTriggerImplicitTaskReconciliationArgs{} } -func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } if fieldTypeId == thrift.STOP { break; } - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerImplicitTaskReconciliation_args"); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerImplicitTaskReconciliation_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } @@ -28740,14 +32431,14 @@ func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) IsSetSuccess() bool return p.Success != nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28755,58 +32446,58 @@ func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Read(iprot thrift.T switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("triggerImplicitTaskReconciliation_result"); err != nil { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "triggerImplicitTaskReconciliation_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminTriggerImplicitTaskReconciliationResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err @@ -28840,14 +32531,14 @@ func (p *AuroraAdminPruneTasksArgs) IsSetQuery() bool { return p.Query != nil } -func (p *AuroraAdminPruneTasksArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPruneTasksArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28855,57 +32546,57 @@ func (p *AuroraAdminPruneTasksArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPruneTasksArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AuroraAdminPruneTasksArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Query = &TaskQuery{} - if err := p.Query.Read(iprot); err != nil { + if err := p.Query.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err) } return nil } -func (p *AuroraAdminPruneTasksArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("pruneTasks_args"); err != nil { +func (p *AuroraAdminPruneTasksArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "pruneTasks_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPruneTasksArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil { +func (p *AuroraAdminPruneTasksArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "query", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) } - if err := p.Query.Write(oprot); err != nil { + if err := p.Query.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) } return err } @@ -28938,14 +32629,14 @@ func (p *AuroraAdminPruneTasksResult) IsSetSuccess() bool { return p.Success != nil } -func (p *AuroraAdminPruneTasksResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AuroraAdminPruneTasksResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -28953,58 +32644,58 @@ func (p *AuroraAdminPruneTasksResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AuroraAdminPruneTasksResult) ReadField0(iprot thrift.TProtocol) error { +func (p *AuroraAdminPruneTasksResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &Response{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *AuroraAdminPruneTasksResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("pruneTasks_result"); err != nil { +func (p *AuroraAdminPruneTasksResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "pruneTasks_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AuroraAdminPruneTasksResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *AuroraAdminPruneTasksResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err diff --git a/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go b/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go index b600061..d2d4441 100755 --- a/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go +++ b/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -195,19 +195,19 @@ func main() { } argvalue0 := flag.Arg(1) value0 := argvalue0 - arg354 := flag.Arg(2) - mbTrans355 := thrift.NewTMemoryBufferLen(len(arg354)) - defer mbTrans355.Close() - _, err356 := mbTrans355.WriteString(arg354) - if err356 != nil { + arg405 := flag.Arg(2) + mbTrans406 := thrift.NewTMemoryBufferLen(len(arg405)) + defer mbTrans406.Close() + _, err407 := mbTrans406.WriteString(arg405) + if err407 != nil { Usage() return } - factory357 := thrift.NewTJSONProtocolFactory() - jsProt358 := factory357.GetProtocol(mbTrans355) + factory408 := thrift.NewTJSONProtocolFactory() + jsProt409 := factory408.GetProtocol(mbTrans406) argvalue1 := aurora.NewResourceAggregate() - err359 := argvalue1.Read(jsProt358) - if err359 != nil { + err410 := argvalue1.Read(context.Background(), jsProt409) + if err410 != nil { Usage() return } @@ -263,19 +263,19 @@ func main() { fmt.Fprintln(os.Stderr, "QueryRecovery requires 1 args") flag.Usage() } - arg362 := flag.Arg(1) - mbTrans363 := thrift.NewTMemoryBufferLen(len(arg362)) - defer mbTrans363.Close() - _, err364 := mbTrans363.WriteString(arg362) - if err364 != nil { + arg413 := flag.Arg(1) + mbTrans414 := thrift.NewTMemoryBufferLen(len(arg413)) + defer mbTrans414.Close() + _, err415 := mbTrans414.WriteString(arg413) + if err415 != nil { Usage() return } - factory365 := thrift.NewTJSONProtocolFactory() - jsProt366 := factory365.GetProtocol(mbTrans363) + factory416 := thrift.NewTJSONProtocolFactory() + jsProt417 := factory416.GetProtocol(mbTrans414) argvalue0 := aurora.NewTaskQuery() - err367 := argvalue0.Read(jsProt366) - if err367 != nil { + err418 := argvalue0.Read(context.Background(), jsProt417) + if err418 != nil { Usage() return } @@ -288,19 +288,19 @@ func main() { fmt.Fprintln(os.Stderr, "DeleteRecoveryTasks requires 1 args") flag.Usage() } - arg368 := flag.Arg(1) - mbTrans369 := thrift.NewTMemoryBufferLen(len(arg368)) - defer mbTrans369.Close() - _, err370 := mbTrans369.WriteString(arg368) - if err370 != nil { + arg419 := flag.Arg(1) + mbTrans420 := thrift.NewTMemoryBufferLen(len(arg419)) + defer mbTrans420.Close() + _, err421 := mbTrans420.WriteString(arg419) + if err421 != nil { Usage() return } - factory371 := thrift.NewTJSONProtocolFactory() - jsProt372 := factory371.GetProtocol(mbTrans369) + factory422 := thrift.NewTJSONProtocolFactory() + jsProt423 := factory422.GetProtocol(mbTrans420) argvalue0 := aurora.NewTaskQuery() - err373 := argvalue0.Read(jsProt372) - if err373 != nil { + err424 := argvalue0.Read(context.Background(), jsProt423) + if err424 != nil { Usage() return } @@ -329,19 +329,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartMaintenance requires 1 args") flag.Usage() } - arg374 := flag.Arg(1) - mbTrans375 := thrift.NewTMemoryBufferLen(len(arg374)) - defer mbTrans375.Close() - _, err376 := mbTrans375.WriteString(arg374) - if err376 != nil { + arg425 := flag.Arg(1) + mbTrans426 := thrift.NewTMemoryBufferLen(len(arg425)) + defer mbTrans426.Close() + _, err427 := mbTrans426.WriteString(arg425) + if err427 != nil { Usage() return } - factory377 := thrift.NewTJSONProtocolFactory() - jsProt378 := factory377.GetProtocol(mbTrans375) + factory428 := thrift.NewTJSONProtocolFactory() + jsProt429 := factory428.GetProtocol(mbTrans426) argvalue0 := aurora.NewHosts() - err379 := argvalue0.Read(jsProt378) - if err379 != nil { + err430 := argvalue0.Read(context.Background(), jsProt429) + if err430 != nil { Usage() return } @@ -354,19 +354,19 @@ func main() { fmt.Fprintln(os.Stderr, "DrainHosts requires 1 args") flag.Usage() } - arg380 := flag.Arg(1) - mbTrans381 := thrift.NewTMemoryBufferLen(len(arg380)) - defer mbTrans381.Close() - _, err382 := mbTrans381.WriteString(arg380) - if err382 != nil { + arg431 := flag.Arg(1) + mbTrans432 := thrift.NewTMemoryBufferLen(len(arg431)) + defer mbTrans432.Close() + _, err433 := mbTrans432.WriteString(arg431) + if err433 != nil { Usage() return } - factory383 := thrift.NewTJSONProtocolFactory() - jsProt384 := factory383.GetProtocol(mbTrans381) + factory434 := thrift.NewTJSONProtocolFactory() + jsProt435 := factory434.GetProtocol(mbTrans432) argvalue0 := aurora.NewHosts() - err385 := argvalue0.Read(jsProt384) - if err385 != nil { + err436 := argvalue0.Read(context.Background(), jsProt435) + if err436 != nil { Usage() return } @@ -379,19 +379,19 @@ func main() { fmt.Fprintln(os.Stderr, "MaintenanceStatus requires 1 args") flag.Usage() } - arg386 := flag.Arg(1) - mbTrans387 := thrift.NewTMemoryBufferLen(len(arg386)) - defer mbTrans387.Close() - _, err388 := mbTrans387.WriteString(arg386) - if err388 != nil { + arg437 := flag.Arg(1) + mbTrans438 := thrift.NewTMemoryBufferLen(len(arg437)) + defer mbTrans438.Close() + _, err439 := mbTrans438.WriteString(arg437) + if err439 != nil { Usage() return } - factory389 := thrift.NewTJSONProtocolFactory() - jsProt390 := factory389.GetProtocol(mbTrans387) + factory440 := thrift.NewTJSONProtocolFactory() + jsProt441 := factory440.GetProtocol(mbTrans438) argvalue0 := aurora.NewHosts() - err391 := argvalue0.Read(jsProt390) - if err391 != nil { + err442 := argvalue0.Read(context.Background(), jsProt441) + if err442 != nil { Usage() return } @@ -404,19 +404,19 @@ func main() { fmt.Fprintln(os.Stderr, "EndMaintenance requires 1 args") flag.Usage() } - arg392 := flag.Arg(1) - mbTrans393 := thrift.NewTMemoryBufferLen(len(arg392)) - defer mbTrans393.Close() - _, err394 := mbTrans393.WriteString(arg392) - if err394 != nil { + arg443 := flag.Arg(1) + mbTrans444 := thrift.NewTMemoryBufferLen(len(arg443)) + defer mbTrans444.Close() + _, err445 := mbTrans444.WriteString(arg443) + if err445 != nil { Usage() return } - factory395 := thrift.NewTJSONProtocolFactory() - jsProt396 := factory395.GetProtocol(mbTrans393) + factory446 := thrift.NewTJSONProtocolFactory() + jsProt447 := factory446.GetProtocol(mbTrans444) argvalue0 := aurora.NewHosts() - err397 := argvalue0.Read(jsProt396) - if err397 != nil { + err448 := argvalue0.Read(context.Background(), jsProt447) + if err448 != nil { Usage() return } @@ -429,42 +429,42 @@ func main() { fmt.Fprintln(os.Stderr, "SlaDrainHosts requires 3 args") flag.Usage() } - arg398 := flag.Arg(1) - mbTrans399 := thrift.NewTMemoryBufferLen(len(arg398)) - defer mbTrans399.Close() - _, err400 := mbTrans399.WriteString(arg398) - if err400 != nil { + arg449 := flag.Arg(1) + mbTrans450 := thrift.NewTMemoryBufferLen(len(arg449)) + defer mbTrans450.Close() + _, err451 := mbTrans450.WriteString(arg449) + if err451 != nil { Usage() return } - factory401 := thrift.NewTJSONProtocolFactory() - jsProt402 := factory401.GetProtocol(mbTrans399) + factory452 := thrift.NewTJSONProtocolFactory() + jsProt453 := factory452.GetProtocol(mbTrans450) argvalue0 := aurora.NewHosts() - err403 := argvalue0.Read(jsProt402) - if err403 != nil { + err454 := argvalue0.Read(context.Background(), jsProt453) + if err454 != nil { Usage() return } value0 := argvalue0 - arg404 := flag.Arg(2) - mbTrans405 := thrift.NewTMemoryBufferLen(len(arg404)) - defer mbTrans405.Close() - _, err406 := mbTrans405.WriteString(arg404) - if err406 != nil { + arg455 := flag.Arg(2) + mbTrans456 := thrift.NewTMemoryBufferLen(len(arg455)) + defer mbTrans456.Close() + _, err457 := mbTrans456.WriteString(arg455) + if err457 != nil { Usage() return } - factory407 := thrift.NewTJSONProtocolFactory() - jsProt408 := factory407.GetProtocol(mbTrans405) + factory458 := thrift.NewTJSONProtocolFactory() + jsProt459 := factory458.GetProtocol(mbTrans456) argvalue1 := aurora.NewSlaPolicy() - err409 := argvalue1.Read(jsProt408) - if err409 != nil { + err460 := argvalue1.Read(context.Background(), jsProt459) + if err460 != nil { Usage() return } value1 := argvalue1 - argvalue2, err410 := (strconv.ParseInt(flag.Arg(3), 10, 64)) - if err410 != nil { + argvalue2, err461 := (strconv.ParseInt(flag.Arg(3), 10, 64)) + if err461 != nil { Usage() return } @@ -485,19 +485,19 @@ func main() { fmt.Fprintln(os.Stderr, "TriggerExplicitTaskReconciliation requires 1 args") flag.Usage() } - arg411 := flag.Arg(1) - mbTrans412 := thrift.NewTMemoryBufferLen(len(arg411)) - defer mbTrans412.Close() - _, err413 := mbTrans412.WriteString(arg411) - if err413 != nil { + arg462 := flag.Arg(1) + mbTrans463 := thrift.NewTMemoryBufferLen(len(arg462)) + defer mbTrans463.Close() + _, err464 := mbTrans463.WriteString(arg462) + if err464 != nil { Usage() return } - factory414 := thrift.NewTJSONProtocolFactory() - jsProt415 := factory414.GetProtocol(mbTrans412) + factory465 := thrift.NewTJSONProtocolFactory() + jsProt466 := factory465.GetProtocol(mbTrans463) argvalue0 := aurora.NewExplicitReconciliationSettings() - err416 := argvalue0.Read(jsProt415) - if err416 != nil { + err467 := argvalue0.Read(context.Background(), jsProt466) + if err467 != nil { Usage() return } @@ -518,19 +518,19 @@ func main() { fmt.Fprintln(os.Stderr, "PruneTasks requires 1 args") flag.Usage() } - arg417 := flag.Arg(1) - mbTrans418 := thrift.NewTMemoryBufferLen(len(arg417)) - defer mbTrans418.Close() - _, err419 := mbTrans418.WriteString(arg417) - if err419 != nil { + arg468 := flag.Arg(1) + mbTrans469 := thrift.NewTMemoryBufferLen(len(arg468)) + defer mbTrans469.Close() + _, err470 := mbTrans469.WriteString(arg468) + if err470 != nil { Usage() return } - factory420 := thrift.NewTJSONProtocolFactory() - jsProt421 := factory420.GetProtocol(mbTrans418) + factory471 := thrift.NewTJSONProtocolFactory() + jsProt472 := factory471.GetProtocol(mbTrans469) argvalue0 := aurora.NewTaskQuery() - err422 := argvalue0.Read(jsProt421) - if err422 != nil { + err473 := argvalue0.Read(context.Background(), jsProt472) + if err473 != nil { Usage() return } @@ -543,19 +543,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") flag.Usage() } - arg423 := flag.Arg(1) - mbTrans424 := thrift.NewTMemoryBufferLen(len(arg423)) - defer mbTrans424.Close() - _, err425 := mbTrans424.WriteString(arg423) - if err425 != nil { + arg474 := flag.Arg(1) + mbTrans475 := thrift.NewTMemoryBufferLen(len(arg474)) + defer mbTrans475.Close() + _, err476 := mbTrans475.WriteString(arg474) + if err476 != nil { Usage() return } - factory426 := thrift.NewTJSONProtocolFactory() - jsProt427 := factory426.GetProtocol(mbTrans424) + factory477 := thrift.NewTJSONProtocolFactory() + jsProt478 := factory477.GetProtocol(mbTrans475) argvalue0 := aurora.NewJobConfiguration() - err428 := argvalue0.Read(jsProt427) - if err428 != nil { + err479 := argvalue0.Read(context.Background(), jsProt478) + if err479 != nil { Usage() return } @@ -568,19 +568,19 @@ func main() { fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") flag.Usage() } - arg429 := flag.Arg(1) - mbTrans430 := thrift.NewTMemoryBufferLen(len(arg429)) - defer mbTrans430.Close() - _, err431 := mbTrans430.WriteString(arg429) - if err431 != nil { + arg480 := flag.Arg(1) + mbTrans481 := thrift.NewTMemoryBufferLen(len(arg480)) + defer mbTrans481.Close() + _, err482 := mbTrans481.WriteString(arg480) + if err482 != nil { Usage() return } - factory432 := thrift.NewTJSONProtocolFactory() - jsProt433 := factory432.GetProtocol(mbTrans430) + factory483 := thrift.NewTJSONProtocolFactory() + jsProt484 := factory483.GetProtocol(mbTrans481) argvalue0 := aurora.NewJobConfiguration() - err434 := argvalue0.Read(jsProt433) - if err434 != nil { + err485 := argvalue0.Read(context.Background(), jsProt484) + if err485 != nil { Usage() return } @@ -593,19 +593,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") flag.Usage() } - arg435 := flag.Arg(1) - mbTrans436 := thrift.NewTMemoryBufferLen(len(arg435)) - defer mbTrans436.Close() - _, err437 := mbTrans436.WriteString(arg435) - if err437 != nil { + arg486 := flag.Arg(1) + mbTrans487 := thrift.NewTMemoryBufferLen(len(arg486)) + defer mbTrans487.Close() + _, err488 := mbTrans487.WriteString(arg486) + if err488 != nil { Usage() return } - factory438 := thrift.NewTJSONProtocolFactory() - jsProt439 := factory438.GetProtocol(mbTrans436) + factory489 := thrift.NewTJSONProtocolFactory() + jsProt490 := factory489.GetProtocol(mbTrans487) argvalue0 := aurora.NewJobKey() - err440 := argvalue0.Read(jsProt439) - if err440 != nil { + err491 := argvalue0.Read(context.Background(), jsProt490) + if err491 != nil { Usage() return } @@ -618,19 +618,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") flag.Usage() } - arg441 := flag.Arg(1) - mbTrans442 := thrift.NewTMemoryBufferLen(len(arg441)) - defer mbTrans442.Close() - _, err443 := mbTrans442.WriteString(arg441) - if err443 != nil { + arg492 := flag.Arg(1) + mbTrans493 := thrift.NewTMemoryBufferLen(len(arg492)) + defer mbTrans493.Close() + _, err494 := mbTrans493.WriteString(arg492) + if err494 != nil { Usage() return } - factory444 := thrift.NewTJSONProtocolFactory() - jsProt445 := factory444.GetProtocol(mbTrans442) + factory495 := thrift.NewTJSONProtocolFactory() + jsProt496 := factory495.GetProtocol(mbTrans493) argvalue0 := aurora.NewJobKey() - err446 := argvalue0.Read(jsProt445) - if err446 != nil { + err497 := argvalue0.Read(context.Background(), jsProt496) + if err497 != nil { Usage() return } @@ -643,36 +643,36 @@ func main() { fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") flag.Usage() } - arg447 := flag.Arg(1) - mbTrans448 := thrift.NewTMemoryBufferLen(len(arg447)) - defer mbTrans448.Close() - _, err449 := mbTrans448.WriteString(arg447) - if err449 != nil { + arg498 := flag.Arg(1) + mbTrans499 := thrift.NewTMemoryBufferLen(len(arg498)) + defer mbTrans499.Close() + _, err500 := mbTrans499.WriteString(arg498) + if err500 != nil { Usage() return } - factory450 := thrift.NewTJSONProtocolFactory() - jsProt451 := factory450.GetProtocol(mbTrans448) + factory501 := thrift.NewTJSONProtocolFactory() + jsProt502 := factory501.GetProtocol(mbTrans499) argvalue0 := aurora.NewJobKey() - err452 := argvalue0.Read(jsProt451) - if err452 != nil { + err503 := argvalue0.Read(context.Background(), jsProt502) + if err503 != nil { Usage() return } value0 := argvalue0 - arg453 := flag.Arg(2) - mbTrans454 := thrift.NewTMemoryBufferLen(len(arg453)) - defer mbTrans454.Close() - _, err455 := mbTrans454.WriteString(arg453) - if err455 != nil { + arg504 := flag.Arg(2) + mbTrans505 := thrift.NewTMemoryBufferLen(len(arg504)) + defer mbTrans505.Close() + _, err506 := mbTrans505.WriteString(arg504) + if err506 != nil { Usage() return } - factory456 := thrift.NewTJSONProtocolFactory() - jsProt457 := factory456.GetProtocol(mbTrans454) - containerStruct1 := aurora.NewAuroraAdminRestartShardsArgs() - err458 := containerStruct1.ReadField2(jsProt457) - if err458 != nil { + factory507 := thrift.NewTJSONProtocolFactory() + jsProt508 := factory507.GetProtocol(mbTrans505) + containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs() + err509 := containerStruct1.ReadField2(context.Background(), jsProt508) + if err509 != nil { Usage() return } @@ -686,36 +686,36 @@ func main() { fmt.Fprintln(os.Stderr, "KillTasks requires 3 args") flag.Usage() } - arg459 := flag.Arg(1) - mbTrans460 := thrift.NewTMemoryBufferLen(len(arg459)) - defer mbTrans460.Close() - _, err461 := mbTrans460.WriteString(arg459) - if err461 != nil { + arg510 := flag.Arg(1) + mbTrans511 := thrift.NewTMemoryBufferLen(len(arg510)) + defer mbTrans511.Close() + _, err512 := mbTrans511.WriteString(arg510) + if err512 != nil { Usage() return } - factory462 := thrift.NewTJSONProtocolFactory() - jsProt463 := factory462.GetProtocol(mbTrans460) + factory513 := thrift.NewTJSONProtocolFactory() + jsProt514 := factory513.GetProtocol(mbTrans511) argvalue0 := aurora.NewJobKey() - err464 := argvalue0.Read(jsProt463) - if err464 != nil { + err515 := argvalue0.Read(context.Background(), jsProt514) + if err515 != nil { Usage() return } value0 := argvalue0 - arg465 := flag.Arg(2) - mbTrans466 := thrift.NewTMemoryBufferLen(len(arg465)) - defer mbTrans466.Close() - _, err467 := mbTrans466.WriteString(arg465) - if err467 != nil { + arg516 := flag.Arg(2) + mbTrans517 := thrift.NewTMemoryBufferLen(len(arg516)) + defer mbTrans517.Close() + _, err518 := mbTrans517.WriteString(arg516) + if err518 != nil { Usage() return } - factory468 := thrift.NewTJSONProtocolFactory() - jsProt469 := factory468.GetProtocol(mbTrans466) - containerStruct1 := aurora.NewAuroraAdminKillTasksArgs() - err470 := containerStruct1.ReadField2(jsProt469) - if err470 != nil { + factory519 := thrift.NewTJSONProtocolFactory() + jsProt520 := factory519.GetProtocol(mbTrans517) + containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs() + err521 := containerStruct1.ReadField2(context.Background(), jsProt520) + if err521 != nil { Usage() return } @@ -731,25 +731,25 @@ func main() { fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") flag.Usage() } - arg472 := flag.Arg(1) - mbTrans473 := thrift.NewTMemoryBufferLen(len(arg472)) - defer mbTrans473.Close() - _, err474 := mbTrans473.WriteString(arg472) - if err474 != nil { + arg523 := flag.Arg(1) + mbTrans524 := thrift.NewTMemoryBufferLen(len(arg523)) + defer mbTrans524.Close() + _, err525 := mbTrans524.WriteString(arg523) + if err525 != nil { Usage() return } - factory475 := thrift.NewTJSONProtocolFactory() - jsProt476 := factory475.GetProtocol(mbTrans473) + factory526 := thrift.NewTJSONProtocolFactory() + jsProt527 := factory526.GetProtocol(mbTrans524) argvalue0 := aurora.NewInstanceKey() - err477 := argvalue0.Read(jsProt476) - if err477 != nil { + err528 := argvalue0.Read(context.Background(), jsProt527) + if err528 != nil { Usage() return } value0 := argvalue0 - tmp1, err478 := (strconv.Atoi(flag.Arg(2))) - if err478 != nil { + tmp1, err529 := (strconv.Atoi(flag.Arg(2))) + if err529 != nil { Usage() return } @@ -763,19 +763,19 @@ func main() { fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") flag.Usage() } - arg479 := flag.Arg(1) - mbTrans480 := thrift.NewTMemoryBufferLen(len(arg479)) - defer mbTrans480.Close() - _, err481 := mbTrans480.WriteString(arg479) - if err481 != nil { + arg530 := flag.Arg(1) + mbTrans531 := thrift.NewTMemoryBufferLen(len(arg530)) + defer mbTrans531.Close() + _, err532 := mbTrans531.WriteString(arg530) + if err532 != nil { Usage() return } - factory482 := thrift.NewTJSONProtocolFactory() - jsProt483 := factory482.GetProtocol(mbTrans480) + factory533 := thrift.NewTJSONProtocolFactory() + jsProt534 := factory533.GetProtocol(mbTrans531) argvalue0 := aurora.NewJobConfiguration() - err484 := argvalue0.Read(jsProt483) - if err484 != nil { + err535 := argvalue0.Read(context.Background(), jsProt534) + if err535 != nil { Usage() return } @@ -788,19 +788,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") flag.Usage() } - arg485 := flag.Arg(1) - mbTrans486 := thrift.NewTMemoryBufferLen(len(arg485)) - defer mbTrans486.Close() - _, err487 := mbTrans486.WriteString(arg485) - if err487 != nil { + arg536 := flag.Arg(1) + mbTrans537 := thrift.NewTMemoryBufferLen(len(arg536)) + defer mbTrans537.Close() + _, err538 := mbTrans537.WriteString(arg536) + if err538 != nil { Usage() return } - factory488 := thrift.NewTJSONProtocolFactory() - jsProt489 := factory488.GetProtocol(mbTrans486) + factory539 := thrift.NewTJSONProtocolFactory() + jsProt540 := factory539.GetProtocol(mbTrans537) argvalue0 := aurora.NewJobUpdateRequest() - err490 := argvalue0.Read(jsProt489) - if err490 != nil { + err541 := argvalue0.Read(context.Background(), jsProt540) + if err541 != nil { Usage() return } @@ -815,19 +815,19 @@ func main() { fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") flag.Usage() } - arg492 := flag.Arg(1) - mbTrans493 := thrift.NewTMemoryBufferLen(len(arg492)) - defer mbTrans493.Close() - _, err494 := mbTrans493.WriteString(arg492) - if err494 != nil { + arg543 := flag.Arg(1) + mbTrans544 := thrift.NewTMemoryBufferLen(len(arg543)) + defer mbTrans544.Close() + _, err545 := mbTrans544.WriteString(arg543) + if err545 != nil { Usage() return } - factory495 := thrift.NewTJSONProtocolFactory() - jsProt496 := factory495.GetProtocol(mbTrans493) + factory546 := thrift.NewTJSONProtocolFactory() + jsProt547 := factory546.GetProtocol(mbTrans544) argvalue0 := aurora.NewJobUpdateKey() - err497 := argvalue0.Read(jsProt496) - if err497 != nil { + err548 := argvalue0.Read(context.Background(), jsProt547) + if err548 != nil { Usage() return } @@ -842,19 +842,19 @@ func main() { fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") flag.Usage() } - arg499 := flag.Arg(1) - mbTrans500 := thrift.NewTMemoryBufferLen(len(arg499)) - defer mbTrans500.Close() - _, err501 := mbTrans500.WriteString(arg499) - if err501 != nil { + arg550 := flag.Arg(1) + mbTrans551 := thrift.NewTMemoryBufferLen(len(arg550)) + defer mbTrans551.Close() + _, err552 := mbTrans551.WriteString(arg550) + if err552 != nil { Usage() return } - factory502 := thrift.NewTJSONProtocolFactory() - jsProt503 := factory502.GetProtocol(mbTrans500) + factory553 := thrift.NewTJSONProtocolFactory() + jsProt554 := factory553.GetProtocol(mbTrans551) argvalue0 := aurora.NewJobUpdateKey() - err504 := argvalue0.Read(jsProt503) - if err504 != nil { + err555 := argvalue0.Read(context.Background(), jsProt554) + if err555 != nil { Usage() return } @@ -869,19 +869,19 @@ func main() { fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") flag.Usage() } - arg506 := flag.Arg(1) - mbTrans507 := thrift.NewTMemoryBufferLen(len(arg506)) - defer mbTrans507.Close() - _, err508 := mbTrans507.WriteString(arg506) - if err508 != nil { + arg557 := flag.Arg(1) + mbTrans558 := thrift.NewTMemoryBufferLen(len(arg557)) + defer mbTrans558.Close() + _, err559 := mbTrans558.WriteString(arg557) + if err559 != nil { Usage() return } - factory509 := thrift.NewTJSONProtocolFactory() - jsProt510 := factory509.GetProtocol(mbTrans507) + factory560 := thrift.NewTJSONProtocolFactory() + jsProt561 := factory560.GetProtocol(mbTrans558) argvalue0 := aurora.NewJobUpdateKey() - err511 := argvalue0.Read(jsProt510) - if err511 != nil { + err562 := argvalue0.Read(context.Background(), jsProt561) + if err562 != nil { Usage() return } @@ -896,19 +896,19 @@ func main() { fmt.Fprintln(os.Stderr, "RollbackJobUpdate requires 2 args") flag.Usage() } - arg513 := flag.Arg(1) - mbTrans514 := thrift.NewTMemoryBufferLen(len(arg513)) - defer mbTrans514.Close() - _, err515 := mbTrans514.WriteString(arg513) - if err515 != nil { + arg564 := flag.Arg(1) + mbTrans565 := thrift.NewTMemoryBufferLen(len(arg564)) + defer mbTrans565.Close() + _, err566 := mbTrans565.WriteString(arg564) + if err566 != nil { Usage() return } - factory516 := thrift.NewTJSONProtocolFactory() - jsProt517 := factory516.GetProtocol(mbTrans514) + factory567 := thrift.NewTJSONProtocolFactory() + jsProt568 := factory567.GetProtocol(mbTrans565) argvalue0 := aurora.NewJobUpdateKey() - err518 := argvalue0.Read(jsProt517) - if err518 != nil { + err569 := argvalue0.Read(context.Background(), jsProt568) + if err569 != nil { Usage() return } @@ -923,19 +923,19 @@ func main() { fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") flag.Usage() } - arg520 := flag.Arg(1) - mbTrans521 := thrift.NewTMemoryBufferLen(len(arg520)) - defer mbTrans521.Close() - _, err522 := mbTrans521.WriteString(arg520) - if err522 != nil { + arg571 := flag.Arg(1) + mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571)) + defer mbTrans572.Close() + _, err573 := mbTrans572.WriteString(arg571) + if err573 != nil { Usage() return } - factory523 := thrift.NewTJSONProtocolFactory() - jsProt524 := factory523.GetProtocol(mbTrans521) + factory574 := thrift.NewTJSONProtocolFactory() + jsProt575 := factory574.GetProtocol(mbTrans572) argvalue0 := aurora.NewJobUpdateKey() - err525 := argvalue0.Read(jsProt524) - if err525 != nil { + err576 := argvalue0.Read(context.Background(), jsProt575) + if err576 != nil { Usage() return } @@ -966,19 +966,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg527 := flag.Arg(1) - mbTrans528 := thrift.NewTMemoryBufferLen(len(arg527)) - defer mbTrans528.Close() - _, err529 := mbTrans528.WriteString(arg527) - if err529 != nil { + arg578 := flag.Arg(1) + mbTrans579 := thrift.NewTMemoryBufferLen(len(arg578)) + defer mbTrans579.Close() + _, err580 := mbTrans579.WriteString(arg578) + if err580 != nil { Usage() return } - factory530 := thrift.NewTJSONProtocolFactory() - jsProt531 := factory530.GetProtocol(mbTrans528) + factory581 := thrift.NewTJSONProtocolFactory() + jsProt582 := factory581.GetProtocol(mbTrans579) argvalue0 := aurora.NewTaskQuery() - err532 := argvalue0.Read(jsProt531) - if err532 != nil { + err583 := argvalue0.Read(context.Background(), jsProt582) + if err583 != nil { Usage() return } @@ -991,19 +991,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg533 := flag.Arg(1) - mbTrans534 := thrift.NewTMemoryBufferLen(len(arg533)) - defer mbTrans534.Close() - _, err535 := mbTrans534.WriteString(arg533) - if err535 != nil { + arg584 := flag.Arg(1) + mbTrans585 := thrift.NewTMemoryBufferLen(len(arg584)) + defer mbTrans585.Close() + _, err586 := mbTrans585.WriteString(arg584) + if err586 != nil { Usage() return } - factory536 := thrift.NewTJSONProtocolFactory() - jsProt537 := factory536.GetProtocol(mbTrans534) + factory587 := thrift.NewTJSONProtocolFactory() + jsProt588 := factory587.GetProtocol(mbTrans585) argvalue0 := aurora.NewTaskQuery() - err538 := argvalue0.Read(jsProt537) - if err538 != nil { + err589 := argvalue0.Read(context.Background(), jsProt588) + if err589 != nil { Usage() return } @@ -1016,19 +1016,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg539 := flag.Arg(1) - mbTrans540 := thrift.NewTMemoryBufferLen(len(arg539)) - defer mbTrans540.Close() - _, err541 := mbTrans540.WriteString(arg539) - if err541 != nil { + arg590 := flag.Arg(1) + mbTrans591 := thrift.NewTMemoryBufferLen(len(arg590)) + defer mbTrans591.Close() + _, err592 := mbTrans591.WriteString(arg590) + if err592 != nil { Usage() return } - factory542 := thrift.NewTJSONProtocolFactory() - jsProt543 := factory542.GetProtocol(mbTrans540) + factory593 := thrift.NewTJSONProtocolFactory() + jsProt594 := factory593.GetProtocol(mbTrans591) argvalue0 := aurora.NewTaskQuery() - err544 := argvalue0.Read(jsProt543) - if err544 != nil { + err595 := argvalue0.Read(context.Background(), jsProt594) + if err595 != nil { Usage() return } @@ -1041,19 +1041,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg545 := flag.Arg(1) - mbTrans546 := thrift.NewTMemoryBufferLen(len(arg545)) - defer mbTrans546.Close() - _, err547 := mbTrans546.WriteString(arg545) - if err547 != nil { + arg596 := flag.Arg(1) + mbTrans597 := thrift.NewTMemoryBufferLen(len(arg596)) + defer mbTrans597.Close() + _, err598 := mbTrans597.WriteString(arg596) + if err598 != nil { Usage() return } - factory548 := thrift.NewTJSONProtocolFactory() - jsProt549 := factory548.GetProtocol(mbTrans546) + factory599 := thrift.NewTJSONProtocolFactory() + jsProt600 := factory599.GetProtocol(mbTrans597) argvalue0 := aurora.NewJobKey() - err550 := argvalue0.Read(jsProt549) - if err550 != nil { + err601 := argvalue0.Read(context.Background(), jsProt600) + if err601 != nil { Usage() return } @@ -1086,19 +1086,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg553 := flag.Arg(1) - mbTrans554 := thrift.NewTMemoryBufferLen(len(arg553)) - defer mbTrans554.Close() - _, err555 := mbTrans554.WriteString(arg553) - if err555 != nil { + arg604 := flag.Arg(1) + mbTrans605 := thrift.NewTMemoryBufferLen(len(arg604)) + defer mbTrans605.Close() + _, err606 := mbTrans605.WriteString(arg604) + if err606 != nil { Usage() return } - factory556 := thrift.NewTJSONProtocolFactory() - jsProt557 := factory556.GetProtocol(mbTrans554) + factory607 := thrift.NewTJSONProtocolFactory() + jsProt608 := factory607.GetProtocol(mbTrans605) argvalue0 := aurora.NewJobConfiguration() - err558 := argvalue0.Read(jsProt557) - if err558 != nil { + err609 := argvalue0.Read(context.Background(), jsProt608) + if err609 != nil { Usage() return } @@ -1111,19 +1111,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg559 := flag.Arg(1) - mbTrans560 := thrift.NewTMemoryBufferLen(len(arg559)) - defer mbTrans560.Close() - _, err561 := mbTrans560.WriteString(arg559) - if err561 != nil { + arg610 := flag.Arg(1) + mbTrans611 := thrift.NewTMemoryBufferLen(len(arg610)) + defer mbTrans611.Close() + _, err612 := mbTrans611.WriteString(arg610) + if err612 != nil { Usage() return } - factory562 := thrift.NewTJSONProtocolFactory() - jsProt563 := factory562.GetProtocol(mbTrans560) + factory613 := thrift.NewTJSONProtocolFactory() + jsProt614 := factory613.GetProtocol(mbTrans611) argvalue0 := aurora.NewJobUpdateQuery() - err564 := argvalue0.Read(jsProt563) - if err564 != nil { + err615 := argvalue0.Read(context.Background(), jsProt614) + if err615 != nil { Usage() return } @@ -1136,19 +1136,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg565 := flag.Arg(1) - mbTrans566 := thrift.NewTMemoryBufferLen(len(arg565)) - defer mbTrans566.Close() - _, err567 := mbTrans566.WriteString(arg565) - if err567 != nil { + arg616 := flag.Arg(1) + mbTrans617 := thrift.NewTMemoryBufferLen(len(arg616)) + defer mbTrans617.Close() + _, err618 := mbTrans617.WriteString(arg616) + if err618 != nil { Usage() return } - factory568 := thrift.NewTJSONProtocolFactory() - jsProt569 := factory568.GetProtocol(mbTrans566) + factory619 := thrift.NewTJSONProtocolFactory() + jsProt620 := factory619.GetProtocol(mbTrans617) argvalue0 := aurora.NewJobUpdateQuery() - err570 := argvalue0.Read(jsProt569) - if err570 != nil { + err621 := argvalue0.Read(context.Background(), jsProt620) + if err621 != nil { Usage() return } @@ -1161,19 +1161,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg571 := flag.Arg(1) - mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571)) - defer mbTrans572.Close() - _, err573 := mbTrans572.WriteString(arg571) - if err573 != nil { + arg622 := flag.Arg(1) + mbTrans623 := thrift.NewTMemoryBufferLen(len(arg622)) + defer mbTrans623.Close() + _, err624 := mbTrans623.WriteString(arg622) + if err624 != nil { Usage() return } - factory574 := thrift.NewTJSONProtocolFactory() - jsProt575 := factory574.GetProtocol(mbTrans572) + factory625 := thrift.NewTJSONProtocolFactory() + jsProt626 := factory625.GetProtocol(mbTrans623) argvalue0 := aurora.NewJobUpdateRequest() - err576 := argvalue0.Read(jsProt575) - if err576 != nil { + err627 := argvalue0.Read(context.Background(), jsProt626) + if err627 != nil { Usage() return } diff --git a/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go b/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go index bc3abe9..b4715d5 100755 --- a/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go +++ b/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -175,19 +175,19 @@ func main() { fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") flag.Usage() } - arg162 := flag.Arg(1) - mbTrans163 := thrift.NewTMemoryBufferLen(len(arg162)) - defer mbTrans163.Close() - _, err164 := mbTrans163.WriteString(arg162) - if err164 != nil { + arg213 := flag.Arg(1) + mbTrans214 := thrift.NewTMemoryBufferLen(len(arg213)) + defer mbTrans214.Close() + _, err215 := mbTrans214.WriteString(arg213) + if err215 != nil { Usage() return } - factory165 := thrift.NewTJSONProtocolFactory() - jsProt166 := factory165.GetProtocol(mbTrans163) + factory216 := thrift.NewTJSONProtocolFactory() + jsProt217 := factory216.GetProtocol(mbTrans214) argvalue0 := aurora.NewJobConfiguration() - err167 := argvalue0.Read(jsProt166) - if err167 != nil { + err218 := argvalue0.Read(context.Background(), jsProt217) + if err218 != nil { Usage() return } @@ -200,19 +200,19 @@ func main() { fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") flag.Usage() } - arg168 := flag.Arg(1) - mbTrans169 := thrift.NewTMemoryBufferLen(len(arg168)) - defer mbTrans169.Close() - _, err170 := mbTrans169.WriteString(arg168) - if err170 != nil { + arg219 := flag.Arg(1) + mbTrans220 := thrift.NewTMemoryBufferLen(len(arg219)) + defer mbTrans220.Close() + _, err221 := mbTrans220.WriteString(arg219) + if err221 != nil { Usage() return } - factory171 := thrift.NewTJSONProtocolFactory() - jsProt172 := factory171.GetProtocol(mbTrans169) + factory222 := thrift.NewTJSONProtocolFactory() + jsProt223 := factory222.GetProtocol(mbTrans220) argvalue0 := aurora.NewJobConfiguration() - err173 := argvalue0.Read(jsProt172) - if err173 != nil { + err224 := argvalue0.Read(context.Background(), jsProt223) + if err224 != nil { Usage() return } @@ -225,19 +225,19 @@ func main() { fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") flag.Usage() } - arg174 := flag.Arg(1) - mbTrans175 := thrift.NewTMemoryBufferLen(len(arg174)) - defer mbTrans175.Close() - _, err176 := mbTrans175.WriteString(arg174) - if err176 != nil { + arg225 := flag.Arg(1) + mbTrans226 := thrift.NewTMemoryBufferLen(len(arg225)) + defer mbTrans226.Close() + _, err227 := mbTrans226.WriteString(arg225) + if err227 != nil { Usage() return } - factory177 := thrift.NewTJSONProtocolFactory() - jsProt178 := factory177.GetProtocol(mbTrans175) + factory228 := thrift.NewTJSONProtocolFactory() + jsProt229 := factory228.GetProtocol(mbTrans226) argvalue0 := aurora.NewJobKey() - err179 := argvalue0.Read(jsProt178) - if err179 != nil { + err230 := argvalue0.Read(context.Background(), jsProt229) + if err230 != nil { Usage() return } @@ -250,19 +250,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") flag.Usage() } - arg180 := flag.Arg(1) - mbTrans181 := thrift.NewTMemoryBufferLen(len(arg180)) - defer mbTrans181.Close() - _, err182 := mbTrans181.WriteString(arg180) - if err182 != nil { + arg231 := flag.Arg(1) + mbTrans232 := thrift.NewTMemoryBufferLen(len(arg231)) + defer mbTrans232.Close() + _, err233 := mbTrans232.WriteString(arg231) + if err233 != nil { Usage() return } - factory183 := thrift.NewTJSONProtocolFactory() - jsProt184 := factory183.GetProtocol(mbTrans181) + factory234 := thrift.NewTJSONProtocolFactory() + jsProt235 := factory234.GetProtocol(mbTrans232) argvalue0 := aurora.NewJobKey() - err185 := argvalue0.Read(jsProt184) - if err185 != nil { + err236 := argvalue0.Read(context.Background(), jsProt235) + if err236 != nil { Usage() return } @@ -275,36 +275,36 @@ func main() { fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") flag.Usage() } - arg186 := flag.Arg(1) - mbTrans187 := thrift.NewTMemoryBufferLen(len(arg186)) - defer mbTrans187.Close() - _, err188 := mbTrans187.WriteString(arg186) - if err188 != nil { + arg237 := flag.Arg(1) + mbTrans238 := thrift.NewTMemoryBufferLen(len(arg237)) + defer mbTrans238.Close() + _, err239 := mbTrans238.WriteString(arg237) + if err239 != nil { Usage() return } - factory189 := thrift.NewTJSONProtocolFactory() - jsProt190 := factory189.GetProtocol(mbTrans187) + factory240 := thrift.NewTJSONProtocolFactory() + jsProt241 := factory240.GetProtocol(mbTrans238) argvalue0 := aurora.NewJobKey() - err191 := argvalue0.Read(jsProt190) - if err191 != nil { + err242 := argvalue0.Read(context.Background(), jsProt241) + if err242 != nil { Usage() return } value0 := argvalue0 - arg192 := flag.Arg(2) - mbTrans193 := thrift.NewTMemoryBufferLen(len(arg192)) - defer mbTrans193.Close() - _, err194 := mbTrans193.WriteString(arg192) - if err194 != nil { + arg243 := flag.Arg(2) + mbTrans244 := thrift.NewTMemoryBufferLen(len(arg243)) + defer mbTrans244.Close() + _, err245 := mbTrans244.WriteString(arg243) + if err245 != nil { Usage() return } - factory195 := thrift.NewTJSONProtocolFactory() - jsProt196 := factory195.GetProtocol(mbTrans193) + factory246 := thrift.NewTJSONProtocolFactory() + jsProt247 := factory246.GetProtocol(mbTrans244) containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs() - err197 := containerStruct1.ReadField2(jsProt196) - if err197 != nil { + err248 := containerStruct1.ReadField2(context.Background(), jsProt247) + if err248 != nil { Usage() return } @@ -318,36 +318,36 @@ func main() { fmt.Fprintln(os.Stderr, "KillTasks requires 3 args") flag.Usage() } - arg198 := flag.Arg(1) - mbTrans199 := thrift.NewTMemoryBufferLen(len(arg198)) - defer mbTrans199.Close() - _, err200 := mbTrans199.WriteString(arg198) - if err200 != nil { + arg249 := flag.Arg(1) + mbTrans250 := thrift.NewTMemoryBufferLen(len(arg249)) + defer mbTrans250.Close() + _, err251 := mbTrans250.WriteString(arg249) + if err251 != nil { Usage() return } - factory201 := thrift.NewTJSONProtocolFactory() - jsProt202 := factory201.GetProtocol(mbTrans199) + factory252 := thrift.NewTJSONProtocolFactory() + jsProt253 := factory252.GetProtocol(mbTrans250) argvalue0 := aurora.NewJobKey() - err203 := argvalue0.Read(jsProt202) - if err203 != nil { + err254 := argvalue0.Read(context.Background(), jsProt253) + if err254 != nil { Usage() return } value0 := argvalue0 - arg204 := flag.Arg(2) - mbTrans205 := thrift.NewTMemoryBufferLen(len(arg204)) - defer mbTrans205.Close() - _, err206 := mbTrans205.WriteString(arg204) - if err206 != nil { + arg255 := flag.Arg(2) + mbTrans256 := thrift.NewTMemoryBufferLen(len(arg255)) + defer mbTrans256.Close() + _, err257 := mbTrans256.WriteString(arg255) + if err257 != nil { Usage() return } - factory207 := thrift.NewTJSONProtocolFactory() - jsProt208 := factory207.GetProtocol(mbTrans205) + factory258 := thrift.NewTJSONProtocolFactory() + jsProt259 := factory258.GetProtocol(mbTrans256) containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs() - err209 := containerStruct1.ReadField2(jsProt208) - if err209 != nil { + err260 := containerStruct1.ReadField2(context.Background(), jsProt259) + if err260 != nil { Usage() return } @@ -363,25 +363,25 @@ func main() { fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") flag.Usage() } - arg211 := flag.Arg(1) - mbTrans212 := thrift.NewTMemoryBufferLen(len(arg211)) - defer mbTrans212.Close() - _, err213 := mbTrans212.WriteString(arg211) - if err213 != nil { + arg262 := flag.Arg(1) + mbTrans263 := thrift.NewTMemoryBufferLen(len(arg262)) + defer mbTrans263.Close() + _, err264 := mbTrans263.WriteString(arg262) + if err264 != nil { Usage() return } - factory214 := thrift.NewTJSONProtocolFactory() - jsProt215 := factory214.GetProtocol(mbTrans212) + factory265 := thrift.NewTJSONProtocolFactory() + jsProt266 := factory265.GetProtocol(mbTrans263) argvalue0 := aurora.NewInstanceKey() - err216 := argvalue0.Read(jsProt215) - if err216 != nil { + err267 := argvalue0.Read(context.Background(), jsProt266) + if err267 != nil { Usage() return } value0 := argvalue0 - tmp1, err217 := (strconv.Atoi(flag.Arg(2))) - if err217 != nil { + tmp1, err268 := (strconv.Atoi(flag.Arg(2))) + if err268 != nil { Usage() return } @@ -395,19 +395,19 @@ func main() { fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") flag.Usage() } - arg218 := flag.Arg(1) - mbTrans219 := thrift.NewTMemoryBufferLen(len(arg218)) - defer mbTrans219.Close() - _, err220 := mbTrans219.WriteString(arg218) - if err220 != nil { + arg269 := flag.Arg(1) + mbTrans270 := thrift.NewTMemoryBufferLen(len(arg269)) + defer mbTrans270.Close() + _, err271 := mbTrans270.WriteString(arg269) + if err271 != nil { Usage() return } - factory221 := thrift.NewTJSONProtocolFactory() - jsProt222 := factory221.GetProtocol(mbTrans219) + factory272 := thrift.NewTJSONProtocolFactory() + jsProt273 := factory272.GetProtocol(mbTrans270) argvalue0 := aurora.NewJobConfiguration() - err223 := argvalue0.Read(jsProt222) - if err223 != nil { + err274 := argvalue0.Read(context.Background(), jsProt273) + if err274 != nil { Usage() return } @@ -420,19 +420,19 @@ func main() { fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") flag.Usage() } - arg224 := flag.Arg(1) - mbTrans225 := thrift.NewTMemoryBufferLen(len(arg224)) - defer mbTrans225.Close() - _, err226 := mbTrans225.WriteString(arg224) - if err226 != nil { + arg275 := flag.Arg(1) + mbTrans276 := thrift.NewTMemoryBufferLen(len(arg275)) + defer mbTrans276.Close() + _, err277 := mbTrans276.WriteString(arg275) + if err277 != nil { Usage() return } - factory227 := thrift.NewTJSONProtocolFactory() - jsProt228 := factory227.GetProtocol(mbTrans225) + factory278 := thrift.NewTJSONProtocolFactory() + jsProt279 := factory278.GetProtocol(mbTrans276) argvalue0 := aurora.NewJobUpdateRequest() - err229 := argvalue0.Read(jsProt228) - if err229 != nil { + err280 := argvalue0.Read(context.Background(), jsProt279) + if err280 != nil { Usage() return } @@ -447,19 +447,19 @@ func main() { fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") flag.Usage() } - arg231 := flag.Arg(1) - mbTrans232 := thrift.NewTMemoryBufferLen(len(arg231)) - defer mbTrans232.Close() - _, err233 := mbTrans232.WriteString(arg231) - if err233 != nil { + arg282 := flag.Arg(1) + mbTrans283 := thrift.NewTMemoryBufferLen(len(arg282)) + defer mbTrans283.Close() + _, err284 := mbTrans283.WriteString(arg282) + if err284 != nil { Usage() return } - factory234 := thrift.NewTJSONProtocolFactory() - jsProt235 := factory234.GetProtocol(mbTrans232) + factory285 := thrift.NewTJSONProtocolFactory() + jsProt286 := factory285.GetProtocol(mbTrans283) argvalue0 := aurora.NewJobUpdateKey() - err236 := argvalue0.Read(jsProt235) - if err236 != nil { + err287 := argvalue0.Read(context.Background(), jsProt286) + if err287 != nil { Usage() return } @@ -474,19 +474,19 @@ func main() { fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") flag.Usage() } - arg238 := flag.Arg(1) - mbTrans239 := thrift.NewTMemoryBufferLen(len(arg238)) - defer mbTrans239.Close() - _, err240 := mbTrans239.WriteString(arg238) - if err240 != nil { + arg289 := flag.Arg(1) + mbTrans290 := thrift.NewTMemoryBufferLen(len(arg289)) + defer mbTrans290.Close() + _, err291 := mbTrans290.WriteString(arg289) + if err291 != nil { Usage() return } - factory241 := thrift.NewTJSONProtocolFactory() - jsProt242 := factory241.GetProtocol(mbTrans239) + factory292 := thrift.NewTJSONProtocolFactory() + jsProt293 := factory292.GetProtocol(mbTrans290) argvalue0 := aurora.NewJobUpdateKey() - err243 := argvalue0.Read(jsProt242) - if err243 != nil { + err294 := argvalue0.Read(context.Background(), jsProt293) + if err294 != nil { Usage() return } @@ -501,19 +501,19 @@ func main() { fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") flag.Usage() } - arg245 := flag.Arg(1) - mbTrans246 := thrift.NewTMemoryBufferLen(len(arg245)) - defer mbTrans246.Close() - _, err247 := mbTrans246.WriteString(arg245) - if err247 != nil { + arg296 := flag.Arg(1) + mbTrans297 := thrift.NewTMemoryBufferLen(len(arg296)) + defer mbTrans297.Close() + _, err298 := mbTrans297.WriteString(arg296) + if err298 != nil { Usage() return } - factory248 := thrift.NewTJSONProtocolFactory() - jsProt249 := factory248.GetProtocol(mbTrans246) + factory299 := thrift.NewTJSONProtocolFactory() + jsProt300 := factory299.GetProtocol(mbTrans297) argvalue0 := aurora.NewJobUpdateKey() - err250 := argvalue0.Read(jsProt249) - if err250 != nil { + err301 := argvalue0.Read(context.Background(), jsProt300) + if err301 != nil { Usage() return } @@ -528,19 +528,19 @@ func main() { fmt.Fprintln(os.Stderr, "RollbackJobUpdate requires 2 args") flag.Usage() } - arg252 := flag.Arg(1) - mbTrans253 := thrift.NewTMemoryBufferLen(len(arg252)) - defer mbTrans253.Close() - _, err254 := mbTrans253.WriteString(arg252) - if err254 != nil { + arg303 := flag.Arg(1) + mbTrans304 := thrift.NewTMemoryBufferLen(len(arg303)) + defer mbTrans304.Close() + _, err305 := mbTrans304.WriteString(arg303) + if err305 != nil { Usage() return } - factory255 := thrift.NewTJSONProtocolFactory() - jsProt256 := factory255.GetProtocol(mbTrans253) + factory306 := thrift.NewTJSONProtocolFactory() + jsProt307 := factory306.GetProtocol(mbTrans304) argvalue0 := aurora.NewJobUpdateKey() - err257 := argvalue0.Read(jsProt256) - if err257 != nil { + err308 := argvalue0.Read(context.Background(), jsProt307) + if err308 != nil { Usage() return } @@ -555,19 +555,19 @@ func main() { fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") flag.Usage() } - arg259 := flag.Arg(1) - mbTrans260 := thrift.NewTMemoryBufferLen(len(arg259)) - defer mbTrans260.Close() - _, err261 := mbTrans260.WriteString(arg259) - if err261 != nil { + arg310 := flag.Arg(1) + mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310)) + defer mbTrans311.Close() + _, err312 := mbTrans311.WriteString(arg310) + if err312 != nil { Usage() return } - factory262 := thrift.NewTJSONProtocolFactory() - jsProt263 := factory262.GetProtocol(mbTrans260) + factory313 := thrift.NewTJSONProtocolFactory() + jsProt314 := factory313.GetProtocol(mbTrans311) argvalue0 := aurora.NewJobUpdateKey() - err264 := argvalue0.Read(jsProt263) - if err264 != nil { + err315 := argvalue0.Read(context.Background(), jsProt314) + if err315 != nil { Usage() return } @@ -598,19 +598,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg266 := flag.Arg(1) - mbTrans267 := thrift.NewTMemoryBufferLen(len(arg266)) - defer mbTrans267.Close() - _, err268 := mbTrans267.WriteString(arg266) - if err268 != nil { + arg317 := flag.Arg(1) + mbTrans318 := thrift.NewTMemoryBufferLen(len(arg317)) + defer mbTrans318.Close() + _, err319 := mbTrans318.WriteString(arg317) + if err319 != nil { Usage() return } - factory269 := thrift.NewTJSONProtocolFactory() - jsProt270 := factory269.GetProtocol(mbTrans267) + factory320 := thrift.NewTJSONProtocolFactory() + jsProt321 := factory320.GetProtocol(mbTrans318) argvalue0 := aurora.NewTaskQuery() - err271 := argvalue0.Read(jsProt270) - if err271 != nil { + err322 := argvalue0.Read(context.Background(), jsProt321) + if err322 != nil { Usage() return } @@ -623,19 +623,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg272 := flag.Arg(1) - mbTrans273 := thrift.NewTMemoryBufferLen(len(arg272)) - defer mbTrans273.Close() - _, err274 := mbTrans273.WriteString(arg272) - if err274 != nil { + arg323 := flag.Arg(1) + mbTrans324 := thrift.NewTMemoryBufferLen(len(arg323)) + defer mbTrans324.Close() + _, err325 := mbTrans324.WriteString(arg323) + if err325 != nil { Usage() return } - factory275 := thrift.NewTJSONProtocolFactory() - jsProt276 := factory275.GetProtocol(mbTrans273) + factory326 := thrift.NewTJSONProtocolFactory() + jsProt327 := factory326.GetProtocol(mbTrans324) argvalue0 := aurora.NewTaskQuery() - err277 := argvalue0.Read(jsProt276) - if err277 != nil { + err328 := argvalue0.Read(context.Background(), jsProt327) + if err328 != nil { Usage() return } @@ -648,19 +648,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg278 := flag.Arg(1) - mbTrans279 := thrift.NewTMemoryBufferLen(len(arg278)) - defer mbTrans279.Close() - _, err280 := mbTrans279.WriteString(arg278) - if err280 != nil { + arg329 := flag.Arg(1) + mbTrans330 := thrift.NewTMemoryBufferLen(len(arg329)) + defer mbTrans330.Close() + _, err331 := mbTrans330.WriteString(arg329) + if err331 != nil { Usage() return } - factory281 := thrift.NewTJSONProtocolFactory() - jsProt282 := factory281.GetProtocol(mbTrans279) + factory332 := thrift.NewTJSONProtocolFactory() + jsProt333 := factory332.GetProtocol(mbTrans330) argvalue0 := aurora.NewTaskQuery() - err283 := argvalue0.Read(jsProt282) - if err283 != nil { + err334 := argvalue0.Read(context.Background(), jsProt333) + if err334 != nil { Usage() return } @@ -673,19 +673,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg284 := flag.Arg(1) - mbTrans285 := thrift.NewTMemoryBufferLen(len(arg284)) - defer mbTrans285.Close() - _, err286 := mbTrans285.WriteString(arg284) - if err286 != nil { + arg335 := flag.Arg(1) + mbTrans336 := thrift.NewTMemoryBufferLen(len(arg335)) + defer mbTrans336.Close() + _, err337 := mbTrans336.WriteString(arg335) + if err337 != nil { Usage() return } - factory287 := thrift.NewTJSONProtocolFactory() - jsProt288 := factory287.GetProtocol(mbTrans285) + factory338 := thrift.NewTJSONProtocolFactory() + jsProt339 := factory338.GetProtocol(mbTrans336) argvalue0 := aurora.NewJobKey() - err289 := argvalue0.Read(jsProt288) - if err289 != nil { + err340 := argvalue0.Read(context.Background(), jsProt339) + if err340 != nil { Usage() return } @@ -718,19 +718,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg292 := flag.Arg(1) - mbTrans293 := thrift.NewTMemoryBufferLen(len(arg292)) - defer mbTrans293.Close() - _, err294 := mbTrans293.WriteString(arg292) - if err294 != nil { + arg343 := flag.Arg(1) + mbTrans344 := thrift.NewTMemoryBufferLen(len(arg343)) + defer mbTrans344.Close() + _, err345 := mbTrans344.WriteString(arg343) + if err345 != nil { Usage() return } - factory295 := thrift.NewTJSONProtocolFactory() - jsProt296 := factory295.GetProtocol(mbTrans293) + factory346 := thrift.NewTJSONProtocolFactory() + jsProt347 := factory346.GetProtocol(mbTrans344) argvalue0 := aurora.NewJobConfiguration() - err297 := argvalue0.Read(jsProt296) - if err297 != nil { + err348 := argvalue0.Read(context.Background(), jsProt347) + if err348 != nil { Usage() return } @@ -743,19 +743,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg298 := flag.Arg(1) - mbTrans299 := thrift.NewTMemoryBufferLen(len(arg298)) - defer mbTrans299.Close() - _, err300 := mbTrans299.WriteString(arg298) - if err300 != nil { + arg349 := flag.Arg(1) + mbTrans350 := thrift.NewTMemoryBufferLen(len(arg349)) + defer mbTrans350.Close() + _, err351 := mbTrans350.WriteString(arg349) + if err351 != nil { Usage() return } - factory301 := thrift.NewTJSONProtocolFactory() - jsProt302 := factory301.GetProtocol(mbTrans299) + factory352 := thrift.NewTJSONProtocolFactory() + jsProt353 := factory352.GetProtocol(mbTrans350) argvalue0 := aurora.NewJobUpdateQuery() - err303 := argvalue0.Read(jsProt302) - if err303 != nil { + err354 := argvalue0.Read(context.Background(), jsProt353) + if err354 != nil { Usage() return } @@ -768,19 +768,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg304 := flag.Arg(1) - mbTrans305 := thrift.NewTMemoryBufferLen(len(arg304)) - defer mbTrans305.Close() - _, err306 := mbTrans305.WriteString(arg304) - if err306 != nil { + arg355 := flag.Arg(1) + mbTrans356 := thrift.NewTMemoryBufferLen(len(arg355)) + defer mbTrans356.Close() + _, err357 := mbTrans356.WriteString(arg355) + if err357 != nil { Usage() return } - factory307 := thrift.NewTJSONProtocolFactory() - jsProt308 := factory307.GetProtocol(mbTrans305) + factory358 := thrift.NewTJSONProtocolFactory() + jsProt359 := factory358.GetProtocol(mbTrans356) argvalue0 := aurora.NewJobUpdateQuery() - err309 := argvalue0.Read(jsProt308) - if err309 != nil { + err360 := argvalue0.Read(context.Background(), jsProt359) + if err360 != nil { Usage() return } @@ -793,19 +793,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg310 := flag.Arg(1) - mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310)) - defer mbTrans311.Close() - _, err312 := mbTrans311.WriteString(arg310) - if err312 != nil { + arg361 := flag.Arg(1) + mbTrans362 := thrift.NewTMemoryBufferLen(len(arg361)) + defer mbTrans362.Close() + _, err363 := mbTrans362.WriteString(arg361) + if err363 != nil { Usage() return } - factory313 := thrift.NewTJSONProtocolFactory() - jsProt314 := factory313.GetProtocol(mbTrans311) + factory364 := thrift.NewTJSONProtocolFactory() + jsProt365 := factory364.GetProtocol(mbTrans362) argvalue0 := aurora.NewJobUpdateRequest() - err315 := argvalue0.Read(jsProt314) - if err315 != nil { + err366 := argvalue0.Read(context.Background(), jsProt365) + if err366 != nil { Usage() return } diff --git a/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go b/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go index 282c92a..e802328 100755 --- a/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go +++ b/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go @@ -1,22 +1,22 @@ -// Autogenerated by Thrift Compiler (0.12.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. package main import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "github.com/apache/thrift/lib/go/thrift" - "apache/aurora" + "context" + "flag" + "fmt" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" + "github.com/apache/thrift/lib/go/thrift" + "apache/aurora" ) +var _ = aurora.GoUnusedProtection__ func Usage() { fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") @@ -179,19 +179,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") flag.Usage() } - arg81 := flag.Arg(1) - mbTrans82 := thrift.NewTMemoryBufferLen(len(arg81)) - defer mbTrans82.Close() - _, err83 := mbTrans82.WriteString(arg81) - if err83 != nil { + arg132 := flag.Arg(1) + mbTrans133 := thrift.NewTMemoryBufferLen(len(arg132)) + defer mbTrans133.Close() + _, err134 := mbTrans133.WriteString(arg132) + if err134 != nil { Usage() return } - factory84 := thrift.NewTJSONProtocolFactory() - jsProt85 := factory84.GetProtocol(mbTrans82) + factory135 := thrift.NewTJSONProtocolFactory() + jsProt136 := factory135.GetProtocol(mbTrans133) argvalue0 := aurora.NewTaskQuery() - err86 := argvalue0.Read(jsProt85) - if err86 != nil { + err137 := argvalue0.Read(context.Background(), jsProt136) + if err137 != nil { Usage() return } @@ -204,19 +204,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") flag.Usage() } - arg87 := flag.Arg(1) - mbTrans88 := thrift.NewTMemoryBufferLen(len(arg87)) - defer mbTrans88.Close() - _, err89 := mbTrans88.WriteString(arg87) - if err89 != nil { + arg138 := flag.Arg(1) + mbTrans139 := thrift.NewTMemoryBufferLen(len(arg138)) + defer mbTrans139.Close() + _, err140 := mbTrans139.WriteString(arg138) + if err140 != nil { Usage() return } - factory90 := thrift.NewTJSONProtocolFactory() - jsProt91 := factory90.GetProtocol(mbTrans88) + factory141 := thrift.NewTJSONProtocolFactory() + jsProt142 := factory141.GetProtocol(mbTrans139) argvalue0 := aurora.NewTaskQuery() - err92 := argvalue0.Read(jsProt91) - if err92 != nil { + err143 := argvalue0.Read(context.Background(), jsProt142) + if err143 != nil { Usage() return } @@ -229,19 +229,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") flag.Usage() } - arg93 := flag.Arg(1) - mbTrans94 := thrift.NewTMemoryBufferLen(len(arg93)) - defer mbTrans94.Close() - _, err95 := mbTrans94.WriteString(arg93) - if err95 != nil { + arg144 := flag.Arg(1) + mbTrans145 := thrift.NewTMemoryBufferLen(len(arg144)) + defer mbTrans145.Close() + _, err146 := mbTrans145.WriteString(arg144) + if err146 != nil { Usage() return } - factory96 := thrift.NewTJSONProtocolFactory() - jsProt97 := factory96.GetProtocol(mbTrans94) + factory147 := thrift.NewTJSONProtocolFactory() + jsProt148 := factory147.GetProtocol(mbTrans145) argvalue0 := aurora.NewTaskQuery() - err98 := argvalue0.Read(jsProt97) - if err98 != nil { + err149 := argvalue0.Read(context.Background(), jsProt148) + if err149 != nil { Usage() return } @@ -254,19 +254,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") flag.Usage() } - arg99 := flag.Arg(1) - mbTrans100 := thrift.NewTMemoryBufferLen(len(arg99)) - defer mbTrans100.Close() - _, err101 := mbTrans100.WriteString(arg99) - if err101 != nil { + arg150 := flag.Arg(1) + mbTrans151 := thrift.NewTMemoryBufferLen(len(arg150)) + defer mbTrans151.Close() + _, err152 := mbTrans151.WriteString(arg150) + if err152 != nil { Usage() return } - factory102 := thrift.NewTJSONProtocolFactory() - jsProt103 := factory102.GetProtocol(mbTrans100) + factory153 := thrift.NewTJSONProtocolFactory() + jsProt154 := factory153.GetProtocol(mbTrans151) argvalue0 := aurora.NewJobKey() - err104 := argvalue0.Read(jsProt103) - if err104 != nil { + err155 := argvalue0.Read(context.Background(), jsProt154) + if err155 != nil { Usage() return } @@ -299,19 +299,19 @@ func main() { fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") flag.Usage() } - arg107 := flag.Arg(1) - mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107)) - defer mbTrans108.Close() - _, err109 := mbTrans108.WriteString(arg107) - if err109 != nil { + arg158 := flag.Arg(1) + mbTrans159 := thrift.NewTMemoryBufferLen(len(arg158)) + defer mbTrans159.Close() + _, err160 := mbTrans159.WriteString(arg158) + if err160 != nil { Usage() return } - factory110 := thrift.NewTJSONProtocolFactory() - jsProt111 := factory110.GetProtocol(mbTrans108) + factory161 := thrift.NewTJSONProtocolFactory() + jsProt162 := factory161.GetProtocol(mbTrans159) argvalue0 := aurora.NewJobConfiguration() - err112 := argvalue0.Read(jsProt111) - if err112 != nil { + err163 := argvalue0.Read(context.Background(), jsProt162) + if err163 != nil { Usage() return } @@ -324,19 +324,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") flag.Usage() } - arg113 := flag.Arg(1) - mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113)) - defer mbTrans114.Close() - _, err115 := mbTrans114.WriteString(arg113) - if err115 != nil { + arg164 := flag.Arg(1) + mbTrans165 := thrift.NewTMemoryBufferLen(len(arg164)) + defer mbTrans165.Close() + _, err166 := mbTrans165.WriteString(arg164) + if err166 != nil { Usage() return } - factory116 := thrift.NewTJSONProtocolFactory() - jsProt117 := factory116.GetProtocol(mbTrans114) + factory167 := thrift.NewTJSONProtocolFactory() + jsProt168 := factory167.GetProtocol(mbTrans165) argvalue0 := aurora.NewJobUpdateQuery() - err118 := argvalue0.Read(jsProt117) - if err118 != nil { + err169 := argvalue0.Read(context.Background(), jsProt168) + if err169 != nil { Usage() return } @@ -349,19 +349,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") flag.Usage() } - arg119 := flag.Arg(1) - mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119)) - defer mbTrans120.Close() - _, err121 := mbTrans120.WriteString(arg119) - if err121 != nil { + arg170 := flag.Arg(1) + mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170)) + defer mbTrans171.Close() + _, err172 := mbTrans171.WriteString(arg170) + if err172 != nil { Usage() return } - factory122 := thrift.NewTJSONProtocolFactory() - jsProt123 := factory122.GetProtocol(mbTrans120) + factory173 := thrift.NewTJSONProtocolFactory() + jsProt174 := factory173.GetProtocol(mbTrans171) argvalue0 := aurora.NewJobUpdateQuery() - err124 := argvalue0.Read(jsProt123) - if err124 != nil { + err175 := argvalue0.Read(context.Background(), jsProt174) + if err175 != nil { Usage() return } @@ -374,19 +374,19 @@ func main() { fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") flag.Usage() } - arg125 := flag.Arg(1) - mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125)) - defer mbTrans126.Close() - _, err127 := mbTrans126.WriteString(arg125) - if err127 != nil { + arg176 := flag.Arg(1) + mbTrans177 := thrift.NewTMemoryBufferLen(len(arg176)) + defer mbTrans177.Close() + _, err178 := mbTrans177.WriteString(arg176) + if err178 != nil { Usage() return } - factory128 := thrift.NewTJSONProtocolFactory() - jsProt129 := factory128.GetProtocol(mbTrans126) + factory179 := thrift.NewTJSONProtocolFactory() + jsProt180 := factory179.GetProtocol(mbTrans177) argvalue0 := aurora.NewJobUpdateRequest() - err130 := argvalue0.Read(jsProt129) - if err130 != nil { + err181 := argvalue0.Read(context.Background(), jsProt180) + if err181 != nil { Usage() return } diff --git a/generateBindings.sh b/generateBindings.sh index c876ef9..8cb5b9d 100755 --- a/generateBindings.sh +++ b/generateBindings.sh @@ -1,6 +1,6 @@ #! /bin/bash -THRIFT_VER=0.9.3 +THRIFT_VER=0.14.0 if [[ $(thrift -version | grep -e $THRIFT_VER -c) -ne 1 ]]; then echo "Warning: This wrapper has only been tested with version" $THRIFT_VER; diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9497185 --- /dev/null +++ b/go.mod @@ -0,0 +1,12 @@ +module github.com/paypal/gorealis + +go 1.13 + +require ( + github.com/apache/thrift v0.14.0 + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pkg/errors v0.9.1 + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a + github.com/stretchr/testify v1.7.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f3f5eb6 --- /dev/null +++ b/go.sum @@ -0,0 +1,30 @@ +github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.14.0 h1:vqZ2DP42i8th2OsgCcYZkirtbzvpZEFx53LiWDJXIAs= +github.com/apache/thrift v0.14.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs= +github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/ridv/thrift v0.12.1 h1:b80V1Oa2Mbd++jrlJZbJsIybO5/MCfbXKzd1A5v4aSo= +github.com/ridv/thrift v0.12.1/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/ridv/thrift v0.13.1 h1:/8XnTRUqJJeiuqoL7mfnJQmXQa4GJn9tUCiP7+i6Y9o= +github.com/ridv/thrift v0.13.1/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/ridv/thrift v0.13.2 h1:Q3Smr8poXd7VkWZPHvdJZzlQCJO+b5W37ECfoUL4qHc= +github.com/ridv/thrift v0.13.2/go.mod h1:yTMRF94RCZjO1fY1xt69yncvMbQCPdRL8BhbwIrjPx8= +github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a h1:EYL2xz/Zdo0hyqdZMXR4lmT2O11jDLTPCEqIe/FR6W4= +github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.0 h1:LThGCOvhuJic9Gyd1VBCkhyUXmO8vKaBFvBsJ2k03rg= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/helpers.go b/helpers.go new file mode 100644 index 0000000..56821c1 --- /dev/null +++ b/helpers.go @@ -0,0 +1,21 @@ +package realis + +import ( + "context" + + "github.com/paypal/gorealis/gen-go/apache/aurora" +) + +func (r *realisClient) jobExists(key aurora.JobKey) (bool, error) { + resp, err := r.client.GetConfigSummary(context.TODO(), &key) + if err != nil { + return false, err + } + + return resp == nil || + resp.GetResult_() == nil || + resp.GetResult_().GetConfigSummaryResult_() == nil || + resp.GetResult_().GetConfigSummaryResult_().GetSummary() == nil || + resp.GetResponseCode() != aurora.ResponseCode_OK, + nil +} diff --git a/job.go b/job.go index 029d911..8470546 100644 --- a/job.go +++ b/job.go @@ -20,6 +20,9 @@ import ( "github.com/paypal/gorealis/gen-go/apache/aurora" ) +// Job inteface is used to define a set of functions an Aurora Job object +// must implemement. +// TODO(rdelvalle): Consider getting rid of the Job interface type Job interface { // Set Job Key environment. Environment(env string) Job @@ -59,26 +62,30 @@ type Job interface { PartitionPolicy(policy *aurora.PartitionPolicy) Job Tier(tier string) Job SlaPolicy(policy *aurora.SlaPolicy) Job + Priority(priority int32) Job } -type ResourceType int +type resourceType int const ( - CPU ResourceType = iota + CPU resourceType = iota RAM DISK GPU ) -// Structure to collect all information pertaining to an Aurora job. +const portNamePrefix = "org.apache.aurora.port." + +// AuroraJob is a structure to collect all information pertaining to an Aurora job. type AuroraJob struct { - jobConfig *aurora.JobConfiguration - resources map[ResourceType]*aurora.Resource - metadata map[string]*aurora.Metadata - portCount int + jobConfig *aurora.JobConfiguration + resources map[resourceType]*aurora.Resource + metadata map[string]*aurora.Metadata + constraints map[string]*aurora.Constraint + portCount int } -// Create a Job object with everything initialized. +// NewJob is used to create a Job object with everything initialized. func NewJob() Job { jobConfig := aurora.NewJobConfiguration() taskConfig := aurora.NewTaskConfig() @@ -98,7 +105,7 @@ func NewJob() Job { ramMb := aurora.NewResource() diskMb := aurora.NewResource() - resources := map[ResourceType]*aurora.Resource{CPU: numCpus, RAM: ramMb, DISK: diskMb} + resources := map[resourceType]*aurora.Resource{CPU: numCpus, RAM: ramMb, DISK: diskMb} taskConfig.Resources = []*aurora.Resource{numCpus, ramMb, diskMb} numCpus.NumCpus = new(float64) @@ -106,37 +113,38 @@ func NewJob() Job { diskMb.DiskMb = new(int64) return &AuroraJob{ - jobConfig: jobConfig, - resources: resources, - metadata: make(map[string]*aurora.Metadata), - portCount: 0, + jobConfig: jobConfig, + resources: resources, + metadata: make(map[string]*aurora.Metadata), + constraints: make(map[string]*aurora.Constraint), + portCount: 0, } } -// Set Job Key environment. +// Environment sets the Job Key environment. func (j *AuroraJob) Environment(env string) Job { j.jobConfig.Key.Environment = env return j } -// Set Job Key Role. +// Role sets the Job Key role. func (j *AuroraJob) Role(role string) Job { j.jobConfig.Key.Role = role - //Will be deprecated + // Will be deprecated identity := &aurora.Identity{User: role} j.jobConfig.Owner = identity j.jobConfig.TaskConfig.Owner = identity return j } -// Set Job Key Name. +// Name sets the Job Key Name. func (j *AuroraJob) Name(name string) Job { j.jobConfig.Key.Name = name return j } -// Set name of the executor that will the task will be configured to. +// ExecutorName sets the name of the executor that will the task will be configured to. func (j *AuroraJob) ExecutorName(name string) Job { if j.jobConfig.TaskConfig.ExecutorConfig == nil { @@ -147,7 +155,7 @@ func (j *AuroraJob) ExecutorName(name string) Job { return j } -// Will be included as part of entire task inside the scheduler that will be serialized. +// ExecutorData sets the data blob that will be passed to the Mesos executor. func (j *AuroraJob) ExecutorData(data string) Job { if j.jobConfig.TaskConfig.ExecutorConfig == nil { @@ -158,81 +166,91 @@ func (j *AuroraJob) ExecutorData(data string) Job { return j } +// CPU sets the amount of CPU each task will use in an Aurora Job. func (j *AuroraJob) CPU(cpus float64) Job { *j.resources[CPU].NumCpus = cpus return j } +// RAM sets the amount of RAM each task will use in an Aurora Job. func (j *AuroraJob) RAM(ram int64) Job { *j.resources[RAM].RamMb = ram return j } +// Disk sets the amount of Disk each task will use in an Aurora Job. func (j *AuroraJob) Disk(disk int64) Job { *j.resources[DISK].DiskMb = disk return j } +// GPU sets the amount of GPU each task will use in an Aurora Job. func (j *AuroraJob) GPU(gpu int64) Job { // GPU resource must be set explicitly since the scheduler by default // rejects jobs with GPU resources attached to it. if _, ok := j.resources[GPU]; !ok { j.resources[GPU] = &aurora.Resource{} - j.JobConfig().GetTaskConfig().Resources = append(j.JobConfig().GetTaskConfig().Resources, j.resources[GPU]) + j.JobConfig().GetTaskConfig().Resources = append( + j.JobConfig().GetTaskConfig().Resources, + j.resources[GPU]) } j.resources[GPU].NumGpus = &gpu return j } -// How many failures to tolerate before giving up. +// MaxFailure sets how many failures to tolerate before giving up per Job. func (j *AuroraJob) MaxFailure(maxFail int32) Job { j.jobConfig.TaskConfig.MaxTaskFailures = maxFail return j } -// How many instances of the job to run +// InstanceCount sets how many instances of the task to run for this Job. func (j *AuroraJob) InstanceCount(instCount int32) Job { j.jobConfig.InstanceCount = instCount return j } +// CronSchedule allows the user to configure a cron schedule for this job to run in. func (j *AuroraJob) CronSchedule(cron string) Job { j.jobConfig.CronSchedule = &cron return j } +// CronCollisionPolicy allows the user to decide what happens if two or more instances +// of the same Cron job need to run. func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job { j.jobConfig.CronCollisionPolicy = policy return j } -// How many instances of the job to run +// GetInstanceCount returns how many tasks this Job contains. func (j *AuroraJob) GetInstanceCount() int32 { return j.jobConfig.InstanceCount } -// Restart the job's tasks if they fail +// IsService returns true if the job is a long term running job or false if it is an ad-hoc job. func (j *AuroraJob) IsService(isService bool) Job { j.jobConfig.TaskConfig.IsService = isService return j } -// Get the current job configurations key to use for some realis calls. +// JobKey returns the job's configuration key. func (j *AuroraJob) JobKey() *aurora.JobKey { return j.jobConfig.Key } -// Get the current job configurations key to use for some realis calls. +// JobConfig returns the job's configuration. func (j *AuroraJob) JobConfig() *aurora.JobConfiguration { return j.jobConfig } +// TaskConfig returns the job's task(shard) configuration. func (j *AuroraJob) TaskConfig() *aurora.TaskConfig { return j.jobConfig.TaskConfig } -// Add a list of URIs with the same extract and cache configuration. Scheduler must have +// AddURIs adds a list of URIs with the same extract and cache configuration. Scheduler must have // --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection. func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job { for _, value := range values { @@ -242,30 +260,32 @@ func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job { return j } -// Adds a Mesos label to the job. Note that Aurora will add the +// AddLabel adds a Mesos label to the job. Note that Aurora will add the // prefix "org.apache.aurora.metadata." to the beginning of each key. func (j *AuroraJob) AddLabel(key string, value string) Job { - if _, ok := j.metadata[key]; ok { - j.metadata[key].Value = value - } else { - j.metadata[key] = &aurora.Metadata{Key: key, Value: value} + if _, ok := j.metadata[key]; !ok { + j.metadata[key] = &aurora.Metadata{Key: key} j.jobConfig.TaskConfig.Metadata = append(j.jobConfig.TaskConfig.Metadata, j.metadata[key]) } + + j.metadata[key].Value = value return j } -// Add a named port to the job configuration These are random ports as it's +// AddNamedPorts adds a named port to the job configuration These are random ports as it's // not currently possible to request specific ports using Aurora. func (j *AuroraJob) AddNamedPorts(names ...string) Job { j.portCount += len(names) for _, name := range names { - j.jobConfig.TaskConfig.Resources = append(j.jobConfig.TaskConfig.Resources, &aurora.Resource{NamedPort: &name}) + j.jobConfig.TaskConfig.Resources = append( + j.jobConfig.TaskConfig.Resources, + &aurora.Resource{NamedPort: &name}) } return j } -// Adds a request for a number of ports to the job configuration. The names chosen for these ports +// AddPorts adds a request for a number of ports to the job configuration. The names chosen for these ports // will be org.apache.aurora.port.X, where X is the current port count for the job configuration // starting at 0. These are random ports as it's not currently possible to request // specific ports using Aurora. @@ -273,79 +293,99 @@ func (j *AuroraJob) AddPorts(num int) Job { start := j.portCount j.portCount += num for i := start; i < j.portCount; i++ { - portName := "org.apache.aurora.port." + strconv.Itoa(i) - j.jobConfig.TaskConfig.Resources = append(j.jobConfig.TaskConfig.Resources, &aurora.Resource{NamedPort: &portName}) + portName := portNamePrefix + strconv.Itoa(i) + j.jobConfig.TaskConfig.Resources = append( + j.jobConfig.TaskConfig.Resources, + &aurora.Resource{NamedPort: &portName}) } return j } +// AddValueConstraint allows the user to add a value constrain to the job to limit which agents the job's +// tasks can be run on. If the name matches a constraint that was previously set, the previous value will be +// overwritten. In case the previous constraint attached to the name was of type limit, the constraint will be clobbered +// by this new Value constraint. // From Aurora Docs: // Add a Value constraint // name - Mesos slave attribute that the constraint is matched against. // If negated = true , treat this as a 'not' - to avoid specific values. // Values - list of values we look for in attribute name func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) Job { - j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, - &aurora.Constraint{ - Name: name, - Constraint: &aurora.TaskConstraint{ - Value: &aurora.ValueConstraint{ - Negated: negated, - Values: values, - }, - Limit: nil, - }, - }) + if _, ok := j.constraints[name]; !ok { + j.constraints[name] = &aurora.Constraint{Name: name} + j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, j.constraints[name]) + } + + j.constraints[name].Constraint = &aurora.TaskConstraint{ + Value: &aurora.ValueConstraint{ + Negated: negated, + Values: values, + }, + Limit: nil, + } return j } +// AddLimitConstraint allows the user to limit how many tasks form the same Job are run on a single host. +// If the name matches a constraint that was previously set, the previous value will be +// overwritten. In case the previous constraint attached to the name was of type Value, the constraint will be clobbered +// by this new Limit constraint. // From Aurora Docs: // A constraint that specifies the maximum number of active tasks on a host with // a matching attribute that may be scheduled simultaneously. func (j *AuroraJob) AddLimitConstraint(name string, limit int32) Job { - j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, - &aurora.Constraint{ - Name: name, - Constraint: &aurora.TaskConstraint{ - Value: nil, - Limit: &aurora.LimitConstraint{Limit: limit}, - }, - }) + if _, ok := j.constraints[name]; !ok { + j.constraints[name] = &aurora.Constraint{Name: name} + j.jobConfig.TaskConfig.Constraints = append(j.jobConfig.TaskConfig.Constraints, j.constraints[name]) + } + + j.constraints[name].Constraint = &aurora.TaskConstraint{ + Value: nil, + Limit: &aurora.LimitConstraint{Limit: limit}, + } return j } +// AddDedicatedConstraint is a convenience function that allows the user to +// add a dedicated constraint to a Job configuration. +// In case a previous dedicated constraint was set, it will be clobbered by this new value. func (j *AuroraJob) AddDedicatedConstraint(role, name string) Job { j.AddValueConstraint("dedicated", false, role+"/"+name) return j } -// Set a container to run for the job configuration to run. +// Container sets a container to run for the job configuration to run. func (j *AuroraJob) Container(container Container) Job { j.jobConfig.TaskConfig.Container = container.Build() return j } -// Set a partition policy for the job configuration to implement. +// PartitionPolicy sets a partition policy for the job configuration to implement. func (j *AuroraJob) PartitionPolicy(policy *aurora.PartitionPolicy) Job { j.jobConfig.TaskConfig.PartitionPolicy = policy return j } -// Set the Tier for the Job. +// Tier sets the Tier for the Job. func (j *AuroraJob) Tier(tier string) Job { j.jobConfig.TaskConfig.Tier = &tier return j } -// Set an SlaPolicy for the Job. +// SlaPolicy sets an SlaPolicy for the Job. func (j *AuroraJob) SlaPolicy(policy *aurora.SlaPolicy) Job { j.jobConfig.TaskConfig.SlaPolicy = policy return j } + +func (j *AuroraJob) Priority(priority int32) Job { + j.jobConfig.TaskConfig.Priority = priority + return j +} diff --git a/logger.go b/logger.go index 34e62ee..340171f 100644 --- a/logger.go +++ b/logger.go @@ -14,65 +14,73 @@ package realis -type Logger interface { +type logger interface { Println(v ...interface{}) Printf(format string, v ...interface{}) Print(v ...interface{}) } +// NoopLogger is a logger that can be attached to the client which will not print anything. type NoopLogger struct{} +// Printf is a NOOP function here. func (NoopLogger) Printf(format string, a ...interface{}) {} +// Print is a NOOP function here. func (NoopLogger) Print(a ...interface{}) {} +// Println is a NOOP function here. func (NoopLogger) Println(a ...interface{}) {} +// LevelLogger is a logger that can be configured to output different levels of information: Debug and Trace. +// Trace should only be enabled when very in depth information about the sequence of events a function took is needed. type LevelLogger struct { - Logger + logger debug bool trace bool } +// EnableDebug enables debug level logging for the LevelLogger func (l *LevelLogger) EnableDebug(enable bool) { l.debug = enable } +// EnableTrace enables trace level logging for the LevelLogger func (l *LevelLogger) EnableTrace(enable bool) { l.trace = enable } -func (l LevelLogger) DebugPrintf(format string, a ...interface{}) { +func (l LevelLogger) debugPrintf(format string, a ...interface{}) { if l.debug { l.Printf("[DEBUG] "+format, a...) } } -func (l LevelLogger) DebugPrint(a ...interface{}) { +func (l LevelLogger) debugPrint(a ...interface{}) { if l.debug { l.Print(append([]interface{}{"[DEBUG] "}, a...)...) } } -func (l LevelLogger) DebugPrintln(a ...interface{}) { +func (l LevelLogger) debugPrintln(a ...interface{}) { if l.debug { l.Println(append([]interface{}{"[DEBUG] "}, a...)...) } } -func (l LevelLogger) TracePrintf(format string, a ...interface{}) { +func (l LevelLogger) tracePrintf(format string, a ...interface{}) { if l.trace { l.Printf("[TRACE] "+format, a...) } } -func (l LevelLogger) TracePrint(a ...interface{}) { +func (l LevelLogger) tracePrint(a ...interface{}) { if l.trace { l.Print(append([]interface{}{"[TRACE] "}, a...)...) } } -func (l LevelLogger) TracePrintln(a ...interface{}) { +func (l LevelLogger) tracePrintln(a ...interface{}) { if l.trace { l.Println(append([]interface{}{"[TRACE] "}, a...)...) } diff --git a/monitors.go b/monitors.go index 6ef7c1a..edbe4e4 100644 --- a/monitors.go +++ b/monitors.go @@ -12,35 +12,41 @@ * limitations under the License. */ -// Collection of monitors to create synchronicity package realis import ( "time" "github.com/paypal/gorealis/gen-go/apache/aurora" - "github.com/paypal/gorealis/response" "github.com/pkg/errors" ) +// Monitor is a wrapper for the Realis client which allows us to have functions +// with the same name for Monitoring purposes. +// TODO(rdelvalle): Deprecate monitors and instead add prefix Monitor to +// all functions in this file like it is done in V2. type Monitor struct { Client Realis } -// Polls the scheduler every certain amount of time to see if the update has succeeded -func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout int) (bool, error) { +// JobUpdate polls the scheduler every certain amount of time to see if the update has entered a terminal state. +func (m *Monitor) JobUpdate( + updateKey aurora.JobUpdateKey, + interval int, + timeout int) (bool, error) { - status, err := m.JobUpdateStatus(updateKey, - map[aurora.JobUpdateStatus]bool{ - aurora.JobUpdateStatus_ROLLED_FORWARD: true, - aurora.JobUpdateStatus_ROLLED_BACK: true, - aurora.JobUpdateStatus_ABORTED: true, - aurora.JobUpdateStatus_ERROR: true, - aurora.JobUpdateStatus_FAILED: true, - }, + updateQ := aurora.JobUpdateQuery{ + Key: &updateKey, + Limit: 1, + UpdateStatuses: TerminalUpdateStates(), + } + updateSummaries, err := m.JobUpdateQuery( + updateQ, time.Duration(interval)*time.Second, time.Duration(timeout)*time.Second) + status := updateSummaries[0].State.Status + if err != nil { return false, err } @@ -52,22 +58,39 @@ func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout switch status { case aurora.JobUpdateStatus_ROLLED_FORWARD: return true, nil - case aurora.JobUpdateStatus_ROLLED_BACK, aurora.JobUpdateStatus_ABORTED, aurora.JobUpdateStatus_ERROR, aurora.JobUpdateStatus_FAILED: + case aurora.JobUpdateStatus_ROLLED_BACK, + aurora.JobUpdateStatus_ABORTED, + aurora.JobUpdateStatus_ERROR, + aurora.JobUpdateStatus_FAILED: return false, errors.Errorf("bad terminal state for update: %v", status) default: return false, errors.Errorf("unexpected update state: %v", status) } } +// JobUpdateStatus polls the scheduler every certain amount of time to see if the update has entered a specified state. func (m *Monitor) JobUpdateStatus(updateKey aurora.JobUpdateKey, - desiredStatuses map[aurora.JobUpdateStatus]bool, - interval time.Duration, - timeout time.Duration) (aurora.JobUpdateStatus, error) { - + desiredStatuses []aurora.JobUpdateStatus, + interval, timeout time.Duration) (aurora.JobUpdateStatus, error) { updateQ := aurora.JobUpdateQuery{ - Key: &updateKey, - Limit: 1, + Key: &updateKey, + Limit: 1, + UpdateStatuses: desiredStatuses, } + summary, err := m.JobUpdateQuery(updateQ, interval, timeout) + if err != nil { + return 0, err + } + + return summary[0].State.Status, nil +} + +// JobUpdateQuery polls the scheduler every certain amount of time to see if the query call returns any results. +func (m *Monitor) JobUpdateQuery( + updateQuery aurora.JobUpdateQuery, + interval time.Duration, + timeout time.Duration) ([]*aurora.JobUpdateSummary, error) { + ticker := time.NewTicker(interval) defer ticker.Stop() timer := time.NewTimer(timeout) @@ -78,38 +101,103 @@ func (m *Monitor) JobUpdateStatus(updateKey aurora.JobUpdateKey, for { select { case <-ticker.C: - respDetail, cliErr = m.Client.JobUpdateDetails(updateQ) + respDetail, cliErr = m.Client.GetJobUpdateSummaries(&updateQuery) if cliErr != nil { - return aurora.JobUpdateStatus(-1), cliErr + return nil, cliErr } - updateDetail := response.JobUpdateDetails(respDetail) - - if len(updateDetail) == 0 { - m.Client.RealisConfig().logger.Println("No update found") - return aurora.JobUpdateStatus(-1), errors.New("No update found for " + updateKey.String()) - } - status := updateDetail[0].Update.Summary.State.Status - - if _, ok := desiredStatuses[status]; ok { - return status, nil + updateSummaries := respDetail.Result_.GetJobUpdateSummariesResult_.UpdateSummaries + if len(updateSummaries) >= 1 { + return updateSummaries, nil } case <-timer.C: - return aurora.JobUpdateStatus(-1), newTimedoutError(errors.New("job update monitor timed out")) + return nil, newTimedoutError(errors.New("job update monitor timed out")) } } } -// Monitor a Job until all instances enter one of the LIVE_STATES +// AutoPausedUpdateMonitor is a special monitor for auto pause enabled batch updates. This monitor ensures that the update +// being monitored is capable of auto pausing and has auto pausing enabled. After verifying this information, +// the monitor watches for the job to enter the ROLL_FORWARD_PAUSED state and calculates the current batch +// the update is in using information from the update configuration. +func (m *Monitor) AutoPausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (int, error) { + key.Job = &aurora.JobKey{ + Role: key.Job.Role, + Environment: key.Job.Environment, + Name: key.Job.Name, + } + query := aurora.JobUpdateQuery{ + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1, + Key: &key, + } + + response, err := m.Client.JobUpdateDetails(query) + if err != nil { + return -1, errors.Wrap(err, "unable to get information about update") + } + + // TODO (rdelvalle): check for possible nil values when going down the list of structs + updateDetails := response.Result_.GetJobUpdateDetailsResult_.DetailsList + if len(updateDetails) == 0 { + return -1, errors.Errorf("details for update could not be found") + } + + updateStrategy := updateDetails[0].Update.Instructions.Settings.UpdateStrategy + + var batchSizes []int32 + switch { + case updateStrategy.IsSetVarBatchStrategy(): + batchSizes = updateStrategy.VarBatchStrategy.GroupSizes + if !updateStrategy.VarBatchStrategy.AutopauseAfterBatch { + return -1, errors.Errorf("update does not have auto pause enabled") + } + case updateStrategy.IsSetBatchStrategy(): + batchSizes = []int32{updateStrategy.BatchStrategy.GroupSize} + if !updateStrategy.BatchStrategy.AutopauseAfterBatch { + return -1, errors.Errorf("update does not have auto pause enabled") + } + default: + return -1, errors.Errorf("update is not using a batch update strategy") + } + + query.UpdateStatuses = append(TerminalUpdateStates(), aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED) + summary, err := m.JobUpdateQuery(query, interval, timeout) + if err != nil { + return -1, err + } + + if !(summary[0].State.Status == aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED || + summary[0].State.Status == aurora.JobUpdateStatus_ROLLED_FORWARD) { + return -1, errors.Errorf("update is in a terminal state %v", summary[0].State.Status) + } + + updatingInstances := make(map[int32]struct{}) + for _, e := range updateDetails[0].InstanceEvents { + // We only care about INSTANCE_UPDATING actions because we only care that they've been attempted + if e != nil && e.GetAction() == aurora.JobUpdateAction_INSTANCE_UPDATING { + updatingInstances[e.GetInstanceId()] = struct{}{} + } + } + + return calculateCurrentBatch(int32(len(updatingInstances)), batchSizes), nil +} + +// Instances will monitor a Job until all instances enter one of the LIVE_STATES func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error) { return m.ScheduleStatus(key, instances, LiveStates, interval, timeout) } -// Monitor a Job until all instances enter a desired status. +// ScheduleStatus will monitor a Job until all instances enter a desired status. // Defaults sets of desired statuses provided by the thrift API include: // ACTIVE_STATES, SLAVE_ASSIGNED_STATES, LIVE_STATES, and TERMINAL_STATES -func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desiredStatuses map[aurora.ScheduleStatus]bool, interval, timeout int) (bool, error) { +func (m *Monitor) ScheduleStatus( + key *aurora.JobKey, + instanceCount int32, + desiredStatuses map[aurora.ScheduleStatus]bool, + interval int, + timeout int) (bool, error) { ticker := time.NewTicker(time.Second * time.Duration(interval)) defer ticker.Stop() @@ -142,9 +230,13 @@ func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desire } } -// Monitor host status until all hosts match the status provided. Returns a map where the value is true if the host +// HostMaintenance will monitor host status until all hosts match the status provided. +// Returns a map where the value is true if the host // is in one of the desired mode(s) or false if it is not as of the time when the monitor exited. -func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode, interval, timeout int) (map[string]bool, error) { +func (m *Monitor) HostMaintenance( + hosts []string, + modes []aurora.MaintenanceMode, + interval, timeout int) (map[string]bool, error) { // Transform modes to monitor for into a set for easy lookup desiredMode := make(map[aurora.MaintenanceMode]struct{}) @@ -153,7 +245,8 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode } // Turn slice into a host set to eliminate duplicates. - // We also can't use a simple count because multiple modes means we can have multiple matches for a single host. + // We also can't use a simple count because multiple modes means + // we can have multiple matches for a single host. // I.e. host A transitions from ACTIVE to DRAINING to DRAINED while monitored remainingHosts := make(map[string]struct{}) for _, host := range hosts { diff --git a/realis.go b/realis.go index 0b06c07..0464908 100644 --- a/realis.go +++ b/realis.go @@ -16,35 +16,38 @@ package realis import ( + "context" "crypto/tls" - "crypto/x509" "encoding/base64" "fmt" - "io/ioutil" "log" "net/http" - "net/http/cookiejar" "os" - "path/filepath" "sort" "strings" "sync" "time" "github.com/apache/thrift/lib/go/thrift" + "github.com/pkg/errors" + "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/paypal/gorealis/response" - "github.com/pkg/errors" ) -const VERSION = "1.21.0" +const version = "1.24.1" -// TODO(rdelvalle): Move documentation to interface in order to make godoc look better/more accessible +// Realis is an interface that defines the various APIs that may be used to communicate with +// the Apache Aurora scheduler. +// TODO(rdelvalle): Move documentation to interface in order to make godoc look better accessible +// Or get rid of the interface type Realis interface { AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error) AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error) CreateJob(auroraJob Job) (*aurora.Response, error) - CreateService(auroraJob Job, settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) + CreateService( + auroraJob Job, + settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, error) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error) @@ -62,14 +65,13 @@ type Realis interface { RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error) ScheduleCronJob(auroraJob Job) (*aurora.Response, error) StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error) - PauseJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error) ResumeJobUpdate(key *aurora.JobUpdateKey, message string) (*aurora.Response, error) PulseJobUpdate(key *aurora.JobUpdateKey) (*aurora.Response, error) StartCronJob(key *aurora.JobKey) (*aurora.Response, error) // TODO: Remove this method and make it private to avoid race conditions ReestablishConn() error - RealisConfig() *RealisConfig + RealisConfig() *config Close() // Admin functions @@ -89,7 +91,7 @@ type Realis interface { } type realisClient struct { - config *RealisConfig + config *config client *aurora.AuroraSchedulerManagerClient readonlyClient *aurora.ReadOnlySchedulerClient adminClient *aurora.AuroraAdminClient @@ -99,7 +101,7 @@ type realisClient struct { transport thrift.TTransport } -type RealisConfig struct { +type config struct { username, password string url string timeoutms int @@ -109,13 +111,15 @@ type RealisConfig struct { transport thrift.TTransport protoFactory thrift.TProtocolFactory logger *LevelLogger - InsecureSkipVerify bool + insecureSkipVerify bool certspath string - clientkey, clientcert string + certExtensions map[string]struct{} + clientKey, clientCert string options []ClientOption debug bool trace bool zkOptions []ZKOpt + failOnPermanentErrors bool } var defaultBackoff = Backoff{ @@ -125,39 +129,52 @@ var defaultBackoff = Backoff{ Jitter: 0.1, } -type ClientOption func(*RealisConfig) +var defaultSlaPolicy = aurora.SlaPolicy{ + PercentageSlaPolicy: &aurora.PercentageSlaPolicy{ + Percentage: 66, + DurationSecs: 300, + }, +} -//Config sets for options in RealisConfig. +const defaultSlaDrainTimeoutSecs = 900 + +// ClientOption is an alias for a function that modifies the realis config object +type ClientOption func(*config) + +// BasicAuth sets authentication used against Apache Shiro in the Aurora scheduler func BasicAuth(username, password string) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.username = username config.password = password } } +// SchedulerUrl sets the immediate location of the current Aurora scheduler leader func SchedulerUrl(url string) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.url = url } } +// TimeoutMS sets the connection timeout for an HTTP post request in Miliseconds func TimeoutMS(timeout int) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.timeoutms = timeout } } +// ZKCluster sets a clusters.json provided cluster configuration to the client func ZKCluster(cluster *Cluster) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.cluster = cluster } } +// ZKUrl sets the direct location of a Zookeeper node on which the Aurora leader registers itself func ZKUrl(url string) ClientOption { - opts := []ZKOpt{ZKEndpoints(strings.Split(url, ",")...), ZKPath("/aurora/scheduler")} - return func(config *RealisConfig) { + return func(config *config) { if config.zkOptions == nil { config.zkOptions = opts } else { @@ -166,113 +183,153 @@ func ZKUrl(url string) ClientOption { } } +// Retries configures the retry mechanism for the client func Retries(backoff Backoff) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.backoff = backoff } } +// ThriftJSON configures the client to use the Thrift JSON protocol. func ThriftJSON() ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.jsonTransport = true } } +// ThriftBinary configures the client to use the Thrift Binary protocol. func ThriftBinary() ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.binTransport = true } } +// BackOff is an alternative name for the Retry mechanism configuration. func BackOff(b Backoff) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.backoff = b } } -func InsecureSkipVerify(InsecureSkipVerify bool) ClientOption { - return func(config *RealisConfig) { - config.InsecureSkipVerify = InsecureSkipVerify +// InsecureSkipVerify configures the client to not check for matching hosts names on certificates +// when using an SSL enabled Aurora scheduler. +func InsecureSkipVerify(insecureSkipVerify bool) ClientOption { + return func(config *config) { + config.insecureSkipVerify = insecureSkipVerify } } +// Certspath sets the directory where the server certificates to be used when connecting to an SSL enabled +// Aurora scheduler are stored. func Certspath(certspath string) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.certspath = certspath } } +// ClientCerts allows users to set client key and certificate when connecting to an SSL enabled +// Aurora scheduler. func ClientCerts(clientKey, clientCert string) ClientOption { - return func(config *RealisConfig) { - config.clientkey, config.clientcert = clientKey, clientCert + return func(config *config) { + config.clientKey, config.clientCert = clientKey, clientCert } } -// Use this option if you'd like to override default settings for connecting to Zookeeper. +// CertExtensions configures gorealis to consider files with the given extensions when +// loading certificates from the cert path. +func CertExtensions(extensions ...string) ClientOption { + extensionsLookup := make(map[string]struct{}) + for _, ext := range extensions { + extensionsLookup[ext] = struct{}{} + } + return func(config *config) { + config.certExtensions = extensionsLookup + } +} + +// ZookeeperOptions allows users to override default settings for connecting to Zookeeper. // See zk.go for what is possible to set as an option. func ZookeeperOptions(opts ...ZKOpt) ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.zkOptions = opts } } -// Using the word set to avoid name collision with Interface. -func SetLogger(l Logger) ClientOption { - return func(config *RealisConfig) { - config.logger = &LevelLogger{Logger: l} +// SetLogger allows the user to attach a logger that implements the logger interface in logger.go +// to the client. +func SetLogger(l logger) ClientOption { + return func(config *config) { + config.logger = &LevelLogger{logger: l} } } -// Enable debug statements. +// Debug enables debug statements in the client. func Debug() ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.debug = true } } -// Enable debug statements. +// Trace enables debug statements in the client. func Trace() ClientOption { - return func(config *RealisConfig) { + return func(config *config) { config.trace = true } } -func newTJSONTransport(url string, timeout int, config *RealisConfig) (thrift.TTransport, error) { +// FailOnPermanentErrors allows the client to stop upon encountering a connection error the standard library +// considers permanent and return an error to the user. +func FailOnPermanentErrors() ClientOption { + return func(config *config) { + config.failOnPermanentErrors = true + } +} + +func newTJSONTransport(url string, timeout int, config *config) (thrift.TTransport, error) { trans, err := defaultTTransport(url, timeout, config) if err != nil { - return nil, errors.Wrap(err, "Error creating realis") + return nil, errors.Wrap(err, "unable to create transport") } - httpTrans := (trans).(*thrift.THttpClient) + httpTrans, ok := (trans).(*thrift.THttpClient) + if !ok { + return nil, errors.Wrap(err, "transport does not contain a thrift client") + } + httpTrans.SetHeader("Content-Type", "application/x-thrift") - httpTrans.SetHeader("User-Agent", "GoRealis v"+VERSION) + httpTrans.SetHeader("User-Agent", "gorealis v"+version) return trans, err } -func newTBinTransport(url string, timeout int, config *RealisConfig) (thrift.TTransport, error) { +func newTBinTransport(url string, timeout int, config *config) (thrift.TTransport, error) { trans, err := defaultTTransport(url, timeout, config) if err != nil { - return nil, errors.Wrap(err, "Error creating realis") + return nil, errors.Wrap(err, "unable to create transport") } - httpTrans := (trans).(*thrift.THttpClient) + httpTrans, ok := (trans).(*thrift.THttpClient) + if !ok { + return nil, errors.Wrap(err, "transport does not contain a thrift client") + } + httpTrans.DelHeader("Content-Type") // Workaround for using thrift HttpPostClient httpTrans.SetHeader("Accept", "application/vnd.apache.thrift.binary") httpTrans.SetHeader("Content-Type", "application/vnd.apache.thrift.binary") - httpTrans.SetHeader("User-Agent", "GoRealis v"+VERSION) + httpTrans.SetHeader("User-Agent", "gorealis v"+version) return trans, err } -// This client implementation of the realis interface uses a retry mechanism for all Thrift Calls. +// NewRealisClient is a client implementation of the realis interface uses a retry mechanism for all Thrift Calls. // It will retry all calls which result in a temporary failure as well as calls that fail due to an EOF // being returned by the http client. Most permanent failures are now being caught by the thriftCallWithRetries // function and not being retried but there may be corner cases not yet handled. func NewRealisClient(options ...ClientOption) (Realis, error) { - config := &RealisConfig{} + config := &config{} // Default configs config.timeoutms = 10000 config.backoff = defaultBackoff - config.logger = &LevelLogger{Logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)} + config.logger = &LevelLogger{logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC)} + config.certExtensions = map[string]struct{}{".crt": {}, ".pem": {}, ".key": {}} // Save options to recreate client if a connection error happens config.options = options @@ -286,13 +343,13 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { // Turn off all logging (including debug) if config.logger == nil { - config.logger = &LevelLogger{Logger: NoopLogger{}} + config.logger = &LevelLogger{logger: NoopLogger{}} } // Set a logger if debug has been set to true but no logger has been set if config.logger == nil && config.debug { config.logger = &LevelLogger{ - Logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC), + logger: log.New(os.Stdout, "realis: ", log.Ltime|log.Ldate|log.LUTC), debug: true, } } @@ -304,9 +361,9 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { config.logger.EnableDebug(config.debug) config.logger.EnableTrace(config.trace) - config.logger.DebugPrintln("Number of options applied to config: ", len(options)) + config.logger.debugPrintln("Number of options applied to config: ", len(options)) - //Set default Transport to JSON if needed. + // Set default Transport to JSON if needed. if !config.jsonTransport && !config.binTransport { config.jsonTransport = true } @@ -318,7 +375,7 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { if config.zkOptions != nil { url, err = LeaderFromZKOpts(config.zkOptions...) if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "LeaderFromZK error")) + return nil, NewTemporaryError(errors.Wrap(err, "unable to use zk to get leader")) } config.logger.Println("Scheduler URL from ZK: ", url) } else if config.cluster != nil { @@ -327,20 +384,27 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { url, err = LeaderFromZK(*config.cluster) // If ZK is configured, throw an error if the leader is unable to be determined if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "LeaderFromZK error")) + return nil, NewTemporaryError(errors.Wrap(err, "unable to use zk to get leader")) } config.logger.Println("Scheduler URL from ZK: ", url) } else if config.url != "" { url = config.url config.logger.Println("Scheduler URL: ", url) } else { - return nil, errors.New("Incomplete Options -- url, cluster.json, or Zookeeper address required") + return nil, errors.New("incomplete Options -- url, cluster.json, or Zookeeper address required") } + config.logger.Println("Address obtained: ", url) + url, err = validateAuroraURL(url) + if err != nil { + return nil, errors.Wrap(err, "invalid Aurora url") + } + config.logger.Println("Corrected address: ", url) + if config.jsonTransport { trans, err := newTJSONTransport(url, config.timeoutms, config) if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "Error creating realis")) + return nil, NewTemporaryError(err) } config.transport = trans config.protoFactory = thrift.NewTJSONProtocolFactory() @@ -348,7 +412,7 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { } else if config.binTransport { trans, err := newTBinTransport(url, config.timeoutms, config) if err != nil { - return nil, NewTemporaryError(errors.Wrap(err, "Error creating realis")) + return nil, NewTemporaryError(err) } config.transport = trans config.protoFactory = thrift.NewTBinaryProtocolFactoryDefault() @@ -358,7 +422,10 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { // Adding Basic Authentication. if config.username != "" && config.password != "" { - httpTrans := (config.transport).(*thrift.THttpClient) + httpTrans, ok := (config.transport).(*thrift.THttpClient) + if !ok { + return nil, errors.New("transport provided does not contain an THttpClient") + } httpTrans.SetHeader("Authorization", "Basic "+basicAuth(config.username, config.password)) } @@ -367,11 +434,14 @@ func NewRealisClient(options ...ClientOption) (Realis, error) { client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory), readonlyClient: aurora.NewReadOnlySchedulerClientFactory(config.transport, config.protoFactory), adminClient: aurora.NewAuroraAdminClientFactory(config.transport, config.protoFactory), - logger: LevelLogger{Logger: config.logger, debug: config.debug, trace: config.trace}, + logger: LevelLogger{logger: config.logger, debug: config.debug, trace: config.trace}, lock: &sync.Mutex{}, - transport: config.transport}, nil + transport: config.transport, + }, nil } +// GetDefaultClusterFromZKUrl creates a cluster object from a Zoookeper url. This is deprecated in favor of using +// Zookeeper options. func GetDefaultClusterFromZKUrl(zkurl string) *Cluster { return &Cluster{ Name: "defaultCluster", @@ -383,53 +453,30 @@ func GetDefaultClusterFromZKUrl(zkurl string) *Cluster { } } -func GetCerts(certpath string) (*x509.CertPool, error) { - globalRootCAs := x509.NewCertPool() - caFiles, err := ioutil.ReadDir(certpath) - if err != nil { - return nil, err - } - for _, cert := range caFiles { - capathfile := filepath.Join(certpath, cert.Name()) - caCert, err := ioutil.ReadFile(capathfile) - if err != nil { - return nil, err - } - globalRootCAs.AppendCertsFromPEM(caCert) - } - return globalRootCAs, nil -} - // Creates a default Thrift Transport object for communications in gorealis using an HTTP Post Client -func defaultTTransport(urlstr string, timeoutms int, config *RealisConfig) (thrift.TTransport, error) { - jar, err := cookiejar.New(nil) - if err != nil { - return &thrift.THttpClient{}, errors.Wrap(err, "Error creating Cookie Jar") - } +func defaultTTransport(url string, timeoutMs int, config *config) (thrift.TTransport, error) { var transport http.Transport if config != nil { - tlsConfig := &tls.Config{} - if config.InsecureSkipVerify { - tlsConfig.InsecureSkipVerify = true - } + tlsConfig := &tls.Config{InsecureSkipVerify: config.insecureSkipVerify} + if config.certspath != "" { - rootCAs, err := GetCerts(config.certspath) + rootCAs, err := createCertPool(config.certspath, config.certExtensions) if err != nil { - config.logger.Println("error occured couldn't fetch certs") + config.logger.Println("error occurred couldn't fetch certs") return nil, err } tlsConfig.RootCAs = rootCAs } - if config.clientkey != "" && config.clientcert == "" { - return nil, fmt.Errorf("have to provide both client key,cert. Only client key provided ") + if config.clientKey != "" && config.clientCert == "" { + return nil, fmt.Errorf("have to provide both client key, cert. Only client key provided ") } - if config.clientkey == "" && config.clientcert != "" { - return nil, fmt.Errorf("have to provide both client key,cert. Only client cert provided ") + if config.clientKey == "" && config.clientCert != "" { + return nil, fmt.Errorf("have to provide both client key, cert. Only client cert provided ") } - if config.clientkey != "" && config.clientcert != "" { - cert, err := tls.LoadX509KeyPair(config.clientcert, config.clientkey) + if config.clientKey != "" && config.clientCert != "" { + cert, err := tls.LoadX509KeyPair(config.clientCert, config.clientKey) if err != nil { - config.logger.Println("error occured loading client certs and keys") + config.logger.Println("error occurred loading client certs and keys") return nil, err } tlsConfig.Certificates = []tls.Certificate{cert} @@ -437,58 +484,26 @@ func defaultTTransport(urlstr string, timeoutms int, config *RealisConfig) (thri transport.TLSClientConfig = tlsConfig } - trans, err := thrift.NewTHttpPostClientWithOptions(urlstr+"/api", - thrift.THttpClientOptions{Client: &http.Client{Timeout: time.Millisecond * time.Duration(timeoutms), Transport: &transport, Jar: jar}}) + trans, err := thrift.NewTHttpClientWithOptions( + url, + thrift.THttpClientOptions{ + Client: &http.Client{ + Timeout: time.Millisecond * time.Duration(timeoutMs), + Transport: &transport, + }, + }) if err != nil { - return &thrift.THttpClient{}, errors.Wrap(err, "Error creating transport") + return nil, errors.Wrap(err, "error creating transport") } if err := trans.Open(); err != nil { - return &thrift.THttpClient{}, errors.Wrapf(err, "Error opening connection to %s", urlstr) + return nil, errors.Wrapf(err, "error opening connection to %s", url) } return trans, nil } -// Create a default configuration of the transport layer, requires a URL to test connection with. -// Uses HTTP Post as transport layer and Thrift JSON as the wire protocol by default. -func newDefaultConfig(url string, timeoutms int, config *RealisConfig) (*RealisConfig, error) { - return newTJSONConfig(url, timeoutms, config) -} - -// Creates a realis config object using HTTP Post and Thrift JSON protocol to communicate with Aurora. -func newTJSONConfig(url string, timeoutms int, config *RealisConfig) (*RealisConfig, error) { - trans, err := defaultTTransport(url, timeoutms, config) - if err != nil { - return &RealisConfig{}, errors.Wrap(err, "Error creating realis config") - } - - httpTrans := (trans).(*thrift.THttpClient) - httpTrans.SetHeader("Content-Type", "application/x-thrift") - httpTrans.SetHeader("User-Agent", "gorealis v"+VERSION) - - return &RealisConfig{transport: trans, protoFactory: thrift.NewTJSONProtocolFactory()}, nil -} - -// Creates a realis config config using HTTP Post and Thrift Binary protocol to communicate with Aurora. -func newTBinaryConfig(url string, timeoutms int, config *RealisConfig) (*RealisConfig, error) { - trans, err := defaultTTransport(url, timeoutms, config) - if err != nil { - return &RealisConfig{}, errors.Wrap(err, "Error creating realis config") - } - - httpTrans := (trans).(*thrift.THttpClient) - httpTrans.DelHeader("Content-Type") // Workaround for using thrift HttpPostClient - - httpTrans.SetHeader("Accept", "application/vnd.apache.thrift.binary") - httpTrans.SetHeader("Content-Type", "application/vnd.apache.thrift.binary") - httpTrans.SetHeader("User-Agent", "gorealis v"+VERSION) - - return &RealisConfig{transport: trans, protoFactory: thrift.NewTBinaryProtocolFactoryDefault()}, nil - -} - func basicAuth(username, password string) string { auth := username + ":" + password return base64.StdEncoding.EncodeToString([]byte(auth)) @@ -497,6 +512,10 @@ func basicAuth(username, password string) string { func (r *realisClient) ReestablishConn() error { // Close existing connection r.logger.Println("Re-establishing Connection to Aurora") + + // This call must happen before we lock as it also uses + // the same lock from the client since close can be called + // by anyone from anywhere. r.Close() r.lock.Lock() @@ -522,33 +541,36 @@ func (r *realisClient) ReestablishConn() error { return nil } -// Releases resources associated with the realis client. +// Close releases resources associated with the realis client. func (r *realisClient) Close() { r.lock.Lock() defer r.lock.Unlock() - r.transport.Close() + // The return value of Close here is ignored on purpose because there's nothing that can be done if it fails. + _ = r.transport.Close() } -// Uses predefined set of states to retrieve a set of active jobs in Apache Aurora. +// GetInstanceIds uses a predefined set of states to retrieve a set of active jobs in the Aurora Scheduler. func (r *realisClient) GetInstanceIds(key *aurora.JobKey, states []aurora.ScheduleStatus) ([]int32, error) { taskQ := &aurora.TaskQuery{ - Role: &key.Role, - Environment: &key.Environment, - JobName: &key.Name, - Statuses: states, + JobKeys: []*aurora.JobKey{{Environment: key.Environment, Role: key.Role, Name: key.Name}}, + Statuses: states, } - r.logger.DebugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", taskQ) + r.logger.debugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", taskQ) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetTasksWithoutConfigs(nil, taskQ) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksWithoutConfigs(context.TODO(), taskQ) + }, + nil, + ) // If we encountered an error we couldn't recover from by retrying, return an error to the user if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error querying Aurora Scheduler for active IDs") + return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for active IDs") } // Construct instance id map to stay in line with thrift's representation of sets @@ -563,14 +585,22 @@ func (r *realisClient) GetInstanceIds(key *aurora.JobKey, states []aurora.Schedu func (r *realisClient) GetJobUpdateSummaries(jobUpdateQuery *aurora.JobUpdateQuery) (*aurora.Response, error) { - r.logger.DebugPrintf("GetJobUpdateSummaries Thrift Payload: %+v\n", jobUpdateQuery) + r.logger.debugPrintf("GetJobUpdateSummaries Thrift Payload: %+v\n", jobUpdateQuery) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.readonlyClient.GetJobUpdateSummaries(nil, jobUpdateQuery) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.readonlyClient.GetJobUpdateSummaries(context.TODO(), jobUpdateQuery) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error getting job update summaries from Aurora Scheduler") + return resp, errors.Wrap(retryErr, "error getting job update summaries from Aurora Scheduler") + } + + if resp.GetResult_() == nil || resp.GetResult_().GetGetJobUpdateSummariesResult_() == nil { + return nil, errors.New("unexpected response from scheduler") } return resp, nil @@ -580,12 +610,16 @@ func (r *realisClient) GetJobs(role string) (*aurora.Response, *aurora.GetJobsRe var result *aurora.GetJobsResult_ - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.readonlyClient.GetJobs(nil, role) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.readonlyClient.GetJobs(context.TODO(), role) + }, + nil, + ) if retryErr != nil { - return nil, result, errors.Wrap(retryErr, "Error getting Jobs from Aurora Scheduler") + return nil, result, errors.Wrap(retryErr, "error getting Jobs from Aurora Scheduler") } if resp.GetResult_() != nil { @@ -595,99 +629,135 @@ func (r *realisClient) GetJobs(role string) (*aurora.Response, *aurora.GetJobsRe return resp, result, nil } -// Kill specific instances of a job. +// KillInstances kills specific instances of a job. func (r *realisClient) KillInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) { - r.logger.DebugPrintf("KillTasks Thrift Payload: %+v %v\n", key, instances) + r.logger.debugPrintf("KillTasks Thrift Payload: %+v %v\n", key, instances) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.KillTasks(nil, key, instances, "") - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.KillTasks(context.TODO(), key, instances, "") + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Kill command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") } return resp, nil } -func (r *realisClient) RealisConfig() *RealisConfig { +func (r *realisClient) RealisConfig() *config { return r.config } -// Sends a kill message to the scheduler for all active tasks under a job. +// KillJob kills all instances of a job. func (r *realisClient) KillJob(key *aurora.JobKey) (*aurora.Response, error) { - r.logger.DebugPrintf("KillTasks Thrift Payload: %+v\n", key) + r.logger.debugPrintf("KillTasks Thrift Payload: %+v\n", key) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - // Giving the KillTasks thrift call an empty set tells the Aurora scheduler to kill all active shards - return r.client.KillTasks(nil, key, nil, "") - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + // Giving the KillTasks thrift call an empty set tells the Aurora scheduler to kill all active shards + return r.client.KillTasks(context.TODO(), key, nil, "") + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Kill command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Kill command to Aurora Scheduler") } return resp, nil } -// Sends a create job message to the scheduler with a specific job configuration. +// CreateJob sends a create job message to the scheduler with a specific job configuration. // Although this API is able to create service jobs, it is better to use CreateService instead // as that API uses the update thrift call which has a few extra features available. // Use this API to create ad-hoc jobs. func (r *realisClient) CreateJob(auroraJob Job) (*aurora.Response, error) { - r.logger.DebugPrintf("CreateJob Thrift Payload: %+v\n", auroraJob.JobConfig()) + r.logger.debugPrintf("CreateJob Thrift Payload: %+v\n", auroraJob.JobConfig()) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.CreateJob(nil, auroraJob.JobConfig()) - }) + // Response is checked by the thrift retry code + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.CreateJob(context.TODO(), auroraJob.JobConfig()) + }, + // On a client timeout, attempt to verify that payload made to the Scheduler by + // trying to get the config summary for the job key + func() (*aurora.Response, bool) { + exists, err := r.jobExists(*auroraJob.JobKey()) + if err != nil { + r.logger.Print("verification failed ", err) + } + + if exists { + return &aurora.Response{ResponseCode: aurora.ResponseCode_OK}, true + } + + return nil, false + }, + ) if retryErr != nil { - return resp, errors.Wrap(retryErr, "Error sending Create command to Aurora Scheduler") + return resp, errors.Wrap(retryErr, "error sending Create command to Aurora Scheduler") } + return resp, nil } -// This API uses an update thrift call to create the services giving a few more robust features. -func (r *realisClient) CreateService(auroraJob Job, settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) { +// CreateService uses the scheduler's updating mechanism to create a job. +func (r *realisClient) CreateService( + auroraJob Job, + settings *aurora.JobUpdateSettings) (*aurora.Response, *aurora.StartJobUpdateResult_, error) { // Create a new job update object and ship it to the StartJobUpdate api update := NewUpdateJob(auroraJob.TaskConfig(), settings) update.InstanceCount(auroraJob.GetInstanceCount()) resp, err := r.StartJobUpdate(update, "") if err != nil { + if IsTimeout(err) { + return nil, nil, err + } return resp, nil, errors.Wrap(err, "unable to create service") } - if resp.GetResult_() != nil { - return resp, resp.GetResult_().GetStartJobUpdateResult_(), nil - } - - return nil, nil, errors.New("results object is nil") + return resp, resp.GetResult_().StartJobUpdateResult_, nil } func (r *realisClient) ScheduleCronJob(auroraJob Job) (*aurora.Response, error) { - r.logger.DebugPrintf("ScheduleCronJob Thrift Payload: %+v\n", auroraJob.JobConfig()) + r.logger.debugPrintf("ScheduleCronJob Thrift Payload: %+v\n", auroraJob.JobConfig()) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.ScheduleCronJob(nil, auroraJob.JobConfig()) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.ScheduleCronJob(context.TODO(), auroraJob.JobConfig()) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Cron Job Schedule message to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Cron Job Schedule message to Aurora Scheduler") } return resp, nil } func (r *realisClient) DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, error) { - r.logger.DebugPrintf("DescheduleCronJob Thrift Payload: %+v\n", key) + r.logger.debugPrintf("DescheduleCronJob Thrift Payload: %+v\n", key) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.DescheduleCronJob(nil, key) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.DescheduleCronJob(context.TODO(), key) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Cron Job De-schedule message to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Cron Job De-schedule message to Aurora Scheduler") } return resp, nil @@ -696,169 +766,248 @@ func (r *realisClient) DescheduleCronJob(key *aurora.JobKey) (*aurora.Response, func (r *realisClient) StartCronJob(key *aurora.JobKey) (*aurora.Response, error) { - r.logger.DebugPrintf("StartCronJob Thrift Payload: %+v\n", key) + r.logger.debugPrintf("StartCronJob Thrift Payload: %+v\n", key) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.StartCronJob(nil, key) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.StartCronJob(context.TODO(), key) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Start Cron Job message to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Start Cron Job message to Aurora Scheduler") } return resp, nil } -// Restarts specific instances specified +// RestartInstances restarts the specified instances of a Job. func (r *realisClient) RestartInstances(key *aurora.JobKey, instances ...int32) (*aurora.Response, error) { - r.logger.DebugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instances) + r.logger.debugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instances) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.RestartShards(nil, key, instances) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RestartShards(context.TODO(), key, instances) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Restart command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") } return resp, nil } -// Restarts all active tasks under a job configuration. +// RestartJob restarts all active instances of a Job. func (r *realisClient) RestartJob(key *aurora.JobKey) (*aurora.Response, error) { instanceIds, err1 := r.GetInstanceIds(key, aurora.ACTIVE_STATES) if err1 != nil { - return nil, errors.Wrap(err1, "Could not retrieve relevant task instance IDs") + return nil, errors.Wrap(err1, "could not retrieve relevant task instance IDs") } - r.logger.DebugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instanceIds) + r.logger.debugPrintf("RestartShards Thrift Payload: %+v %v\n", key, instanceIds) if len(instanceIds) > 0 { - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.RestartShards(nil, key, instanceIds) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RestartShards(context.TODO(), key, instanceIds) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending Restart command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending Restart command to Aurora Scheduler") } return resp, nil - } else { - return nil, errors.New("No tasks in the Active state") } + + return nil, errors.New("No tasks in the Active state") } -// Update all tasks under a job configuration. Currently gorealis doesn't support for canary deployments. +// StartJobUpdate updates all instances under a job configuration. func (r *realisClient) StartJobUpdate(updateJob *UpdateJob, message string) (*aurora.Response, error) { - r.logger.DebugPrintf("StartJobUpdate Thrift Payload: %+v %v\n", updateJob, message) + r.logger.debugPrintf("StartJobUpdate Thrift Payload: %+v %v\n", updateJob, message) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.StartJobUpdate(nil, updateJob.req, message) - }) + resp, retryErr := r.thriftCallWithRetries( + true, + func() (*aurora.Response, error) { + return r.client.StartJobUpdate(context.TODO(), updateJob.req, message) + }, + func() (*aurora.Response, bool) { + summariesResp, err := r.readonlyClient.GetJobUpdateSummaries( + context.TODO(), + &aurora.JobUpdateQuery{ + JobKey: updateJob.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1, + }) + + if err != nil { + r.logger.Print("verification failed ", err) + return nil, false + } + + summaries := response.JobUpdateSummaries(summariesResp) + if len(summaries) == 0 { + return nil, false + } + + return &aurora.Response{ + ResponseCode: aurora.ResponseCode_OK, + Result_: &aurora.Result_{ + StartJobUpdateResult_: &aurora.StartJobUpdateResult_{ + UpdateSummary: summaries[0], + Key: summaries[0].Key, + }, + }, + }, true + }, + ) if retryErr != nil { - return resp, errors.Wrap(retryErr, "Error sending StartJobUpdate command to Aurora Scheduler") + // A timeout took place when attempting this call, attempt to recover + if IsTimeout(retryErr) { + return nil, retryErr + } + + return resp, errors.Wrap(retryErr, "error sending StartJobUpdate command to Aurora Scheduler") } + + if resp.GetResult_() == nil { + return resp, errors.New("no result in response") + } + return resp, nil } -// Abort Job Update on Aurora. Requires the updateId which can be obtained on the Aurora web UI. +// AbortJobUpdate terminates a job update in the scheduler. +// It requires the updateId which can be obtained on the Aurora web UI. // This API is meant to be synchronous. It will attempt to wait until the update transitions to the aborted state. // However, if the job update does not transition to the ABORT state an error will be returned. func (r *realisClient) AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error) { - r.logger.DebugPrintf("AbortJobUpdate Thrift Payload: %+v %v\n", updateKey, message) + r.logger.debugPrintf("AbortJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.AbortJobUpdate(nil, &updateKey, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.AbortJobUpdate(context.TODO(), &updateKey, message) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending AbortJobUpdate command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending AbortJobUpdate command to Aurora Scheduler") } // Make this call synchronous by blocking until it job has successfully transitioned to aborted m := Monitor{Client: r} - _, err := m.JobUpdateStatus(updateKey, map[aurora.JobUpdateStatus]bool{aurora.JobUpdateStatus_ABORTED: true}, time.Second*5, time.Minute) + _, err := m.JobUpdateStatus( + updateKey, + []aurora.JobUpdateStatus{aurora.JobUpdateStatus_ABORTED}, + time.Second*5, + time.Minute) return resp, err } -//Pause Job Update. UpdateID is returned from StartJobUpdate or the Aurora web UI. +// PauseJobUpdate pauses the progress of an ongoing update. +// The UpdateID value needed for this function is returned from StartJobUpdate or can be obtained from the Aurora web UI. func (r *realisClient) PauseJobUpdate(updateKey *aurora.JobUpdateKey, message string) (*aurora.Response, error) { - r.logger.DebugPrintf("PauseJobUpdate Thrift Payload: %+v %v\n", updateKey, message) + r.logger.debugPrintf("PauseJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.PauseJobUpdate(nil, updateKey, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.PauseJobUpdate(context.TODO(), updateKey, message) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending PauseJobUpdate command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending PauseJobUpdate command to Aurora Scheduler") } return resp, nil } -//Resume Paused Job Update. UpdateID is returned from StartJobUpdate or the Aurora web UI. +// ResumeJobUpdate resumes a previously Paused Job update. func (r *realisClient) ResumeJobUpdate(updateKey *aurora.JobUpdateKey, message string) (*aurora.Response, error) { - r.logger.DebugPrintf("ResumeJobUpdate Thrift Payload: %+v %v\n", updateKey, message) + r.logger.debugPrintf("ResumeJobUpdate Thrift Payload: %+v %v\n", updateKey, message) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.ResumeJobUpdate(nil, updateKey, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.ResumeJobUpdate(context.TODO(), updateKey, message) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending ResumeJobUpdate command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending ResumeJobUpdate command to Aurora Scheduler") } return resp, nil } -//Pulse Job Update on Aurora. UpdateID is returned from StartJobUpdate or the Aurora web UI. +// PulseJobUpdate sends a pulse to an ongoing Job update. func (r *realisClient) PulseJobUpdate(updateKey *aurora.JobUpdateKey) (*aurora.Response, error) { - r.logger.DebugPrintf("PulseJobUpdate Thrift Payload: %+v\n", updateKey) + r.logger.debugPrintf("PulseJobUpdate Thrift Payload: %+v\n", updateKey) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.PulseJobUpdate(nil, updateKey) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.PulseJobUpdate(context.TODO(), updateKey) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending PulseJobUpdate command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending PulseJobUpdate command to Aurora Scheduler") } return resp, nil } -// Scale up the number of instances under a job configuration using the configuration for specific -// instance to scale up. +// AddInstances scales up the number of instances for a Job. func (r *realisClient) AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error) { - r.logger.DebugPrintf("AddInstances Thrift Payload: %+v %v\n", instKey, count) + r.logger.debugPrintf("AddInstances Thrift Payload: %+v %v\n", instKey, count) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.AddInstances(nil, &instKey, count) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.AddInstances(context.TODO(), &instKey, count) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error sending AddInstances command to Aurora Scheduler") + return nil, errors.Wrap(retryErr, "error sending AddInstances command to Aurora Scheduler") } return resp, nil } -// Scale down the number of instances under a job configuration using the configuration of a specific instance +// RemoveInstances scales down the number of instances for a Job. func (r *realisClient) RemoveInstances(key *aurora.JobKey, count int32) (*aurora.Response, error) { instanceIds, err := r.GetInstanceIds(key, aurora.ACTIVE_STATES) if err != nil { - return nil, errors.Wrap(err, "RemoveInstances: Could not retrieve relevant instance IDs") + return nil, errors.Wrap(err, "could not retrieve relevant instance IDs") } if len(instanceIds) < int(count) { - return nil, errors.Errorf("Insufficient active instances available for killing: "+ + return nil, errors.Errorf("insufficient active instances available for killing: "+ " Instances to be killed %d Active instances %d", count, len(instanceIds)) } @@ -871,33 +1020,41 @@ func (r *realisClient) RemoveInstances(key *aurora.JobKey, count int32) (*aurora return r.KillInstances(key, instanceIds[:count]...) } -// Get information about task including a fully hydrated task configuration object +// GetTaskStatus gets information about task including a fully hydrated task configuration object. func (r *realisClient) GetTaskStatus(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { - r.logger.DebugPrintf("GetTasksStatus Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetTasksStatus Thrift Payload: %+v\n", query) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetTasksStatus(nil, query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksStatus(context.TODO(), query) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error querying Aurora Scheduler for task status") + return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task status") } return response.ScheduleStatusResult(resp).GetTasks(), nil } -// Get pending reason +// GetPendingReason returns the reason why the an instance of a Job has not been scheduled. func (r *realisClient) GetPendingReason(query *aurora.TaskQuery) ([]*aurora.PendingReason, error) { - r.logger.DebugPrintf("GetPendingReason Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetPendingReason Thrift Payload: %+v\n", query) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetPendingReason(nil, query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetPendingReason(context.TODO(), query) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error querying Aurora Scheduler for pending Reasons") + return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for pending Reasons") } var pendingReasons []*aurora.PendingReason @@ -909,24 +1066,29 @@ func (r *realisClient) GetPendingReason(query *aurora.TaskQuery) ([]*aurora.Pend return pendingReasons, nil } -// Get information about task including without a task configuration object +// GetTasksWithoutConfigs gets information about task including without a task configuration object. +// This is a more lightweight version of GetTaskStatus but contains less information as a result. func (r *realisClient) GetTasksWithoutConfigs(query *aurora.TaskQuery) ([]*aurora.ScheduledTask, error) { - r.logger.DebugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", query) + r.logger.debugPrintf("GetTasksWithoutConfigs Thrift Payload: %+v\n", query) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetTasksWithoutConfigs(nil, query) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksWithoutConfigs(context.TODO(), query) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error querying Aurora Scheduler for task status without configs") + return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task status without configs") } return response.ScheduleStatusResult(resp).GetTasks(), nil } -// Get the task configuration from the aurora scheduler for a job +// FetchTaskConfig gets the task configuration from the aurora scheduler for a job. func (r *realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.TaskConfig, error) { taskQ := &aurora.TaskQuery{ Role: &instKey.JobKey.Role, @@ -936,20 +1098,24 @@ func (r *realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.Task Statuses: aurora.ACTIVE_STATES, } - r.logger.DebugPrintf("GetTasksStatus Thrift Payload: %+v\n", taskQ) + r.logger.debugPrintf("GetTasksStatus Thrift Payload: %+v\n", taskQ) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetTasksStatus(nil, taskQ) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetTasksStatus(context.TODO(), taskQ) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Error querying Aurora Scheduler for task configuration") + return nil, errors.Wrap(retryErr, "error querying Aurora Scheduler for task configuration") } tasks := response.ScheduleStatusResult(resp).GetTasks() if len(tasks) == 0 { - return nil, errors.Errorf("Instance %d for jobkey %s/%s/%s doesn't exist", + return nil, errors.Errorf("instance %d for jobkey %s/%s/%s doesn't exist", instKey.InstanceId, instKey.JobKey.Environment, instKey.JobKey.Role, @@ -962,14 +1128,18 @@ func (r *realisClient) FetchTaskConfig(instKey aurora.InstanceKey) (*aurora.Task func (r *realisClient) JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*aurora.Response, error) { - r.logger.DebugPrintf("GetJobUpdateDetails Thrift Payload: %+v\n", updateQuery) + r.logger.debugPrintf("GetJobUpdateDetails Thrift Payload: %+v\n", updateQuery) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.GetJobUpdateDetails(nil, &updateQuery) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.GetJobUpdateDetails(context.TODO(), &updateQuery) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Unable to get job update details") + return nil, errors.Wrap(retryErr, "unable to get job update details") } return resp, nil @@ -977,261 +1147,18 @@ func (r *realisClient) JobUpdateDetails(updateQuery aurora.JobUpdateQuery) (*aur func (r *realisClient) RollbackJobUpdate(key aurora.JobUpdateKey, message string) (*aurora.Response, error) { - r.logger.DebugPrintf("RollbackJobUpdate Thrift Payload: %+v %v\n", key, message) + r.logger.debugPrintf("RollbackJobUpdate Thrift Payload: %+v %v\n", key, message) - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.client.RollbackJobUpdate(nil, &key, message) - }) + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.client.RollbackJobUpdate(context.TODO(), &key, message) + }, + nil, + ) if retryErr != nil { - return nil, errors.Wrap(retryErr, "Unable to roll back job update") + return nil, errors.Wrap(retryErr, "unable to roll back job update") } return resp, nil } - -/* Admin functions */ -// TODO(rdelvalle): Consider moving these functions to another interface. It would be a backwards incompatible change, -// but would add safety. - -// Set a list of nodes to DRAINING. This means nothing will be able to be scheduled on them and any existing -// tasks will be killed and re-scheduled elsewhere in the cluster. Tasks from DRAINING nodes are not guaranteed -// to return to running unless there is enough capacity in the cluster to run them. -func (r *realisClient) DrainHosts(hosts ...string) (*aurora.Response, *aurora.DrainHostsResult_, error) { - - var result *aurora.DrainHostsResult_ - - if len(hosts) == 0 { - return nil, nil, errors.New("no hosts provided to drain") - } - - drainList := aurora.NewHosts() - drainList.HostNames = hosts - - r.logger.DebugPrintf("DrainHosts Thrift Payload: %v\n", drainList) - - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.DrainHosts(nil, drainList) - }) - - if retryErr != nil { - return resp, result, errors.Wrap(retryErr, "Unable to recover connection") - } - - if resp.GetResult_() != nil { - result = resp.GetResult_().GetDrainHostsResult_() - } - - return resp, result, nil -} - -// Start SLA Aware Drain. -// defaultSlaPolicy is the fallback SlaPolicy to use if a task does not have an SlaPolicy. -// After timeoutSecs, tasks will be forcefully drained without checking SLA. -func (r *realisClient) SLADrainHosts(policy *aurora.SlaPolicy, timeout int64, hosts ...string) (*aurora.DrainHostsResult_, error) { - var result *aurora.DrainHostsResult_ - - if len(hosts) == 0 { - return nil, errors.New("no hosts provided to drain") - } - - drainList := aurora.NewHosts() - drainList.HostNames = hosts - - r.logger.DebugPrintf("SLADrainHosts Thrift Payload: %v\n", drainList) - - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.SlaDrainHosts(nil, drainList, policy, timeout) - }) - - if retryErr != nil { - return result, errors.Wrap(retryErr, "Unable to recover connection") - } - - if resp.GetResult_() != nil { - result = resp.GetResult_().GetDrainHostsResult_() - } - - return result, nil -} - -func (r *realisClient) StartMaintenance(hosts ...string) (*aurora.Response, *aurora.StartMaintenanceResult_, error) { - - var result *aurora.StartMaintenanceResult_ - - if len(hosts) == 0 { - return nil, nil, errors.New("no hosts provided to start maintenance on") - } - - hostList := aurora.NewHosts() - hostList.HostNames = hosts - - r.logger.DebugPrintf("StartMaintenance Thrift Payload: %v\n", hostList) - - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.StartMaintenance(nil, hostList) - }) - - if retryErr != nil { - return resp, result, errors.Wrap(retryErr, "Unable to recover connection") - } - - if resp.GetResult_() != nil { - result = resp.GetResult_().GetStartMaintenanceResult_() - } - - return resp, result, nil -} - -func (r *realisClient) EndMaintenance(hosts ...string) (*aurora.Response, *aurora.EndMaintenanceResult_, error) { - - var result *aurora.EndMaintenanceResult_ - - if len(hosts) == 0 { - return nil, nil, errors.New("no hosts provided to end maintenance on") - } - - hostList := aurora.NewHosts() - hostList.HostNames = hosts - - r.logger.DebugPrintf("EndMaintenance Thrift Payload: %v\n", hostList) - - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.EndMaintenance(nil, hostList) - }) - - if retryErr != nil { - return resp, result, errors.Wrap(retryErr, "Unable to recover connection") - } - - if resp.GetResult_() != nil { - result = resp.GetResult_().GetEndMaintenanceResult_() - } - - return resp, result, nil -} - -func (r *realisClient) MaintenanceStatus(hosts ...string) (*aurora.Response, *aurora.MaintenanceStatusResult_, error) { - - var result *aurora.MaintenanceStatusResult_ - - if len(hosts) == 0 { - return nil, nil, errors.New("no hosts provided to get maintenance status from") - } - - hostList := aurora.NewHosts() - hostList.HostNames = hosts - - r.logger.DebugPrintf("MaintenanceStatus Thrift Payload: %v\n", hostList) - - // Make thrift call. If we encounter an error sending the call, attempt to reconnect - // and continue trying to resend command until we run out of retries. - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.MaintenanceStatus(nil, hostList) - }) - - if retryErr != nil { - return resp, result, errors.Wrap(retryErr, "Unable to recover connection") - } - - if resp.GetResult_() != nil { - result = resp.GetResult_().GetMaintenanceStatusResult_() - } - - return resp, result, nil -} - -// SetQuota sets a quota aggregate for the given role -// TODO(zircote) Currently investigating an error that is returned from thrift calls that include resources for `NamedPort` and `NumGpu` -func (r *realisClient) SetQuota(role string, cpu *float64, ramMb *int64, diskMb *int64) (*aurora.Response, error) { - ramRes := aurora.NewResource() - ramRes.RamMb = ramMb - cpuRes := aurora.NewResource() - cpuRes.NumCpus = cpu - diskRes := aurora.NewResource() - diskRes.DiskMb = diskMb - quota := aurora.NewResourceAggregate() - quota.Resources = []*aurora.Resource{cpuRes, ramRes, diskRes} - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.SetQuota(nil, role, quota) - }) - - if retryErr != nil { - return resp, errors.Wrap(retryErr, "Unable to set role quota") - } - return resp, retryErr - -} - -// GetQuota returns the resource aggregate for the given role -func (r *realisClient) GetQuota(role string) (*aurora.Response, error) { - - resp, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.GetQuota(nil, role) - }) - - if retryErr != nil { - return resp, errors.Wrap(retryErr, "Unable to get role quota") - } - return resp, retryErr -} - -// Force Aurora Scheduler to perform a snapshot and write to Mesos log -func (r *realisClient) Snapshot() error { - - _, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.Snapshot(nil) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "Unable to recover connection") - } - - return nil -} - -// Force Aurora Scheduler to write backup file to a file in the backup directory -func (r *realisClient) PerformBackup() error { - - _, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.PerformBackup(nil) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "Unable to recover connection") - } - - return nil -} - -func (r *realisClient) ForceImplicitTaskReconciliation() error { - - _, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.TriggerImplicitTaskReconciliation(nil) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "Unable to recover connection") - } - - return nil -} - -func (r *realisClient) ForceExplicitTaskReconciliation(batchSize *int32) error { - - if batchSize != nil && *batchSize < 1 { - return errors.New("Invalid batch size.") - } - settings := aurora.NewExplicitReconciliationSettings() - - settings.BatchSize = batchSize - - _, retryErr := r.thriftCallWithRetries(func() (*aurora.Response, error) { - return r.adminClient.TriggerExplicitTaskReconciliation(nil, settings) - }) - - if retryErr != nil { - return errors.Wrap(retryErr, "Unable to recover connection") - } - - return nil -} diff --git a/realis_admin.go b/realis_admin.go new file mode 100644 index 0000000..9c58081 --- /dev/null +++ b/realis_admin.go @@ -0,0 +1,309 @@ +package realis + +import ( + "context" + + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/pkg/errors" +) + +// TODO(rdelvalle): Consider moving these functions to another interface. It would be a backwards incompatible change, +// but would add safety. + +// Set a list of nodes to DRAINING. This means nothing will be able to be scheduled on them and any existing +// tasks will be killed and re-scheduled elsewhere in the cluster. Tasks from DRAINING nodes are not guaranteed +// to return to running unless there is enough capacity in the cluster to run them. +func (r *realisClient) DrainHosts(hosts ...string) (*aurora.Response, *aurora.DrainHostsResult_, error) { + + var result *aurora.DrainHostsResult_ + + if len(hosts) == 0 { + return nil, nil, errors.New("no hosts provided to drain") + } + + drainList := aurora.NewHosts() + drainList.HostNames = hosts + + r.logger.debugPrintf("DrainHosts Thrift Payload: %v\n", drainList) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.DrainHosts(context.TODO(), drainList) + }, + nil, + ) + + if retryErr != nil { + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") + } + + if resp.GetResult_() != nil { + result = resp.GetResult_().GetDrainHostsResult_() + } + + return resp, result, nil +} + +// Start SLA Aware Drain. +// defaultSlaPolicy is the fallback SlaPolicy to use if a task does not have an SlaPolicy. +// After timeoutSecs, tasks will be forcefully drained without checking SLA. +func (r *realisClient) SLADrainHosts( + policy *aurora.SlaPolicy, + timeout int64, + hosts ...string) (*aurora.DrainHostsResult_, error) { + var result *aurora.DrainHostsResult_ + + if len(hosts) == 0 { + return nil, errors.New("no hosts provided to drain") + } + + if policy == nil || policy.CountSetFieldsSlaPolicy() == 0 { + policy = &defaultSlaPolicy + r.logger.Printf("Warning: start draining with default sla policy %v", policy) + } + + if timeout < 0 { + r.logger.Printf("Warning: timeout %d secs is invalid, draining with default timeout %d secs", + timeout, + defaultSlaDrainTimeoutSecs) + timeout = defaultSlaDrainTimeoutSecs + } + + drainList := aurora.NewHosts() + drainList.HostNames = hosts + + r.logger.debugPrintf("SLADrainHosts Thrift Payload: %v\n", drainList) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.SlaDrainHosts(context.TODO(), drainList, policy, timeout) + }, + nil, + ) + + if retryErr != nil { + return result, errors.Wrap(retryErr, "Unable to recover connection") + } + + if resp.GetResult_() != nil { + result = resp.GetResult_().GetDrainHostsResult_() + } + + return result, nil +} + +func (r *realisClient) StartMaintenance(hosts ...string) (*aurora.Response, *aurora.StartMaintenanceResult_, error) { + + var result *aurora.StartMaintenanceResult_ + + if len(hosts) == 0 { + return nil, nil, errors.New("no hosts provided to start maintenance on") + } + + hostList := aurora.NewHosts() + hostList.HostNames = hosts + + r.logger.debugPrintf("StartMaintenance Thrift Payload: %v\n", hostList) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.StartMaintenance(context.TODO(), hostList) + }, + nil, + ) + + if retryErr != nil { + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") + } + + if resp.GetResult_() != nil { + result = resp.GetResult_().GetStartMaintenanceResult_() + } + + return resp, result, nil +} + +func (r *realisClient) EndMaintenance(hosts ...string) (*aurora.Response, *aurora.EndMaintenanceResult_, error) { + + var result *aurora.EndMaintenanceResult_ + + if len(hosts) == 0 { + return nil, nil, errors.New("no hosts provided to end maintenance on") + } + + hostList := aurora.NewHosts() + hostList.HostNames = hosts + + r.logger.debugPrintf("EndMaintenance Thrift Payload: %v\n", hostList) + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.EndMaintenance(context.TODO(), hostList) + }, + nil, + ) + + if retryErr != nil { + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") + } + + if resp.GetResult_() != nil { + result = resp.GetResult_().GetEndMaintenanceResult_() + } + + return resp, result, nil +} + +func (r *realisClient) MaintenanceStatus(hosts ...string) (*aurora.Response, *aurora.MaintenanceStatusResult_, error) { + + var result *aurora.MaintenanceStatusResult_ + + if len(hosts) == 0 { + return nil, nil, errors.New("no hosts provided to get maintenance status from") + } + + hostList := aurora.NewHosts() + hostList.HostNames = hosts + + r.logger.debugPrintf("MaintenanceStatus Thrift Payload: %v\n", hostList) + + // Make thrift call. If we encounter an error sending the call, attempt to reconnect + // and continue trying to resend command until we run out of retries. + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.MaintenanceStatus(context.TODO(), hostList) + }, + nil, + ) + + if retryErr != nil { + return resp, result, errors.Wrap(retryErr, "Unable to recover connection") + } + + if resp.GetResult_() != nil { + result = resp.GetResult_().GetMaintenanceStatusResult_() + } + + return resp, result, nil +} + +// SetQuota sets a quota aggregate for the given role +// TODO(zircote) Currently investigating an error that is returned +// from thrift calls that include resources for `NamedPort` and `NumGpu` +func (r *realisClient) SetQuota(role string, cpu *float64, ramMb *int64, diskMb *int64) (*aurora.Response, error) { + quota := &aurora.ResourceAggregate{ + Resources: []*aurora.Resource{{NumCpus: cpu}, {RamMb: ramMb}, {DiskMb: diskMb}}, + } + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.SetQuota(context.TODO(), role, quota) + }, + nil, + ) + + if retryErr != nil { + return resp, errors.Wrap(retryErr, "Unable to set role quota") + } + return resp, retryErr + +} + +// GetQuota returns the resource aggregate for the given role +func (r *realisClient) GetQuota(role string) (*aurora.Response, error) { + + resp, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.GetQuota(context.TODO(), role) + }, + nil, + ) + + if retryErr != nil { + return resp, errors.Wrap(retryErr, "Unable to get role quota") + } + return resp, retryErr +} + +// Force Aurora Scheduler to perform a snapshot and write to Mesos log +func (r *realisClient) Snapshot() error { + + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.Snapshot(context.TODO()) + }, + nil, + ) + + if retryErr != nil { + return errors.Wrap(retryErr, "Unable to recover connection") + } + + return nil +} + +// Force Aurora Scheduler to write backup file to a file in the backup directory +func (r *realisClient) PerformBackup() error { + + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.PerformBackup(context.TODO()) + }, + nil, + ) + + if retryErr != nil { + return errors.Wrap(retryErr, "Unable to recover connection") + } + + return nil +} + +func (r *realisClient) ForceImplicitTaskReconciliation() error { + + _, retryErr := r.thriftCallWithRetries( + false, + func() (*aurora.Response, error) { + return r.adminClient.TriggerImplicitTaskReconciliation(context.TODO()) + }, + nil, + ) + + if retryErr != nil { + return errors.Wrap(retryErr, "Unable to recover connection") + } + + return nil +} + +func (r *realisClient) ForceExplicitTaskReconciliation(batchSize *int32) error { + + if batchSize != nil && *batchSize < 1 { + return errors.New("invalid batch size") + } + settings := aurora.NewExplicitReconciliationSettings() + + settings.BatchSize = batchSize + + _, retryErr := r.thriftCallWithRetries(false, + func() (*aurora.Response, error) { + return r.adminClient.TriggerExplicitTaskReconciliation(context.TODO(), settings) + }, + nil, + ) + + if retryErr != nil { + return errors.Wrap(retryErr, "Unable to recover connection") + } + + return nil +} diff --git a/realis_e2e_test.go b/realis_e2e_test.go index 9f011f0..78d8f0e 100644 --- a/realis_e2e_test.go +++ b/realis_e2e_test.go @@ -35,11 +35,13 @@ var r realis.Realis var monitor *realis.Monitor var thermosPayload []byte +const auroraURL = "http://192.168.33.7:8081" + func TestMain(m *testing.M) { var err error // New configuration to connect to docker container - r, err = realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err = realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), realis.TimeoutMS(20000)) @@ -63,42 +65,69 @@ func TestMain(m *testing.M) { } func TestNonExistentEndpoint(t *testing.T) { - backoff := realis.Backoff{ // Reduce penalties for this test to make it quick - Steps: 5, - Duration: 1 * time.Second, + // Reduce penalties for this test to make it quick + backoff := realis.Backoff{ + Steps: 3, + Duration: 200 * time.Millisecond, Factor: 1.0, Jitter: 0.1} - // Attempt to connect to a bad endpoint - r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081/doesntexist/"), - realis.TimeoutMS(200), - realis.BackOff(backoff), - ) - defer r.Close() - taskQ := &aurora.TaskQuery{} + badEndpoint := "http://idontexist.local:8081/api" - _, err = r.GetTasksWithoutConfigs(taskQ) + t.Run("WithRetries", func(t *testing.T) { + // Attempt to connect to a bad endpoint + badClient, err := realis.NewRealisClient( + realis.SchedulerUrl(badEndpoint), + realis.TimeoutMS(200000), + realis.BackOff(backoff), + ) - // Check that we do error out of retrying - assert.Error(t, err) + require.NoError(t, err) + require.NotNil(t, badClient) + defer badClient.Close() - // Check that the error before this one was a a retry error - // TODO: Consider bubbling up timeout behaving error all the way up to the user. - retryErr := realis.ToRetryCount(errors.Cause(err)) - assert.NotNil(t, retryErr, "error passed in is not a retry error") + _, err = badClient.GetTasksWithoutConfigs(taskQ) - assert.Equal(t, backoff.Steps, retryErr.RetryCount(), "retry count is incorrect") + // Check that we do error out of retrying + require.Error(t, err) + // Check that the error before this one was a a retry error + // TODO: Consider bubbling up timeout behaving error all the way up to the user. + retryErr := realis.ToRetryCount(errors.Cause(err)) + require.NotNil(t, retryErr, "error passed in is not a retry error") + + assert.Equal(t, backoff.Steps, retryErr.RetryCount(), "retry count is incorrect") + }) + + t.Run("FailOnLookup", func(t *testing.T) { + // Attempt to connect to a bad endpoint + badClient, err := realis.NewRealisClient( + realis.SchedulerUrl(badEndpoint), + realis.TimeoutMS(200000), + realis.BackOff(backoff), + realis.FailOnPermanentErrors(), + ) + + require.NoError(t, err) + require.NotNil(t, badClient) + defer badClient.Close() + + _, err = badClient.GetTasksWithoutConfigs(taskQ) + + // Check that we do error out of retrying + require.Error(t, err) + }) } func TestThriftBinary(t *testing.T) { - r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), realis.TimeoutMS(20000), realis.ThriftBinary()) - assert.NoError(t, err) + require.NoError(t, err) + defer r.Close() role := "all" taskQ := &aurora.TaskQuery{ @@ -107,20 +136,17 @@ func TestThriftBinary(t *testing.T) { // Perform a simple API call to test Thrift Binary _, err = r.GetTasksWithoutConfigs(taskQ) - assert.NoError(t, err) - - r.Close() - } func TestThriftJSON(t *testing.T) { - r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), realis.TimeoutMS(20000), realis.ThriftJSON()) - assert.NoError(t, err) + require.NoError(t, err) + defer r.Close() role := "all" taskQ := &aurora.TaskQuery{ @@ -132,16 +158,15 @@ func TestThriftJSON(t *testing.T) { assert.NoError(t, err) - r.Close() - } func TestNoopLogger(t *testing.T) { - r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"), + r, err := realis.NewRealisClient(realis.SchedulerUrl(auroraURL), realis.BasicAuth("aurora", "secret"), realis.SetLogger(realis.NoopLogger{})) - assert.NoError(t, err) + require.NoError(t, err) + defer r.Close() role := "all" taskQ := &aurora.TaskQuery{ @@ -150,35 +175,26 @@ func TestNoopLogger(t *testing.T) { // Perform a simple API call to test Thrift Binary _, err = r.GetTasksWithoutConfigs(taskQ) - assert.NoError(t, err) - - r.Close() } func TestLeaderFromZK(t *testing.T) { cluster := realis.GetDefaultClusterFromZKUrl("192.168.33.2:2181") url, err := realis.LeaderFromZK(*cluster) - assert.NoError(t, err) + require.NoError(t, err) + + // Address stored inside of ZK might be different than the one we connect to in our tests. assert.Equal(t, "http://192.168.33.7:8081", url) } func TestRealisClient_ReestablishConn(t *testing.T) { - // Test that we're able to tear down the old connection and create a new one. err := r.ReestablishConn() assert.NoError(t, err) } -func TestGetCACerts(t *testing.T) { - certs, err := realis.GetCerts("./examples/certs") - assert.NoError(t, err) - assert.Equal(t, len(certs.Subjects()), 2) - -} - func TestRealisClient_CreateJob_Thermos(t *testing.T) { role := "vagrant" @@ -196,7 +212,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { AddPorts(1) _, err := r.CreateJob(job) - assert.NoError(t, err) + require.NoError(t, err) // Test Instances Monitor success, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 1, 50) @@ -224,7 +240,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { status, err := r.GetTaskStatus(&aurora.TaskQuery{ JobKeys: []*aurora.JobKey{job.JobKey()}, Statuses: []aurora.ScheduleStatus{aurora.ScheduleStatus_RUNNING}}) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, status) assert.Len(t, status, 2) @@ -233,7 +249,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { t.Run("AddInstances", func(t *testing.T) { _, err := r.AddInstances(aurora.InstanceKey{JobKey: job.JobKey(), InstanceId: 0}, 2) - assert.NoError(t, err) + require.NoError(t, err) success, err := monitor.Instances(job.JobKey(), 4, 1, 50) assert.True(t, success) assert.NoError(t, err) @@ -241,7 +257,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { t.Run("KillInstances", func(t *testing.T) { _, err := r.KillInstances(job.JobKey(), 2, 3) - assert.NoError(t, err) + require.NoError(t, err) success, err := monitor.Instances(job.JobKey(), 2, 1, 50) assert.True(t, success) assert.NoError(t, err) @@ -249,7 +265,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { t.Run("RestartInstances", func(t *testing.T) { _, err := r.RestartInstances(job.JobKey(), 0) - assert.NoError(t, err) + require.NoError(t, err) success, err := monitor.Instances(job.JobKey(), 2, 1, 50) assert.True(t, success) assert.NoError(t, err) @@ -257,7 +273,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { t.Run("RestartJobs", func(t *testing.T) { _, err := r.RestartJob(job.JobKey()) - assert.NoError(t, err) + require.NoError(t, err) success, err := monitor.Instances(job.JobKey(), 2, 1, 50) assert.True(t, success) assert.NoError(t, err) @@ -266,16 +282,68 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) { // Tasks must exist for it to, be killed t.Run("KillJob", func(t *testing.T) { _, err := r.KillJob(job.JobKey()) - assert.NoError(t, err) + require.NoError(t, err) success, err := monitor.Instances(job.JobKey(), 0, 1, 50) assert.True(t, success) assert.NoError(t, err) }) + + t.Run("Duplicate_Metadata", func(t *testing.T) { + job.Name("thermos_duplicate_metadata"). + AddLabel("hostname", "cookie"). + AddLabel("hostname", "candy"). + AddLabel("hostname", "popcorn"). + AddLabel("hostname", "chips"). + AddLabel("chips", "chips") + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + + t.Run("Duplicate_constraints", func(t *testing.T) { + job.Name("thermos_duplicate_constraints"). + AddValueConstraint("zone", false, "east", "west"). + AddValueConstraint("zone", false, "east"). + AddValueConstraint("zone", true, "west") + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + + t.Run("Overwrite_constraints", func(t *testing.T) { + job.Name("thermos_overwrite_constraints"). + AddLimitConstraint("zone", 1). + AddValueConstraint("zone", true, "west", "east"). + AddLimitConstraint("zone", 2) + + _, err := r.CreateJob(job) + require.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 2, 1, 50) + assert.True(t, success) + assert.NoError(t, err) + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) } // Test configuring an executor that doesn't exist for CreateJob API func TestRealisClient_CreateJob_ExecutorDoesNotExist(t *testing.T) { - // Create a single job job := realis.NewJob(). Environment("prod"). @@ -313,7 +381,7 @@ func TestRealisClient_GetPendingReason(t *testing.T) { InstanceCount(1) resp, err := r.CreateJob(job) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode) taskQ := &aurora.TaskQuery{ @@ -326,7 +394,7 @@ func TestRealisClient_GetPendingReason(t *testing.T) { assert.NoError(t, err) assert.Len(t, reasons, 1) - resp, err = r.KillJob(job.JobKey()) + _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) } @@ -356,7 +424,7 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) { job.InstanceCount(2) _, result, err := r.CreateService(job, settings) - assert.NoError(t, err) + require.NoError(t, err) updateQ := aurora.JobUpdateQuery{ Key: result.GetKey(), @@ -376,13 +444,13 @@ pulseLoop: case <-ticker.C: _, err = r.PulseJobUpdate(result.GetKey()) - assert.Nil(t, err, "unable to pulse job update") + assert.NoError(t, err, "unable to pulse job update") respDetail, err := r.JobUpdateDetails(updateQ) - assert.Nil(t, err) + assert.NoError(t, err) updateDetails = response.JobUpdateDetails(respDetail) - assert.Len(t, updateDetails, 1, "No update found") + require.Len(t, updateDetails, 1, "No update found") status := updateDetails[0].Update.Summary.State.Status if _, ok := realis.ActiveJobUpdateStates[status]; !ok { @@ -401,7 +469,8 @@ pulseLoop: _, err := r.AbortJobUpdate(*updateDetails[0].GetUpdate().GetSummary().GetKey(), "") assert.NoError(t, err) _, err = r.KillJob(job.JobKey()) - require.NoError(t, err, "timed out during pulse update test") + assert.NoError(t, err, "timed out during pulse update test") + t.FailNow() } } @@ -431,7 +500,7 @@ func TestRealisClient_CreateService(t *testing.T) { job.InstanceCount(3) _, result, err := r.CreateService(job, settings) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, result) // Test asking the scheduler to backup a Snapshot @@ -455,12 +524,73 @@ func TestRealisClient_CreateService(t *testing.T) { assert.NoError(t, err) } + require.NoError(t, mErr) assert.True(t, ok) - assert.NoError(t, mErr) // Kill task test task after confirming it came up fine _, err = r.KillJob(job.JobKey()) assert.NoError(t, err) + + success, err := monitor.Instances(job.JobKey(), 0, 1, 50) + require.NoError(t, mErr) + assert.True(t, success) + + // Create a client which will timeout and close the connection before receiving an answer + timeoutClient, err := realis.NewRealisClient( + realis.SchedulerUrl(auroraURL), + realis.BasicAuth("aurora", "secret"), + realis.TimeoutMS(5), + ) + require.NoError(t, err) + defer timeoutClient.Close() + + // Test case where http connection timeouts out. + t.Run("TimeoutError", func(t *testing.T) { + job.Name("createService_timeout") + + // Make sure a timedout error was returned + _, _, err = timeoutClient.CreateService(job, settings) + require.Error(t, err) + assert.True(t, realis.IsTimeout(err)) + + updateReceivedQuery := aurora.JobUpdateQuery{ + Role: &job.JobKey().Role, + JobKey: job.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES, + Limit: 1} + + updateSummaries, err := monitor.JobUpdateQuery(updateReceivedQuery, time.Second*1, time.Second*50) + require.NoError(t, err) + + require.Len(t, updateSummaries, 1) + + r.AbortJobUpdate(*updateSummaries[0].Key, "Cleaning up") + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + + }) + + // Test case where http connection timeouts out. + t.Run("TimeoutError_BadPayload", func(t *testing.T) { + // Illegal payload + job.InstanceCount(-1) + job.Name("createService_timeout_bad_payload") + + // Make sure a timedout error was returned + _, _, err = timeoutClient.CreateService(job, settings) + require.Error(t, err) + assert.True(t, realis.IsTimeout(err)) + + summary, err := r.GetJobUpdateSummaries( + &aurora.JobUpdateQuery{ + Role: &job.JobKey().Role, + JobKey: job.JobKey(), + UpdateStatuses: aurora.ACTIVE_JOB_UPDATE_STATES}) + assert.NoError(t, err) + + // Payload should have been rejected, no update should exist + require.Len(t, summary.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries(), 0) + }) } // Test configuring an executor that doesn't exist for CreateJob API @@ -482,9 +612,9 @@ func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) { job.InstanceCount(3) resp, result, err := r.CreateService(job, settings) - assert.Error(t, err) + require.Error(t, err) assert.Nil(t, result) - assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode()) + require.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode()) } func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) { @@ -508,23 +638,23 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) { IsService(false) _, err = r.ScheduleCronJob(job) - assert.NoError(t, err) + require.NoError(t, err) t.Run("Start", func(t *testing.T) { _, err := r.StartCronJob(job.JobKey()) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Deschedule", func(t *testing.T) { _, err := r.DescheduleCronJob(job.JobKey()) - assert.NoError(t, err) + require.NoError(t, err) }) } func TestRealisClient_StartMaintenance(t *testing.T) { hosts := []string{"localhost"} _, _, err := r.StartMaintenance(hosts...) - assert.NoError(t, err, "unable to start maintenance") + require.NoError(t, err, "unable to start maintenance") // Monitor change to DRAINING and DRAINED mode hostResults, err := monitor.HostMaintenance( @@ -532,11 +662,11 @@ func TestRealisClient_StartMaintenance(t *testing.T) { []aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED}, 1, 50) - assert.Equal(t, map[string]bool{"localhost": true}, hostResults) assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) _, _, err = r.EndMaintenance(hosts...) - assert.NoError(t, err) + require.NoError(t, err) // Monitor change to DRAINING and DRAINED mode _, err = monitor.HostMaintenance( @@ -562,8 +692,8 @@ func TestRealisClient_DrainHosts(t *testing.T) { []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, 1, 50) + require.NoError(t, err) assert.Equal(t, map[string]bool{"localhost": true}, hostResults) - assert.NoError(t, err) }) t.Run("MonitorNonExistentHost", func(t *testing.T) { @@ -575,13 +705,13 @@ func TestRealisClient_DrainHosts(t *testing.T) { 1) // Assert monitor returned an error that was not nil, and also a list of the non-transitioned hosts - assert.Error(t, err) + require.Error(t, err) assert.Equal(t, map[string]bool{"localhost": true, "IMAGINARY_HOST": false}, hostResults) }) t.Run("EndMaintenance", func(t *testing.T) { _, _, err := r.EndMaintenance(hosts...) - assert.NoError(t, err) + require.NoError(t, err) // Monitor change to DRAINING and DRAINED mode _, err = monitor.HostMaintenance( @@ -599,7 +729,7 @@ func TestRealisClient_SLADrainHosts(t *testing.T) { policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}} _, err := r.SLADrainHosts(&policy, 30, hosts...) - assert.NoError(t, err, "unable to drain host with SLA policy") + require.NoError(t, err, "unable to drain host with SLA policy") // Monitor change to DRAINING and DRAINED mode hostResults, err := monitor.HostMaintenance( @@ -607,12 +737,59 @@ func TestRealisClient_SLADrainHosts(t *testing.T) { []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, 1, 50) - assert.Equal(t, map[string]bool{"localhost": true}, hostResults) assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) + + // Monitor change to DRAINING and DRAINED mode + _, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, + 5, + 10) assert.NoError(t, err) + // slaDrainHosts goes with default policy if no policy is specified + _, err = r.SLADrainHosts(nil, 30, hosts...) + require.NoError(t, err, "unable to drain host with SLA policy") + + // Monitor change to DRAINING and DRAINED mode + hostResults, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, + 1, + 50) + assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) + + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) + + // Monitor change to DRAINING and DRAINED mode + _, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, + 5, + 10) + assert.NoError(t, err) + + _, err = r.SLADrainHosts(&aurora.SlaPolicy{}, 30, hosts...) + require.NoError(t, err, "unable to drain host with SLA policy") + + // Monitor change to DRAINING and DRAINED mode + hostResults, err = monitor.HostMaintenance( + hosts, + []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING}, + 1, + 50) + assert.NoError(t, err) + assert.Equal(t, map[string]bool{"localhost": true}, hostResults) + + _, _, err = r.EndMaintenance(hosts...) + require.NoError(t, err) + // Monitor change to DRAINING and DRAINED mode _, err = monitor.HostMaintenance( hosts, @@ -689,13 +866,10 @@ func TestRealisClient_Quota(t *testing.T) { switch true { case res.DiskMb != nil: assert.Equal(t, disk, *res.DiskMb) - break case res.NumCpus != nil: assert.Equal(t, cpu, *res.NumCpus) - break case res.RamMb != nil: assert.Equal(t, ram, *res.RamMb) - break } } }) @@ -748,7 +922,7 @@ func TestRealisClient_PartitionPolicy(t *testing.T) { } // Clean up after finishing test - _, err = r.KillJob(job.JobKey()) + r.KillJob(job.JobKey()) } func TestAuroraJob_UpdateSlaPolicy(t *testing.T) { @@ -799,7 +973,7 @@ func TestAuroraJob_UpdateSlaPolicy(t *testing.T) { settings.MinWaitInInstanceRunningMs = 5 * 1000 _, result, err := r.CreateService(job, settings) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, result) var ok bool @@ -813,8 +987,8 @@ func TestAuroraJob_UpdateSlaPolicy(t *testing.T) { assert.NoError(t, err) } - assert.True(t, ok) assert.NoError(t, mErr) + assert.True(t, ok) // Kill task test task after confirming it came up fine _, err = r.KillJob(job.JobKey()) @@ -823,3 +997,121 @@ func TestAuroraJob_UpdateSlaPolicy(t *testing.T) { }) } } + +func TestRealisClient_UpdateStrategies(t *testing.T) { + + // Create a single job + job := realis.NewJob(). + Environment("prod"). + Role("vagrant"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.01). + RAM(4). + Disk(10). + InstanceCount(6). + IsService(true) + + strategies := []struct { + UpdateJob *realis.UpdateJob + Name string + }{ + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + QueueUpdateStrategy(aurora.QueueJobUpdateStrategy{GroupSize: 2}). + InstanceCount(6). + WatchTime(1000), + Name: "Queue", + }, + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + BatchUpdateStrategy(aurora.BatchJobUpdateStrategy{GroupSize: 2}). + InstanceCount(6). + WatchTime(1000), + Name: "Batch", + }, + { + UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()). + VariableBatchStrategy(aurora.VariableBatchJobUpdateStrategy{GroupSizes: []int32{1, 2, 3}}). + InstanceCount(6). + WatchTime(1000), + Name: "VarBatch", + }, + } + + for _, strategy := range strategies { + t.Run("TestRealisClient_UpdateStrategies_"+strategy.Name, func(t *testing.T) { + job.Name("update_strategies_" + strategy.Name) + resp, err := r.StartJobUpdate(strategy.UpdateJob, "") + + assert.NoError(t, err) + assert.NotNil(t, resp) + assert.NotNil(t, resp.GetResult_()) + assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_()) + assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_().GetKey()) + + var ok bool + var mErr error + key := *resp.GetResult_().GetStartJobUpdateResult_().GetKey() + + if ok, mErr = monitor.JobUpdate(key, 5, 240); !ok || mErr != nil { + // Update may already be in a terminal state so don't check for error + _, err := r.AbortJobUpdate(key, "Monitor timed out.") + assert.NoError(t, err) + } + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) + }) + } +} + +func TestRealisClient_BatchAwareAutoPause(t *testing.T) { + // Create a single job + job := realis.NewJob(). + Environment("prod"). + Role("vagrant"). + Name("BatchAwareAutoPauseTest"). + ExecutorName(aurora.AURORA_EXECUTOR_NAME). + ExecutorData(string(thermosPayload)). + CPU(.01). + RAM(4). + Disk(10). + InstanceCount(6). + IsService(true) + updateGroups := []int32{1, 2, 3} + strategy := realis.NewDefaultUpdateJob(job.TaskConfig()). + VariableBatchStrategy(aurora.VariableBatchJobUpdateStrategy{ + GroupSizes: updateGroups, + AutopauseAfterBatch: true, + }). + InstanceCount(6). + WatchTime(1000) + + resp, err := r.StartJobUpdate(strategy, "") + require.NoError(t, err) + require.NotNil(t, resp) + require.NotNil(t, resp.GetResult_()) + require.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_()) + require.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_().GetKey()) + + key := *resp.GetResult_().GetStartJobUpdateResult_().GetKey() + + for i := range updateGroups { + curStep, mErr := monitor.AutoPausedUpdateMonitor(key, time.Second*5, time.Second*240) + if mErr != nil { + // Update may already be in a terminal state so don't check for error + _, err := r.AbortJobUpdate(key, "Monitor timed out.") + assert.NoError(t, err) + } + + assert.Equal(t, i, curStep) + + if i != len(updateGroups)-1 { + _, err = r.ResumeJobUpdate(&key, "auto resuming test") + require.NoError(t, err) + } + } + + _, err = r.KillJob(job.JobKey()) + assert.NoError(t, err) +} diff --git a/response/response.go b/response/response.go index b77348d..4a67ca0 100644 --- a/response/response.go +++ b/response/response.go @@ -36,6 +36,10 @@ func ScheduleStatusResult(resp *aurora.Response) *aurora.ScheduleStatusResult_ { } func JobUpdateSummaries(resp *aurora.Response) []*aurora.JobUpdateSummary { + if resp.GetResult_() == nil || resp.GetResult_().GetGetJobUpdateSummariesResult_() == nil { + return nil + } + return resp.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries() } diff --git a/retry.go b/retry.go index 68b13cf..eefcf2a 100644 --- a/retry.go +++ b/retry.go @@ -26,9 +26,11 @@ import ( "github.com/pkg/errors" ) +// Backoff determines how the retry mechanism should react after each failure and how many failures it should +// tolerate. type Backoff struct { Duration time.Duration // the base duration - Factor float64 // Duration is multipled by factor each iteration + Factor float64 // Duration is multiplied by a factor each iteration Jitter float64 // The amount of jitter applied each iteration Steps int // Exit with error after this many steps } @@ -50,19 +52,16 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration { // if the loop should be aborted. type ConditionFunc func() (done bool, err error) -// Modified version of the Kubernetes exponential-backoff code. -// ExponentialBackoff repeats a condition check with exponential backoff. -// -// It checks the condition up to Steps times, increasing the wait by multiplying -// the previous duration by Factor. +// ExponentialBackoff is a modified version of the Kubernetes exponential-backoff code. +// It repeats a condition check with exponential backoff and checks the condition up to +// Steps times, increasing the wait by multiplying the previous duration by Factor. // // If Jitter is greater than zero, a random amount of each duration is added // (between duration and duration*(1+jitter)). // // If the condition never returns true, ErrWaitTimeout is returned. Errors // do not cause the function to return. - -func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) error { +func ExponentialBackoff(backoff Backoff, logger logger, condition ConditionFunc) error { var err error var ok bool var curStep int @@ -77,7 +76,8 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) adjusted = Jitter(duration, backoff.Jitter) } - logger.Printf("A retriable error occurred during function call, backing off for %v before retrying\n", adjusted) + logger.Printf( + "A retryable error occurred during function call, backing off for %v before retrying\n", adjusted) time.Sleep(adjusted) duration = time.Duration(float64(duration) * backoff.Factor) } @@ -94,10 +94,9 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) // If the error is temporary, continue retrying. if !IsTemporary(err) { return err - } else { - // Print out the temporary error we experienced. - logger.Println(err) } + // Print out the temporary error we experienced. + logger.Println(err) } } @@ -108,18 +107,31 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc) // Provide more information to the user wherever possible if err != nil { return newRetryError(errors.Wrap(err, "ran out of retries"), curStep) - } else { - return newRetryError(errors.New("ran out of retries"), curStep) } + + return newRetryError(errors.New("ran out of retries"), curStep) } type auroraThriftCall func() (resp *aurora.Response, err error) +// verifyOntimeout defines the type of function that will be used to verify whether a Thirft call to the Scheduler +// made it to the scheduler or not. In general, these types of functions will have to interact with the scheduler +// through the very same Thrift API which previously encountered a time out from the client. +// This means that the functions themselves should be kept to a minimum number of Thrift calls. +// It should also be noted that this is a best effort mechanism and +// is likely to fail for the same reasons that the original call failed. +type verifyOnTimeout func() (*aurora.Response, bool) + // Duplicates the functionality of ExponentialBackoff but is specifically targeted towards ThriftCalls. -func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*aurora.Response, error) { +func (r *realisClient) thriftCallWithRetries( + returnOnTimeout bool, + thriftCall auroraThriftCall, + verifyOnTimeout verifyOnTimeout) (*aurora.Response, error) { + var resp *aurora.Response var clientErr error var curStep int + timeouts := 0 backoff := r.config.backoff duration := backoff.Duration @@ -133,7 +145,10 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro adjusted = Jitter(duration, backoff.Jitter) } - r.logger.Printf("A retriable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep) + r.logger.Printf( + "A retryable error occurred during thrift call, backing off for %v before retry %v", + adjusted, + curStep) time.Sleep(adjusted) duration = time.Duration(float64(duration) * backoff.Factor) @@ -148,84 +163,132 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro resp, clientErr = thriftCall() - r.logger.TracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr) + r.logger.tracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v", resp, clientErr) }() - // Check if our thrift call is returning an error. This is a retriable event as we don't know - // if it was caused by network issues. + // Check if our thrift call is returning an error. if clientErr != nil { - // Print out the error to the user - r.logger.Printf("Client Error: %v\n", clientErr) + r.logger.Printf("Client Error: %v", clientErr) - // Determine if error is a temporary URL error by going up the stack - e, ok := clientErr.(thrift.TTransportException) - if ok { - r.logger.DebugPrint("Encountered a transport exception") + temporary, timedout := isConnectionError(clientErr) + if !temporary && r.RealisConfig().failOnPermanentErrors { + return nil, errors.Wrap(clientErr, "permanent connection error") + } - e, ok := e.Err().(*url.Error) - if ok { - // EOF error occurs when the server closes the read buffer of the client. This is common - // when the server is overloaded and should be retried. All other errors that are permanent - // will not be retried. - if e.Err != io.EOF && !e.Temporary() { - return nil, errors.Wrap(clientErr, "Permanent connection error") - } - } + // There exists a corner case where thrift payload was received by Aurora but + // connection timed out before Aurora was able to reply. + // Users can take special action on a timeout by using IsTimedout and reacting accordingly + // if they have configured the client to return on a timeout. + if timedout && returnOnTimeout { + return resp, newTimedoutError(errors.New("client connection closed before server answer")) } // In the future, reestablish connection should be able to check if it is actually possible // to make a thrift call to Aurora. For now, a reconnect should always lead to a retry. - r.ReestablishConn() - - } else { - - // If there was no client error, but the response is nil, something went wrong. - // Ideally, we'll never encounter this but we're placing a safeguard here. - if resp == nil { - return nil, errors.New("Response from aurora is nil") + // Ignoring error due to the fact that an error should be retried regardless + reestablishErr := r.ReestablishConn() + if reestablishErr != nil { + r.logger.debugPrintf("error re-establishing connection ", reestablishErr) } - // Check Response Code from thrift and make a decision to continue retrying or not. - switch responseCode := resp.GetResponseCode(); responseCode { + // If users did not opt for a return on timeout in order to react to a timedout error, + // attempt to verify that the call made it to the scheduler after the connection was re-established. + if timedout { + timeouts++ + r.logger.debugPrintf( + "Client closed connection %d times before server responded, "+ + "consider increasing connection timeout", + timeouts) - // If the thrift call succeeded, stop retrying - case aurora.ResponseCode_OK: - return resp, nil - - // If the response code is transient, continue retrying - case aurora.ResponseCode_ERROR_TRANSIENT: - r.logger.Println("Aurora replied with Transient error code, retrying") - continue - - // Failure scenarios, these indicate a bad payload or a bad config. Stop retrying. - case aurora.ResponseCode_INVALID_REQUEST, - aurora.ResponseCode_ERROR, - aurora.ResponseCode_AUTH_FAILED, - aurora.ResponseCode_JOB_UPDATING_ERROR: - r.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String()) - return resp, errors.New(response.CombineMessage(resp)) - - // The only case that should fall down to here is a WARNING response code. - // It is currently not used as a response in the scheduler so it is unknown how to handle it. - default: - r.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode) - return nil, errors.Errorf("unhandled response code from Aurora %v\n", responseCode.String()) + // Allow caller to provide a function which checks if the original call was successful before + // it timed out. + if verifyOnTimeout != nil { + if verifyResp, ok := verifyOnTimeout(); ok { + r.logger.Print("verified that the call went through successfully after a client timeout") + // Response here might be different than the original as it is no longer constructed + // by the scheduler but mimicked. + // This is OK since the scheduler is very unlikely to change responses at this point in its + // development cycle but we must be careful to not return an incorrectly constructed response. + return verifyResp, nil + } + } } + + // Retry the thrift payload + continue + } + + // If there was no client error, but the response is nil, something went wrong. + // Ideally, we'll never encounter this but we're placing a safeguard here. + if resp == nil { + return nil, errors.New("response from aurora is nil") + } + + // Check Response Code from thrift and make a decision to continue retrying or not. + switch responseCode := resp.GetResponseCode(); responseCode { + + // If the thrift call succeeded, stop retrying + case aurora.ResponseCode_OK: + return resp, nil + + // If the response code is transient, continue retrying + case aurora.ResponseCode_ERROR_TRANSIENT: + r.logger.Println("Aurora replied with Transient error code, retrying") + continue + + // Failure scenarios, these indicate a bad payload or a bad config. Stop retrying. + case aurora.ResponseCode_INVALID_REQUEST, + aurora.ResponseCode_ERROR, + aurora.ResponseCode_AUTH_FAILED, + aurora.ResponseCode_JOB_UPDATING_ERROR: + r.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String()) + return resp, errors.New(response.CombineMessage(resp)) + + // The only case that should fall down to here is a WARNING response code. + // It is currently not used as a response in the scheduler so it is unknown how to handle it. + default: + r.logger.debugPrintf("unhandled response code %v received from Aurora\n", responseCode) + return nil, errors.Errorf("unhandled response code from Aurora %v", responseCode.String()) } } - r.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep) - if curStep > 1 { - r.config.logger.Printf("retried this thrift call %d time(s)", curStep) + r.config.logger.Printf("this thrift call was retried %d time(s)", curStep) } // Provide more information to the user wherever possible. if clientErr != nil { return nil, newRetryError(errors.Wrap(clientErr, "ran out of retries, including latest error"), curStep) - } else { - return nil, newRetryError(errors.New("ran out of retries"), curStep) } + + return nil, newRetryError(errors.New("ran out of retries"), curStep) +} + +// isConnectionError processes the error received by the client. +// The return values indicate weather this was determined to be a temporary error +// and weather it was determined to be a timeout error +func isConnectionError(err error) (bool, bool) { + + // Determine if error is a temporary URL error by going up the stack + transportException, ok := err.(thrift.TTransportException) + if !ok { + return false, false + } + + urlError, ok := transportException.Err().(*url.Error) + if !ok { + return false, false + } + + // EOF error occurs when the server closes the read buffer of the client. This is common + // when the server is overloaded and we consider it temporary. + // All other which are not temporary as per the member function Temporary(), + // are considered not temporary (permanent). + if urlError.Err != io.EOF && !urlError.Temporary() { + return false, false + } + + return true, urlError.Timeout() } diff --git a/runTests.sh b/runTests.sh new file mode 100755 index 0000000..e213972 --- /dev/null +++ b/runTests.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +docker-compose up -d + +# If running docker-compose up gives any error, don't do anything. +if [ $? -ne 0 ]; then + exit +fi + +# Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues. +docker run --rm -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10-stretch go test -v github.com/paypal/gorealis $@ + +docker-compose down diff --git a/runTestsMac.sh b/runTestsMac.sh old mode 100755 new mode 100644 index 4c695de..6a09931 --- a/runTestsMac.sh +++ b/runTestsMac.sh @@ -1,4 +1,4 @@ #!/bin/bash # Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues. -docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10-stretch go test -v github.com/paypal/gorealis $@ +docker run --rm -t -w /gorealis -v $GOPATH/pkg:/go/pkg -v $(pwd):/gorealis --network gorealis_aurora_cluster golang:1.16-buster go test -v github.com/paypal/gorealis $@ diff --git a/updatejob.go b/updatejob.go index eeaaa9c..09e69c9 100644 --- a/updatejob.go +++ b/updatejob.go @@ -18,20 +18,25 @@ import ( "github.com/paypal/gorealis/gen-go/apache/aurora" ) -// Structure to collect all information required to create job update +// UpdateJob is a structure to collect all information required to create job update. type UpdateJob struct { Job // SetInstanceCount for job is hidden, access via full qualifier req *aurora.JobUpdateRequest } -// Create a default UpdateJob object. +// NewDefaultUpdateJob creates an UpdateJob object with opinionated default settings. func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob { req := aurora.NewJobUpdateRequest() req.TaskConfig = config req.Settings = NewUpdateSettings() - job := NewJob().(*AuroraJob) + job, ok := NewJob().(*AuroraJob) + if !ok { + // This should never happen but it is here as a safeguard + return nil + } + job.jobConfig.TaskConfig = config // Rebuild resource map from TaskConfig @@ -69,13 +74,18 @@ func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob { return &UpdateJob{Job: job, req: req} } +// NewUpdateJob creates an UpdateJob object wihtout default settings. func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) *UpdateJob { req := aurora.NewJobUpdateRequest() req.TaskConfig = config req.Settings = settings - job := NewJob().(*AuroraJob) + job, ok := NewJob().(*AuroraJob) + if !ok { + // This should never happen but it is here as a safeguard + return nil + } job.jobConfig.TaskConfig = config // Rebuild resource map from TaskConfig @@ -106,50 +116,65 @@ func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) return &UpdateJob{Job: job, req: req} } -// Set instance count the job will have after the update. +// InstanceCount sets instance count the job will have after the update. func (u *UpdateJob) InstanceCount(inst int32) *UpdateJob { u.req.InstanceCount = inst return u } -// Max number of instances being updated at any given moment. +// BatchSize sets the max number of instances being updated at any given moment. func (u *UpdateJob) BatchSize(size int32) *UpdateJob { u.req.Settings.UpdateGroupSize = size return u } -// Minimum number of seconds a shard must remain in RUNNING state before considered a success. +// WatchTime sets the minimum number of seconds a shard must remain in RUNNING state before considered a success. func (u *UpdateJob) WatchTime(ms int32) *UpdateJob { u.req.Settings.MinWaitInInstanceRunningMs = ms return u } -// Wait for all instances in a group to be done before moving on. +// WaitForBatchCompletion configures the job update to wait for all instances in a group to be done before moving on. func (u *UpdateJob) WaitForBatchCompletion(batchWait bool) *UpdateJob { u.req.Settings.WaitForBatchCompletion = batchWait return u } -// Max number of instance failures to tolerate before marking instance as FAILED. +// MaxPerInstanceFailures sets the max number of instance failures to tolerate before marking instance as FAILED. func (u *UpdateJob) MaxPerInstanceFailures(inst int32) *UpdateJob { u.req.Settings.MaxPerInstanceFailures = inst return u } -// Max number of FAILED instances to tolerate before terminating the update. +// MaxFailedInstances sets the max number of FAILED instances to tolerate before terminating the update. func (u *UpdateJob) MaxFailedInstances(inst int32) *UpdateJob { u.req.Settings.MaxFailedInstances = inst return u } -// When False, prevents auto rollback of a failed update. +// RollbackOnFail configure the job to rollback automatically after a job update fails. func (u *UpdateJob) RollbackOnFail(rollback bool) *UpdateJob { u.req.Settings.RollbackOnFailure = rollback return u } -func NewUpdateSettings() *aurora.JobUpdateSettings { +// NewUpdateSettings return an opinionated set of job update settings. +func (u *UpdateJob) BatchUpdateStrategy(strategy aurora.BatchJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{BatchStrategy: &strategy} + return u +} +func (u *UpdateJob) QueueUpdateStrategy(strategy aurora.QueueJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{QueueStrategy: &strategy} + return u +} + +func (u *UpdateJob) VariableBatchStrategy(strategy aurora.VariableBatchJobUpdateStrategy) *UpdateJob { + u.req.Settings.UpdateStrategy = &aurora.JobUpdateStrategy{VarBatchStrategy: &strategy} + return u +} + +func NewUpdateSettings() *aurora.JobUpdateSettings { us := new(aurora.JobUpdateSettings) // Mirrors defaults set by Pystachio us.UpdateGroupSize = 1 diff --git a/util.go b/util.go index 324b12f..4307d1c 100644 --- a/util.go +++ b/util.go @@ -1,18 +1,47 @@ package realis import ( + "crypto/x509" + "io/ioutil" "net/url" + "os" + "path/filepath" "strings" "github.com/paypal/gorealis/gen-go/apache/aurora" "github.com/pkg/errors" ) +const apiPath = "/api" + +// ActiveStates - States a task may be in when active. var ActiveStates = make(map[aurora.ScheduleStatus]bool) + +// SlaveAssignedStates - States a task may be in when it has already been assigned to a Mesos agent. var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool) + +// LiveStates - States a task may be in when it is live (e.g. able to take traffic) var LiveStates = make(map[aurora.ScheduleStatus]bool) + +// TerminalStates - Set of states a task may not transition away from. var TerminalStates = make(map[aurora.ScheduleStatus]bool) + +// ActiveJobUpdateStates - States a Job Update may be in where it is considered active. var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool) + +// TerminalUpdateStates returns a slice containing all the terminal states an update may be in. +// This is a function in order to avoid having a slice that can be accidentally mutated. +func TerminalUpdateStates() []aurora.JobUpdateStatus { + return []aurora.JobUpdateStatus{ + aurora.JobUpdateStatus_ROLLED_FORWARD, + aurora.JobUpdateStatus_ROLLED_BACK, + aurora.JobUpdateStatus_ABORTED, + aurora.JobUpdateStatus_ERROR, + aurora.JobUpdateStatus_FAILED, + } +} + +// AwaitingPulseJobUpdateStates - States a job update may be in where it is waiting for a pulse. var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool) func init() { @@ -40,14 +69,57 @@ func init() { } } -func validateAndPopulateAuroraURL(urlStr string) (string, error) { - - // If no protocol defined, assume http - if !strings.Contains(urlStr, "://") { - urlStr = "http://" + urlStr +// createCertPool will attempt to load certificates into a certificate pool from a given directory. +// Only files with an extension contained in the extension map are considered. +// This function ignores any files that cannot be read successfully or cannot be added to the certPool +// successfully. +func createCertPool(path string, extensions map[string]struct{}) (*x509.CertPool, error) { + _, err := os.Stat(path) + if err != nil { + return nil, errors.Wrap(err, "unable to load certificates") } - u, err := url.Parse(urlStr) + caFiles, err := ioutil.ReadDir(path) + if err != nil { + return nil, err + } + + certPool := x509.NewCertPool() + loadedCerts := 0 + for _, cert := range caFiles { + // Skip directories + if cert.IsDir() { + continue + } + + // Skip any files that do not contain the right extension + if _, ok := extensions[filepath.Ext(cert.Name())]; !ok { + continue + } + + pem, err := ioutil.ReadFile(filepath.Join(path, cert.Name())) + if err != nil { + continue + } + + if certPool.AppendCertsFromPEM(pem) { + loadedCerts++ + } + } + if loadedCerts == 0 { + return nil, errors.New("no certificates were able to be successfully loaded") + } + return certPool, nil +} + +func validateAuroraURL(location string) (string, error) { + + // If no protocol defined, assume http + if !strings.Contains(location, "://") { + location = "http://" + location + } + + u, err := url.Parse(location) if err != nil { return "", errors.Wrap(err, "error parsing url") @@ -67,9 +139,29 @@ func validateAndPopulateAuroraURL(urlStr string) (string, error) { return "", errors.Errorf("only protocols http and https are supported %v\n", u.Scheme) } - if u.Path != "/api" { + // This could theoretically be elsewhere but we'll be strict for the sake of simplicity + if u.Path != apiPath { return "", errors.Errorf("expected /api path %v\n", u.Path) } return u.String(), nil } + +func calculateCurrentBatch(updatingInstances int32, batchSizes []int32) int { + for i, size := range batchSizes { + updatingInstances -= size + if updatingInstances <= 0 { + return i + } + } + + // Overflow batches + batchCount := len(batchSizes) - 1 + lastBatchIndex := len(batchSizes) - 1 + batchCount += int(updatingInstances / batchSizes[lastBatchIndex]) + + if updatingInstances%batchSizes[lastBatchIndex] != 0 { + batchCount++ + } + return batchCount +} diff --git a/util_test.go b/util_test.go new file mode 100644 index 0000000..2906c42 --- /dev/null +++ b/util_test.go @@ -0,0 +1,114 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package realis + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAuroraURLValidator(t *testing.T) { + t.Run("badURL", func(t *testing.T) { + url, err := validateAuroraURL("http://badurl.com/badpath") + assert.Empty(t, url) + assert.Error(t, err) + }) + + t.Run("URLHttp", func(t *testing.T) { + url, err := validateAuroraURL("http://goodurl.com:8081/api") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLHttps", func(t *testing.T) { + url, err := validateAuroraURL("https://goodurl.com:8081/api") + assert.Equal(t, "https://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoPath", func(t *testing.T) { + url, err := validateAuroraURL("http://goodurl.com:8081") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("ipAddrNoPath", func(t *testing.T) { + url, err := validateAuroraURL("http://192.168.1.33:8081") + assert.Equal(t, "http://192.168.1.33:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoProtocol", func(t *testing.T) { + url, err := validateAuroraURL("goodurl.com:8081/api") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) + + t.Run("URLNoProtocolNoPathNoPort", func(t *testing.T) { + url, err := validateAuroraURL("goodurl.com") + assert.Equal(t, "http://goodurl.com:8081/api", url) + assert.NoError(t, err) + }) +} + +func TestCurrentBatchCalculator(t *testing.T) { + t.Run("singleBatchOverflow", func(t *testing.T) { + curBatch := calculateCurrentBatch(10, []int32{2}) + assert.Equal(t, 4, curBatch) + }) + + t.Run("noInstancesUpdating", func(t *testing.T) { + curBatch := calculateCurrentBatch(0, []int32{2}) + assert.Equal(t, 0, curBatch) + }) + + t.Run("evenMatchSingleBatch", func(t *testing.T) { + curBatch := calculateCurrentBatch(2, []int32{2}) + assert.Equal(t, 0, curBatch) + }) + + t.Run("moreInstancesThanBatches", func(t *testing.T) { + curBatch := calculateCurrentBatch(5, []int32{1, 2}) + assert.Equal(t, 2, curBatch) + }) + + t.Run("moreInstancesThanBatchesDecreasing", func(t *testing.T) { + curBatch := calculateCurrentBatch(5, []int32{2, 1}) + assert.Equal(t, 3, curBatch) + }) + + t.Run("unevenFit", func(t *testing.T) { + curBatch := calculateCurrentBatch(2, []int32{1, 2}) + assert.Equal(t, 1, curBatch) + }) + + t.Run("halfWay", func(t *testing.T) { + curBatch := calculateCurrentBatch(1, []int32{1, 2}) + assert.Equal(t, 0, curBatch) + }) +} + +func TestCertPoolCreator(t *testing.T) { + extensions := map[string]struct{}{".crt": {}} + + _, err := createCertPool("examples/certs", extensions) + assert.NoError(t, err) + + t.Run("badDir", func(t *testing.T) { + _, err := createCertPool("idontexist", extensions) + assert.Error(t, err) + }) +} diff --git a/vendor/github.com/stretchr/testify/.travis.yml b/vendor/github.com/stretchr/testify/.travis.yml index b33dc9f..da6ba0d 100644 --- a/vendor/github.com/stretchr/testify/.travis.yml +++ b/vendor/github.com/stretchr/testify/.travis.yml @@ -2,14 +2,18 @@ language: go sudo: false -go: - - 1.7 - - 1.8 - - 1.9 - - tip - -script: - - ./.travis.gogenerate.sh - - ./.travis.gofmt.sh - - ./.travis.govet.sh - - go test -v -race ./... +matrix: + include: + - go: "1.8.x" + - go: "1.9.x" + - go: "1.10.x" + - go: "1.11.x" + env: GO111MODULE=off + - go: "1.11.x" + env: GO111MODULE=on + - go: tip + script: + - ./.travis.gogenerate.sh + - ./.travis.gofmt.sh + - ./.travis.govet.sh + - go test -v -race $(go list ./... | grep -v vendor) diff --git a/vendor/github.com/stretchr/testify/Gopkg.lock b/vendor/github.com/stretchr/testify/Gopkg.lock index f52deee..294cda0 100644 --- a/vendor/github.com/stretchr/testify/Gopkg.lock +++ b/vendor/github.com/stretchr/testify/Gopkg.lock @@ -10,16 +10,18 @@ [[projects]] name = "github.com/pmezard/go-difflib" packages = ["difflib"] - revision = "d8ed2627bdf02c080bf22230dbb337003b7aba2d" + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" [[projects]] name = "github.com/stretchr/objx" packages = ["."] - revision = "cbeaeb16a013161a98496fad62933b1d21786672" + revision = "facf9a85c22f48d2f52f2380e4efce1768749a89" + version = "v0.1" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "6bd8fb1f11a0d3df245fc01bd8853f6dac40b83457e780f7978ca30244647c7b" + inputs-digest = "448ddae4702c6aded2555faafd390c537789bb1c483f70b0431e6634f73f2090" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/stretchr/testify/Gopkg.toml b/vendor/github.com/stretchr/testify/Gopkg.toml index dac8623..a16374c 100644 --- a/vendor/github.com/stretchr/testify/Gopkg.toml +++ b/vendor/github.com/stretchr/testify/Gopkg.toml @@ -1,26 +1,16 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - +[prune] + unused-packages = true + non-go = true + go-tests = true [[constraint]] name = "github.com/davecgh/go-spew" - version = ">=1.0.0, <=3.0.0-g6d21280" + version = "~1.1.0" + +[[constraint]] + name = "github.com/pmezard/go-difflib" + version = "~1.0.0" + +[[constraint]] + name = "github.com/stretchr/objx" + version = "~0.1.0" diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE index 473b670..f38ec59 100644 --- a/vendor/github.com/stretchr/testify/LICENSE +++ b/vendor/github.com/stretchr/testify/LICENSE @@ -1,22 +1,21 @@ -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell +MIT License -Please consider promoting this project if you find it useful. +Copyright (c) 2012-2018 Mat Ryer and Tyler Bunnell -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/README.md b/vendor/github.com/stretchr/testify/README.md index e57b181..11951d4 100644 --- a/vendor/github.com/stretchr/testify/README.md +++ b/vendor/github.com/stretchr/testify/README.md @@ -9,7 +9,6 @@ Features include: * [Easy assertions](#assert-package) * [Mocking](#mock-package) - * [HTTP response trapping](#http-package) * [Testing suite interfaces and functions](#suite-package) Get started: @@ -106,14 +105,6 @@ The `require` package provides same global functions as the `assert` package, bu See [t.FailNow](http://golang.org/pkg/testing/#T.FailNow) for details. - -[`http`](http://godoc.org/github.com/stretchr/testify/http "API documentation") package ---------------------------------------------------------------------------------------- - -The `http` package contains test objects useful for testing code that relies on the `net/http` package. Check out the [(deprecated) API documentation for the `http` package](http://godoc.org/github.com/stretchr/testify/http). - -We recommend you use [httptest](http://golang.org/pkg/net/http/httptest) instead. - [`mock`](http://godoc.org/github.com/stretchr/testify/mock "API documentation") package ---------------------------------------------------------------------------------------- @@ -173,6 +164,29 @@ func TestSomething(t *testing.T) { // assert that the expectations were met testObj.AssertExpectations(t) + +} + +// TestSomethingElse is a second example of how to use our test object to +// make assertions about some target code we are testing. +// This time using a placeholder. Placeholders might be used when the +// data being passed in is normally dynamically generated and cannot be +// predicted beforehand (eg. containing hashes that are time sensitive) +func TestSomethingElse(t *testing.T) { + + // create an instance of our test object + testObj := new(MyMockedObject) + + // setup expectations with a placeholder in the argument list + testObj.On("DoSomething", mock.Anything).Return(true, nil) + + // call the code we are testing + targetFuncThatDoesSomethingWithObj(testObj) + + // assert that the expectations were met + testObj.AssertExpectations(t) + + } ``` @@ -268,14 +282,15 @@ Installation To install Testify, use `go get`: - * Latest version: go get github.com/stretchr/testify - * Specific version: go get gopkg.in/stretchr/testify.v1 + go get github.com/stretchr/testify This will then make the following packages available to you: github.com/stretchr/testify/assert + github.com/stretchr/testify/require github.com/stretchr/testify/mock - github.com/stretchr/testify/http + github.com/stretchr/testify/suite + github.com/stretchr/testify/http (deprecated) Import the `testify/assert` package into your code using this template: @@ -303,10 +318,10 @@ To update Testify to the latest version, use `go get -u github.com/stretchr/test ------ -Version History -=============== +Supported go versions +================== - * 1.0 - New package versioning strategy adopted. +We support the three major Go versions, which are 1.9, 1.10, and 1.11 at the moment. ------ @@ -319,14 +334,7 @@ When submitting an issue, we ask that you please include a complete test functio ------ -Licence +License ======= -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell -Please consider promoting this project if you find it useful. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +This project is licensed under the terms of the MIT license. diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 3e172f2..aa1c2b9 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -13,6 +13,9 @@ import ( // Conditionf uses a Comparison to assert a complex condition. func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Condition(t, comp, append([]interface{}{msg}, args...)...) } @@ -22,14 +25,18 @@ func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bo // assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") // assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") // assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Contains(t, s, contains, append([]interface{}{msg}, args...)...) } // DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return DirExists(t, path, append([]interface{}{msg}, args...)...) } @@ -37,10 +44,11 @@ func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")) -// -// Returns whether the assertion was successful (true) or not (false). +// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } @@ -48,9 +56,10 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string // a slice or a channel with len == 0. // // assert.Emptyf(t, obj, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Empty(t, object, append([]interface{}{msg}, args...)...) } @@ -58,12 +67,13 @@ func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) boo // // assert.Equalf(t, 123, 123, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Equal(t, expected, actual, append([]interface{}{msg}, args...)...) } @@ -72,9 +82,10 @@ func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ar // // actualObj, err := SomeFunction() // assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...) } @@ -82,9 +93,10 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args // and equal. // // assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) } @@ -94,62 +106,80 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // if assert.Errorf(t, err, "error message %s", "formatted") { // assert.Equal(t, expectedErrorf, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Error(t, err, append([]interface{}{msg}, args...)...) } // Exactlyf asserts that two objects are equal in value and type. // // assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...) } // Failf reports a failure through func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Fail(t, failureMessage, append([]interface{}{msg}, args...)...) } // FailNowf fails test func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...) } // Falsef asserts that the specified value is false. // // assert.Falsef(t, myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return False(t, value, append([]interface{}{msg}, args...)...) } // FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return FileExists(t, path, append([]interface{}{msg}, args...)...) } // HTTPBodyContainsf asserts that a specified handler returns a // body that contains a string. // -// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) } // HTTPBodyNotContainsf asserts that a specified handler returns a // body that does not contain a string. // -// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) } @@ -159,6 +189,9 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...) } @@ -168,6 +201,9 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...) } @@ -177,6 +213,9 @@ func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url stri // // Returns whether the assertion was successful (true) or not (false). func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...) } @@ -184,51 +223,69 @@ func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url strin // // assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) } // InDeltaf asserts that the two numerals are within delta of each other. // // assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...) } // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...) } // InDeltaSlicef is the same as InDelta, except it compares two slices. func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...) } // InEpsilonf asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) } // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) } // IsTypef asserts that the specified objects are of the same type. func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...) } // JSONEqf asserts that two JSON strings are equivalent. // // assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...) } @@ -236,18 +293,20 @@ func JSONEqf(t TestingT, expected string, actual string, msg string, args ...int // Lenf also fails if the object has a type that len() not accept. // // assert.Lenf(t, mySlice, 3, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Len(t, object, length, append([]interface{}{msg}, args...)...) } // Nilf asserts that the specified object is nil. // // assert.Nilf(t, err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Nil(t, object, append([]interface{}{msg}, args...)...) } @@ -257,9 +316,10 @@ func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool // if assert.NoErrorf(t, err, "error message %s", "formatted") { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NoError(t, err, append([]interface{}{msg}, args...)...) } @@ -269,9 +329,10 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { // assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") // assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") // assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) } @@ -281,9 +342,10 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotEmpty(t, object, append([]interface{}{msg}, args...)...) } @@ -291,29 +353,32 @@ func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) // // assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...) } // NotNilf asserts that the specified object is not nil. // // assert.NotNilf(t, err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotNil(t, object, append([]interface{}{msg}, args...)...) } // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. // // assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotPanics(t, f, append([]interface{}{msg}, args...)...) } @@ -321,9 +386,10 @@ func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bo // // assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") // assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...) } @@ -331,23 +397,28 @@ func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args .. // elements given in the specified subset(array, slice...). // // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...) } -// NotZerof asserts that i is not the zero value for its type and returns the truth. +// NotZerof asserts that i is not the zero value for its type. func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return NotZero(t, i, append([]interface{}{msg}, args...)...) } // Panicsf asserts that the code inside the specified PanicTestFunc panics. // // assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Panics(t, f, append([]interface{}{msg}, args...)...) } @@ -355,9 +426,10 @@ func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool // the recovered panic value equals the expected panic value. // // assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...) } @@ -365,9 +437,10 @@ func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg str // // assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") // assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Regexp(t, rx, str, append([]interface{}{msg}, args...)...) } @@ -375,31 +448,37 @@ func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...in // elements given in the specified subset(array, slice...). // // assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Subset(t, list, subset, append([]interface{}{msg}, args...)...) } // Truef asserts that the specified value is true. // // assert.Truef(t, myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Truef(t TestingT, value bool, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return True(t, value, append([]interface{}{msg}, args...)...) } // WithinDurationf asserts that the two times are within duration delta of each other. // // assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...) } -// Zerof asserts that i is the zero value for its type and returns the truth. +// Zerof asserts that i is the zero value for its type. func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } return Zero(t, i, append([]interface{}{msg}, args...)...) } diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl index c5cc66f..d2bb0b8 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl @@ -1,4 +1,5 @@ {{.CommentFormat}} func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { + if h, ok := t.(tHelper); ok { h.Helper() } return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) } diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index 7c4f497..de39f79 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -13,11 +13,17 @@ import ( // Condition uses a Comparison to assert a complex condition. func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Condition(a.t, comp, msgAndArgs...) } // Conditionf uses a Comparison to assert a complex condition. func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Conditionf(a.t, comp, msg, args...) } @@ -27,9 +33,10 @@ func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{} // a.Contains("Hello World", "World") // a.Contains(["Hello", "World"], "World") // a.Contains({"Hello": "World"}, "Hello") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Contains(a.t, s, contains, msgAndArgs...) } @@ -39,19 +46,26 @@ func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs .. // a.Containsf("Hello World", "World", "error message %s", "formatted") // a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") // a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Containsf(a.t, s, contains, msg, args...) } // DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return DirExists(a.t, path, msgAndArgs...) } // DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return DirExistsf(a.t, path, msg, args...) } @@ -59,10 +73,11 @@ func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bo // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])) -// -// Returns whether the assertion was successful (true) or not (false). +// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return ElementsMatch(a.t, listA, listB, msgAndArgs...) } @@ -70,10 +85,11 @@ func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndA // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")) -// -// Returns whether the assertion was successful (true) or not (false). +// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return ElementsMatchf(a.t, listA, listB, msg, args...) } @@ -81,9 +97,10 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st // a slice or a channel with len == 0. // // a.Empty(obj) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Empty(a.t, object, msgAndArgs...) } @@ -91,9 +108,10 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { // a slice or a channel with len == 0. // // a.Emptyf(obj, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Emptyf(a.t, object, msg, args...) } @@ -101,12 +119,13 @@ func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) // // a.Equal(123, 123) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Equal(a.t, expected, actual, msgAndArgs...) } @@ -115,9 +134,10 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs // // actualObj, err := SomeFunction() // a.EqualError(err, expectedErrorString) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return EqualError(a.t, theError, errString, msgAndArgs...) } @@ -126,9 +146,10 @@ func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ... // // actualObj, err := SomeFunction() // a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return EqualErrorf(a.t, theError, errString, msg, args...) } @@ -136,9 +157,10 @@ func (a *Assertions) EqualErrorf(theError error, errString string, msg string, a // and equal. // // a.EqualValues(uint32(123), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return EqualValues(a.t, expected, actual, msgAndArgs...) } @@ -146,9 +168,10 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn // and equal. // // a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return EqualValuesf(a.t, expected, actual, msg, args...) } @@ -156,12 +179,13 @@ func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg // // a.Equalf(123, 123, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Equalf(a.t, expected, actual, msg, args...) } @@ -171,9 +195,10 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // if a.Error(err) { // assert.Equal(t, expectedError, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Error(a.t, err, msgAndArgs...) } @@ -183,115 +208,150 @@ func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { // if a.Errorf(err, "error message %s", "formatted") { // assert.Equal(t, expectedErrorf, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Errorf(a.t, err, msg, args...) } // Exactly asserts that two objects are equal in value and type. // // a.Exactly(int32(123), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Exactly(a.t, expected, actual, msgAndArgs...) } // Exactlyf asserts that two objects are equal in value and type. // // a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Exactlyf(a.t, expected, actual, msg, args...) } // Fail reports a failure through func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Fail(a.t, failureMessage, msgAndArgs...) } // FailNow fails test func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return FailNow(a.t, failureMessage, msgAndArgs...) } // FailNowf fails test func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return FailNowf(a.t, failureMessage, msg, args...) } // Failf reports a failure through func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Failf(a.t, failureMessage, msg, args...) } // False asserts that the specified value is false. // // a.False(myBool) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return False(a.t, value, msgAndArgs...) } // Falsef asserts that the specified value is false. // // a.Falsef(myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Falsef(a.t, value, msg, args...) } // FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return FileExists(a.t, path, msgAndArgs...) } // FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return FileExistsf(a.t, path, msg, args...) } // HTTPBodyContains asserts that a specified handler returns a // body that contains a string. // -// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) } // HTTPBodyContainsf asserts that a specified handler returns a // body that contains a string. // -// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) } // HTTPBodyNotContains asserts that a specified handler returns a // body that does not contain a string. // -// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) } // HTTPBodyNotContainsf asserts that a specified handler returns a // body that does not contain a string. // -// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) } @@ -301,6 +361,9 @@ func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method strin // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPError(a.t, handler, method, url, values, msgAndArgs...) } @@ -310,6 +373,9 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPErrorf(a.t, handler, method, url, values, msg, args...) } @@ -319,6 +385,9 @@ func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url str // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) } @@ -328,6 +397,9 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPRedirectf(a.t, handler, method, url, values, msg, args...) } @@ -337,6 +409,9 @@ func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) } @@ -346,6 +421,9 @@ func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url st // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return HTTPSuccessf(a.t, handler, method, url, values, msg, args...) } @@ -353,6 +431,9 @@ func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url s // // a.Implements((*MyInterface)(nil), new(MyObject)) func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Implements(a.t, interfaceObject, object, msgAndArgs...) } @@ -360,96 +441,129 @@ func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, // // a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Implementsf(a.t, interfaceObject, object, msg, args...) } // InDelta asserts that the two numerals are within delta of each other. // // a.InDelta(math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDelta(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) } // InDeltaSlice is the same as InDelta, except it compares two slices. func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaSlicef is the same as InDelta, except it compares two slices. func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDeltaSlicef(a.t, expected, actual, delta, msg, args...) } // InDeltaf asserts that the two numerals are within delta of each other. // // a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InDeltaf(a.t, expected, actual, delta, msg, args...) } // InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) } // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) } // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) } // InEpsilonf asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return InEpsilonf(a.t, expected, actual, epsilon, msg, args...) } // IsType asserts that the specified objects are of the same type. func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return IsType(a.t, expectedType, object, msgAndArgs...) } // IsTypef asserts that the specified objects are of the same type. func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return IsTypef(a.t, expectedType, object, msg, args...) } // JSONEq asserts that two JSON strings are equivalent. // // a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return JSONEq(a.t, expected, actual, msgAndArgs...) } // JSONEqf asserts that two JSON strings are equivalent. // // a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return JSONEqf(a.t, expected, actual, msg, args...) } @@ -457,9 +571,10 @@ func (a *Assertions) JSONEqf(expected string, actual string, msg string, args .. // Len also fails if the object has a type that len() not accept. // // a.Len(mySlice, 3) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Len(a.t, object, length, msgAndArgs...) } @@ -467,27 +582,30 @@ func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface // Lenf also fails if the object has a type that len() not accept. // // a.Lenf(mySlice, 3, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Lenf(a.t, object, length, msg, args...) } // Nil asserts that the specified object is nil. // // a.Nil(err) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Nil(a.t, object, msgAndArgs...) } // Nilf asserts that the specified object is nil. // // a.Nilf(err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Nilf(a.t, object, msg, args...) } @@ -497,9 +615,10 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) b // if a.NoError(err) { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NoError(a.t, err, msgAndArgs...) } @@ -509,9 +628,10 @@ func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { // if a.NoErrorf(err, "error message %s", "formatted") { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NoErrorf(a.t, err, msg, args...) } @@ -521,9 +641,10 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { // a.NotContains("Hello World", "Earth") // a.NotContains(["Hello", "World"], "Earth") // a.NotContains({"Hello": "World"}, "Earth") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotContains(a.t, s, contains, msgAndArgs...) } @@ -533,9 +654,10 @@ func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs // a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") // a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") // a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotContainsf(a.t, s, contains, msg, args...) } @@ -545,9 +667,10 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotEmpty(a.t, object, msgAndArgs...) } @@ -557,9 +680,10 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotEmptyf(a.t, object, msg, args...) } @@ -567,11 +691,12 @@ func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface // // a.NotEqual(obj1, obj2) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotEqual(a.t, expected, actual, msgAndArgs...) } @@ -579,47 +704,52 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr // // a.NotEqualf(obj1, obj2, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotEqualf(a.t, expected, actual, msg, args...) } // NotNil asserts that the specified object is not nil. // // a.NotNil(err) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotNil(a.t, object, msgAndArgs...) } // NotNilf asserts that the specified object is not nil. // // a.NotNilf(err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotNilf(a.t, object, msg, args...) } // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. // // a.NotPanics(func(){ RemainCalm() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotPanics(a.t, f, msgAndArgs...) } // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. // // a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotPanicsf(a.t, f, msg, args...) } @@ -627,9 +757,10 @@ func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{} // // a.NotRegexp(regexp.MustCompile("starts"), "it's starting") // a.NotRegexp("^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotRegexp(a.t, rx, str, msgAndArgs...) } @@ -637,9 +768,10 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in // // a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") // a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotRegexpf(a.t, rx, str, msg, args...) } @@ -647,9 +779,10 @@ func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, arg // elements given in the specified subset(array, slice...). // // a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotSubset(a.t, list, subset, msgAndArgs...) } @@ -657,28 +790,36 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs // elements given in the specified subset(array, slice...). // // a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotSubsetf(a.t, list, subset, msg, args...) } -// NotZero asserts that i is not the zero value for its type and returns the truth. +// NotZero asserts that i is not the zero value for its type. func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotZero(a.t, i, msgAndArgs...) } -// NotZerof asserts that i is not the zero value for its type and returns the truth. +// NotZerof asserts that i is not the zero value for its type. func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return NotZerof(a.t, i, msg, args...) } // Panics asserts that the code inside the specified PanicTestFunc panics. // // a.Panics(func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Panics(a.t, f, msgAndArgs...) } @@ -686,9 +827,10 @@ func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { // the recovered panic value equals the expected panic value. // // a.PanicsWithValue("crazy error", func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return PanicsWithValue(a.t, expected, f, msgAndArgs...) } @@ -696,18 +838,20 @@ func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgA // the recovered panic value equals the expected panic value. // // a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return PanicsWithValuef(a.t, expected, f, msg, args...) } // Panicsf asserts that the code inside the specified PanicTestFunc panics. // // a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Panicsf(a.t, f, msg, args...) } @@ -715,9 +859,10 @@ func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) b // // a.Regexp(regexp.MustCompile("start"), "it's starting") // a.Regexp("start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Regexp(a.t, rx, str, msgAndArgs...) } @@ -725,9 +870,10 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter // // a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") // a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Regexpf(a.t, rx, str, msg, args...) } @@ -735,9 +881,10 @@ func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args . // elements given in the specified subset(array, slice...). // // a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Subset(a.t, list, subset, msgAndArgs...) } @@ -745,54 +892,65 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... // elements given in the specified subset(array, slice...). // // a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Subsetf(a.t, list, subset, msg, args...) } // True asserts that the specified value is true. // // a.True(myBool) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return True(a.t, value, msgAndArgs...) } // Truef asserts that the specified value is true. // // a.Truef(myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Truef(a.t, value, msg, args...) } // WithinDuration asserts that the two times are within duration delta of each other. // // a.WithinDuration(time.Now(), time.Now(), 10*time.Second) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) } // WithinDurationf asserts that the two times are within duration delta of each other. // // a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return WithinDurationf(a.t, expected, actual, delta, msg, args...) } -// Zero asserts that i is the zero value for its type and returns the truth. +// Zero asserts that i is the zero value for its type. func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Zero(a.t, i, msgAndArgs...) } -// Zerof asserts that i is the zero value for its type and returns the truth. +// Zerof asserts that i is the zero value for its type. func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } return Zerof(a.t, i, msg, args...) } diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl index 99f9acf..188bb9e 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl @@ -1,4 +1,5 @@ {{.CommentWithoutT "a"}} func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { + if h, ok := a.t.(tHelper); ok { h.Helper() } return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) } diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 9d387bc..9bd4a80 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -27,6 +27,22 @@ type TestingT interface { Errorf(format string, args ...interface{}) } +// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful +// for table driven tests. +type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool + +// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful +// for table driven tests. +type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool + +// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful +// for table driven tests. +type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool + +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful +// for table driven tests. +type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool + // Comparison a custom function that returns true on success and false on failure type Comparison func() (success bool) @@ -38,21 +54,23 @@ type Comparison func() (success bool) // // This function does no assertion of any kind. func ObjectsAreEqual(expected, actual interface{}) bool { - if expected == nil || actual == nil { return expected == actual } - if exp, ok := expected.([]byte); ok { - act, ok := actual.([]byte) - if !ok { - return false - } else if exp == nil || act == nil { - return exp == nil && act == nil - } - return bytes.Equal(exp, act) - } - return reflect.DeepEqual(expected, actual) + exp, ok := expected.([]byte) + if !ok { + return reflect.DeepEqual(expected, actual) + } + + act, ok := actual.([]byte) + if !ok { + return false + } + if exp == nil || act == nil { + return exp == nil && act == nil + } + return bytes.Equal(exp, act) } // ObjectsAreEqualValues gets whether two objects are equal, or if their @@ -156,27 +174,16 @@ func isTest(name, prefix string) bool { return !unicode.IsLower(rune) } -// getWhitespaceString returns a string that is long enough to overwrite the default -// output from the go testing framework. -func getWhitespaceString() string { - - _, file, line, ok := runtime.Caller(1) - if !ok { - return "" - } - parts := strings.Split(file, "/") - file = parts[len(parts)-1] - - return strings.Repeat(" ", len(fmt.Sprintf("%s:%d: ", file, line))) - -} - func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { if len(msgAndArgs) == 0 || msgAndArgs == nil { return "" } if len(msgAndArgs) == 1 { - return msgAndArgs[0].(string) + msg := msgAndArgs[0] + if msgAsStr, ok := msg.(string); ok { + return msgAsStr + } + return fmt.Sprintf("%+v", msg) } if len(msgAndArgs) > 1 { return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) @@ -195,7 +202,7 @@ func indentMessageLines(message string, longestLabelLen int) string { // no need to align first line because it starts at the correct location (after the label) if i != 0 { // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab - outBuf.WriteString("\n\r\t" + strings.Repeat(" ", longestLabelLen+1) + "\t") + outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t") } outBuf.WriteString(scanner.Text()) } @@ -209,6 +216,9 @@ type failNower interface { // FailNow fails test func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } Fail(t, failureMessage, msgAndArgs...) // We cannot extend TestingT with FailNow() and @@ -227,8 +237,11 @@ func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool // Fail reports a failure through func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } content := []labeledContent{ - {"Error Trace", strings.Join(CallerInfo(), "\n\r\t\t\t")}, + {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")}, {"Error", failureMessage}, } @@ -244,7 +257,7 @@ func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { content = append(content, labeledContent{"Messages", message}) } - t.Errorf("%s", "\r"+getWhitespaceString()+labeledOutput(content...)) + t.Errorf("\n%s", ""+labeledOutput(content...)) return false } @@ -256,7 +269,7 @@ type labeledContent struct { // labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner: // -// \r\t{{label}}:{{align_spaces}}\t{{content}}\n +// \t{{label}}:{{align_spaces}}\t{{content}}\n // // The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label. // If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this @@ -272,7 +285,7 @@ func labeledOutput(content ...labeledContent) string { } var output string for _, v := range content { - output += "\r\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n" + output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n" } return output } @@ -281,6 +294,9 @@ func labeledOutput(content ...labeledContent) string { // // assert.Implements(t, (*MyInterface)(nil), new(MyObject)) func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } interfaceType := reflect.TypeOf(interfaceObject).Elem() if object == nil { @@ -295,6 +311,9 @@ func Implements(t TestingT, interfaceObject interface{}, object interface{}, msg // IsType asserts that the specified objects are of the same type. func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) @@ -307,12 +326,13 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs // // assert.Equal(t, 123, 123) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if err := validateEqualArgs(expected, actual); err != nil { return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)", expected, actual, err), msgAndArgs...) @@ -350,9 +370,10 @@ func formatUnequalValues(expected, actual interface{}) (e string, a string) { // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if !ObjectsAreEqualValues(expected, actual) { diff := diff(expected, actual) @@ -369,15 +390,16 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa // Exactly asserts that two objects are equal in value and type. // // assert.Exactly(t, int32(123), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } aType := reflect.TypeOf(expected) bType := reflect.TypeOf(actual) if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\r\t%v != %v", aType, bType), msgAndArgs...) + return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) } return Equal(t, expected, actual, msgAndArgs...) @@ -387,15 +409,27 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} // NotNil asserts that the specified object is not nil. // // assert.NotNil(t, err) -// -// Returns whether the assertion was successful (true) or not (false). func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if !isNil(object) { return true } return Fail(t, "Expected value not to be nil.", msgAndArgs...) } +// containsKind checks if a specified kind in the slice of kinds. +func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { + for i := 0; i < len(kinds); i++ { + if kind == kinds[i] { + return true + } + } + + return false +} + // isNil checks if a specified object is nil or not, without Failing. func isNil(object interface{}) bool { if object == nil { @@ -404,7 +438,14 @@ func isNil(object interface{}) bool { value := reflect.ValueOf(object) kind := value.Kind() - if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() { + isNilableKind := containsKind( + []reflect.Kind{ + reflect.Chan, reflect.Func, + reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice}, + kind) + + if isNilableKind && value.IsNil() { return true } @@ -414,9 +455,10 @@ func isNil(object interface{}) bool { // Nil asserts that the specified object is nil. // // assert.Nil(t, err) -// -// Returns whether the assertion was successful (true) or not (false). func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if isNil(object) { return true } @@ -455,9 +497,10 @@ func isEmpty(object interface{}) bool { // a slice or a channel with len == 0. // // assert.Empty(t, obj) -// -// Returns whether the assertion was successful (true) or not (false). func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } pass := isEmpty(object) if !pass { @@ -474,9 +517,10 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } pass := !isEmpty(object) if !pass { @@ -503,9 +547,10 @@ func getLen(x interface{}) (ok bool, length int) { // Len also fails if the object has a type that len() not accept. // // assert.Len(t, mySlice, 3) -// -// Returns whether the assertion was successful (true) or not (false). func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } ok, l := getLen(object) if !ok { return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) @@ -520,9 +565,15 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) // True asserts that the specified value is true. // // assert.True(t, myBool) -// -// Returns whether the assertion was successful (true) or not (false). func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if h, ok := t.(interface { + Helper() + }); ok { + h.Helper() + } if value != true { return Fail(t, "Should be true", msgAndArgs...) @@ -535,9 +586,10 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { // False asserts that the specified value is false. // // assert.False(t, myBool) -// -// Returns whether the assertion was successful (true) or not (false). func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if value != false { return Fail(t, "Should be false", msgAndArgs...) @@ -551,11 +603,12 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { // // assert.NotEqual(t, obj1, obj2) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if err := validateEqualArgs(expected, actual); err != nil { return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)", expected, actual, err), msgAndArgs...) @@ -613,9 +666,10 @@ func includeElement(list interface{}, element interface{}) (ok, found bool) { // assert.Contains(t, "Hello World", "World") // assert.Contains(t, ["Hello", "World"], "World") // assert.Contains(t, {"Hello": "World"}, "Hello") -// -// Returns whether the assertion was successful (true) or not (false). func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } ok, found := includeElement(s, contains) if !ok { @@ -635,9 +689,10 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo // assert.NotContains(t, "Hello World", "Earth") // assert.NotContains(t, ["Hello", "World"], "Earth") // assert.NotContains(t, {"Hello": "World"}, "Earth") -// -// Returns whether the assertion was successful (true) or not (false). func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } ok, found := includeElement(s, contains) if !ok { @@ -655,9 +710,10 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) // elements given in the specified subset(array, slice...). // // assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } if subset == nil { return true // we consider nil to be equal to the nil set } @@ -698,9 +754,10 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok // elements given in the specified subset(array, slice...). // // assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } if subset == nil { return Fail(t, fmt.Sprintf("nil is the empty set which is a subset of every set"), msgAndArgs...) } @@ -741,10 +798,11 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])) -// -// Returns whether the assertion was successful (true) or not (false). +// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } if isEmpty(listA) && isEmpty(listB) { return true } @@ -795,6 +853,9 @@ func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface // Condition uses a Comparison to assert a complex condition. func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } result := comp() if !result { Fail(t, "Condition failed!", msgAndArgs...) @@ -831,12 +892,13 @@ func didPanic(f PanicTestFunc) (bool, interface{}) { // Panics asserts that the code inside the specified PanicTestFunc panics. // // assert.Panics(t, func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if funcDidPanic, panicValue := didPanic(f); !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) } return true @@ -846,16 +908,17 @@ func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { // the recovered panic value equals the expected panic value. // // assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } funcDidPanic, panicValue := didPanic(f) if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) } if panicValue != expected { - return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%v\n\r\tPanic value:\t%v", f, expected, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v", f, expected, panicValue), msgAndArgs...) } return true @@ -864,12 +927,13 @@ func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndAr // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. // // assert.NotPanics(t, func(){ RemainCalm() }) -// -// Returns whether the assertion was successful (true) or not (false). func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if funcDidPanic, panicValue := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v", f, panicValue), msgAndArgs...) } return true @@ -878,9 +942,10 @@ func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { // WithinDuration asserts that the two times are within duration delta of each other. // // assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) -// -// Returns whether the assertion was successful (true) or not (false). func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } dt := expected.Sub(actual) if dt < -delta || dt > delta { @@ -929,9 +994,10 @@ func toFloat(x interface{}) (float64, bool) { // InDelta asserts that the two numerals are within delta of each other. // // assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } af, aok := toFloat(expected) bf, bok := toFloat(actual) @@ -958,6 +1024,9 @@ func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs // InDeltaSlice is the same as InDelta, except it compares two slices. func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Slice || reflect.TypeOf(expected).Kind() != reflect.Slice { @@ -979,6 +1048,9 @@ func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAn // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Map || reflect.TypeOf(expected).Kind() != reflect.Map { @@ -989,7 +1061,7 @@ func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, m actualMap := reflect.ValueOf(actual) if expectedMap.Len() != actualMap.Len() { - return Fail(t, "Arguments must have the same numbe of keys", msgAndArgs...) + return Fail(t, "Arguments must have the same number of keys", msgAndArgs...) } for _, k := range expectedMap.MapKeys() { @@ -1035,9 +1107,10 @@ func calcRelativeError(expected, actual interface{}) (float64, error) { } // InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } actualEpsilon, err := calcRelativeError(expected, actual) if err != nil { return Fail(t, err.Error(), msgAndArgs...) @@ -1052,6 +1125,9 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Slice || reflect.TypeOf(expected).Kind() != reflect.Slice { @@ -1081,9 +1157,10 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m // if assert.NoError(t, err) { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if err != nil { return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...) } @@ -1097,9 +1174,10 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // if assert.Error(t, err) { // assert.Equal(t, expectedError, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if err == nil { return Fail(t, "An error is expected but got nil.", msgAndArgs...) @@ -1113,9 +1191,10 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { // // actualObj, err := SomeFunction() // assert.EqualError(t, err, expectedErrorString) -// -// Returns whether the assertion was successful (true) or not (false). func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if !Error(t, theError, msgAndArgs...) { return false } @@ -1148,9 +1227,10 @@ func matchRegexp(rx interface{}, str interface{}) bool { // // assert.Regexp(t, regexp.MustCompile("start"), "it's starting") // assert.Regexp(t, "start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } match := matchRegexp(rx, str) @@ -1165,9 +1245,10 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface // // assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") // assert.NotRegexp(t, "^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } match := matchRegexp(rx, str) if match { @@ -1178,16 +1259,22 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf } -// Zero asserts that i is the zero value for its type and returns the truth. +// Zero asserts that i is the zero value for its type. func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) } return true } -// NotZero asserts that i is not the zero value for its type and returns the truth. +// NotZero asserts that i is not the zero value for its type. func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) } @@ -1196,6 +1283,9 @@ func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { // FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } info, err := os.Lstat(path) if err != nil { if os.IsNotExist(err) { @@ -1211,6 +1301,9 @@ func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { // DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } info, err := os.Lstat(path) if err != nil { if os.IsNotExist(err) { @@ -1227,9 +1320,10 @@ func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { // JSONEq asserts that two JSON strings are equivalent. // // assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } var expectedJSONAsInterface, actualJSONAsInterface interface{} if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { @@ -1255,7 +1349,7 @@ func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { } // diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice or array. Otherwise it returns an empty string. +// are a struct, map, slice, array or string. Otherwise it returns an empty string. func diff(expected interface{}, actual interface{}) string { if expected == nil || actual == nil { return "" @@ -1268,12 +1362,18 @@ func diff(expected interface{}, actual interface{}) string { return "" } - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { + if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String { return "" } - e := spewConfig.Sdump(expected) - a := spewConfig.Sdump(actual) + var e, a string + if et != reflect.TypeOf("") { + e = spewConfig.Sdump(expected) + a = spewConfig.Sdump(actual) + } else { + e = expected.(string) + a = actual.(string) + } diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ A: difflib.SplitLines(e), @@ -1310,3 +1410,7 @@ var spewConfig = spew.ConfigState{ DisableCapacities: true, SortKeys: true, } + +type tHelper interface { + Helper() +} diff --git a/vendor/github.com/stretchr/testify/assert/assertions_test.go b/vendor/github.com/stretchr/testify/assert/assertions_test.go index 6757bd1..00e2d21 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions_test.go +++ b/vendor/github.com/stretchr/testify/assert/assertions_test.go @@ -2,6 +2,7 @@ package assert import ( "bytes" + "encoding/json" "errors" "fmt" "io" @@ -174,6 +175,8 @@ func TestIsType(t *testing.T) { } +type myType string + func TestEqual(t *testing.T) { mockT := new(testing.T) @@ -199,6 +202,9 @@ func TestEqual(t *testing.T) { if !Equal(mockT, uint64(123), uint64(123)) { t.Error("Equal should return true") } + if !Equal(mockT, myType("1"), myType("1")) { + t.Error("Equal should return true") + } if !Equal(mockT, &struct{}{}, &struct{}{}) { t.Error("Equal should return true (pointer equality is based on equality of underlying value)") } @@ -206,6 +212,9 @@ func TestEqual(t *testing.T) { if Equal(mockT, m["bar"], "something") { t.Error("Equal should return false") } + if Equal(mockT, myType("1"), myType("2")) { + t.Error("Equal should return false") + } } // bufferT implements TestingT. Its implementation of Errorf writes the output that would be produced by @@ -250,6 +259,21 @@ func (t *bufferT) Errorf(format string, args ...interface{}) { t.buf.WriteString(decorate(fmt.Sprintf(format, args...))) } +func TestStringEqual(t *testing.T) { + for i, currCase := range []struct { + equalWant string + equalGot string + msgAndArgs []interface{} + want string + }{ + {equalWant: "hi, \nmy name is", equalGot: "what,\nmy name is", want: "\tassertions.go:\\d+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"hi, \\\\nmy name is\"\n\\s+actual\\s+: \"what,\\\\nmy name is\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1,2 \\+1,2 @@\n\\s+-hi, \n\\s+\\+what,\n\\s+my name is"}, + } { + mockT := &bufferT{} + Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...) + Regexp(t, regexp.MustCompile(currCase.want), mockT.buf.String(), "Case %d", i) + } +} + func TestEqualFormatting(t *testing.T) { for i, currCase := range []struct { equalWant string @@ -257,8 +281,10 @@ func TestEqualFormatting(t *testing.T) { msgAndArgs []interface{} want string }{ - {equalWant: "want", equalGot: "got", want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual : \"got\"\n"}, - {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual : \"got\"\n\t\t\r\tMessages: \thello, world!\n"}, + {equalWant: "want", equalGot: "got", want: "\tassertions.go:\\d+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n"}, + {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+hello, world!\n"}, + {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{123}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+123\n"}, + {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{struct{ a string }{"hello"}}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+{a:hello}\n"}, } { mockT := &bufferT{} Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...) @@ -1579,3 +1605,199 @@ func TestEqualArgsValidation(t *testing.T) { err := validateEqualArgs(time.Now, time.Now) EqualError(t, err, "cannot take func type as argument") } + +func ExampleComparisonAssertionFunc() { + t := &testing.T{} // provided by test + + adder := func(x, y int) int { + return x + y + } + + type args struct { + x int + y int + } + + tests := []struct { + name string + args args + expect int + assertion ComparisonAssertionFunc + }{ + {"2+2=4", args{2, 2}, 4, Equal}, + {"2+2!=5", args{2, 2}, 5, NotEqual}, + {"2+3==5", args{2, 3}, 5, Exactly}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y)) + }) + } +} + +func TestComparisonAssertionFunc(t *testing.T) { + type iface interface { + Name() string + } + + tests := []struct { + name string + expect interface{} + got interface{} + assertion ComparisonAssertionFunc + }{ + {"implements", (*iface)(nil), t, Implements}, + {"isType", (*testing.T)(nil), t, IsType}, + {"equal", t, t, Equal}, + {"equalValues", t, t, EqualValues}, + {"exactly", t, t, Exactly}, + {"notEqual", t, nil, NotEqual}, + {"notContains", []int{1, 2, 3}, 4, NotContains}, + {"subset", []int{1, 2, 3, 4}, []int{2, 3}, Subset}, + {"notSubset", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset}, + {"elementsMatch", []byte("abc"), []byte("bac"), ElementsMatch}, + {"regexp", "^t.*y$", "testify", Regexp}, + {"notRegexp", "^t.*y$", "Testify", NotRegexp}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.expect, tt.got) + }) + } +} + +func ExampleValueAssertionFunc() { + t := &testing.T{} // provided by test + + dumbParse := func(input string) interface{} { + var x interface{} + json.Unmarshal([]byte(input), &x) + return x + } + + tests := []struct { + name string + arg string + assertion ValueAssertionFunc + }{ + {"true is not nil", "true", NotNil}, + {"empty string is nil", "", Nil}, + {"zero is not nil", "0", NotNil}, + {"zero is zero", "0", Zero}, + {"false is zero", "false", Zero}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, dumbParse(tt.arg)) + }) + } +} + +func TestValueAssertionFunc(t *testing.T) { + tests := []struct { + name string + value interface{} + assertion ValueAssertionFunc + }{ + {"notNil", true, NotNil}, + {"nil", nil, Nil}, + {"empty", []int{}, Empty}, + {"notEmpty", []int{1}, NotEmpty}, + {"zero", false, Zero}, + {"notZero", 42, NotZero}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.value) + }) + } +} + +func ExampleBoolAssertionFunc() { + t := &testing.T{} // provided by test + + isOkay := func(x int) bool { + return x >= 42 + } + + tests := []struct { + name string + arg int + assertion BoolAssertionFunc + }{ + {"-1 is bad", -1, False}, + {"42 is good", 42, True}, + {"41 is bad", 41, False}, + {"45 is cool", 45, True}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, isOkay(tt.arg)) + }) + } +} + +func TestBoolAssertionFunc(t *testing.T) { + tests := []struct { + name string + value bool + assertion BoolAssertionFunc + }{ + {"true", true, True}, + {"false", false, False}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.value) + }) + } +} + +func ExampleErrorAssertionFunc() { + t := &testing.T{} // provided by test + + dumbParseNum := func(input string, v interface{}) error { + return json.Unmarshal([]byte(input), v) + } + + tests := []struct { + name string + arg string + assertion ErrorAssertionFunc + }{ + {"1.2 is number", "1.2", NoError}, + {"1.2.3 not number", "1.2.3", Error}, + {"true is not number", "true", Error}, + {"3 is number", "3", NoError}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var x float64 + tt.assertion(t, dumbParseNum(tt.arg, &x)) + }) + } +} + +func TestErrorAssertionFunc(t *testing.T) { + tests := []struct { + name string + err error + assertion ErrorAssertionFunc + }{ + {"noError", nil, NoError}, + {"error", errors.New("whoops"), Error}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.err) + }) + } +} diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index 3101e78..df46fa7 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -12,10 +12,11 @@ import ( // an error if building a new request fails. func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { w := httptest.NewRecorder() - req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + req, err := http.NewRequest(method, url, nil) if err != nil { return -1, err } + req.URL.RawQuery = values.Encode() handler(w, req) return w.Code, nil } @@ -26,6 +27,9 @@ func httpCode(handler http.HandlerFunc, method, url string, values url.Values) ( // // Returns whether the assertion was successful (true) or not (false). func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) @@ -46,6 +50,9 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value // // Returns whether the assertion was successful (true) or not (false). func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) @@ -66,6 +73,9 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu // // Returns whether the assertion was successful (true) or not (false). func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } code, err := httpCode(handler, method, url, values) if err != nil { Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) @@ -95,10 +105,13 @@ func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) s // HTTPBodyContains asserts that a specified handler returns a // body that contains a string. // -// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } body := HTTPBody(handler, method, url, values) contains := strings.Contains(body, fmt.Sprint(str)) @@ -112,10 +125,13 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, // HTTPBodyNotContains asserts that a specified handler returns a // body that does not contain a string. // -// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } body := HTTPBody(handler, method, url, values) contains := strings.Contains(body, fmt.Sprint(str)) diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions_test.go b/vendor/github.com/stretchr/testify/assert/http_assertions_test.go index 3ab7683..112beaf 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions_test.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions_test.go @@ -89,6 +89,35 @@ func httpHelloName(w http.ResponseWriter, r *http.Request) { w.Write([]byte(fmt.Sprintf("Hello, %s!", name))) } +func TestHTTPRequestWithNoParams(t *testing.T) { + var got *http.Request + handler := func(w http.ResponseWriter, r *http.Request) { + got = r + w.WriteHeader(http.StatusOK) + } + + True(t, HTTPSuccess(t, handler, "GET", "/url", nil)) + + Empty(t, got.URL.Query()) + Equal(t, "/url", got.URL.RequestURI()) +} + +func TestHTTPRequestWithParams(t *testing.T) { + var got *http.Request + handler := func(w http.ResponseWriter, r *http.Request) { + got = r + w.WriteHeader(http.StatusOK) + } + params := url.Values{} + params.Add("id", "12345") + + True(t, HTTPSuccess(t, handler, "GET", "/url", params)) + + Equal(t, url.Values{"id": []string{"12345"}}, got.URL.Query()) + Equal(t, "/url?id=12345", got.URL.String()) + Equal(t, "/url?id=12345", got.URL.RequestURI()) +} + func TestHttpBody(t *testing.T) { assert := New(t) mockT := new(testing.T) diff --git a/vendor/github.com/stretchr/testify/go.mod b/vendor/github.com/stretchr/testify/go.mod new file mode 100644 index 0000000..90e5dbe --- /dev/null +++ b/vendor/github.com/stretchr/testify/go.mod @@ -0,0 +1,7 @@ +module github.com/stretchr/testify + +require ( + github.com/davecgh/go-spew v1.1.0 + github.com/pmezard/go-difflib v1.0.0 + github.com/stretchr/objx v0.1.0 +) diff --git a/vendor/github.com/stretchr/testify/go.sum b/vendor/github.com/stretchr/testify/go.sum new file mode 100644 index 0000000..5b98bf3 --- /dev/null +++ b/vendor/github.com/stretchr/testify/go.sum @@ -0,0 +1,6 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go index 208b838..d6694ed 100644 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -42,6 +42,9 @@ type Call struct { // this method is called. ReturnArguments Arguments + // Holds the caller info for the On() call + callerInfo []string + // The number of times to return the return arguments when setting // expectations. 0 means to always return the value. Repeatability int @@ -64,12 +67,13 @@ type Call struct { RunFn func(Arguments) } -func newCall(parent *Mock, methodName string, methodArguments ...interface{}) *Call { +func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call { return &Call{ Parent: parent, Method: methodName, Arguments: methodArguments, ReturnArguments: make([]interface{}, 0), + callerInfo: callerInfo, Repeatability: 0, WaitFor: nil, RunFn: nil, @@ -172,6 +176,7 @@ func (c *Call) Maybe() *Call { // Mock. // On("MyMethod", 1).Return(nil). // On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) +//go:noinline func (c *Call) On(methodName string, arguments ...interface{}) *Call { return c.Parent.On(methodName, arguments...) } @@ -187,6 +192,10 @@ type Mock struct { // Holds the calls that were made to this mocked object. Calls []Call + // test is An optional variable that holds the test struct, to be used when an + // invalid mock call was made. + test TestingT + // TestData holds any data that might be useful for testing. Testify ignores // this data completely allowing you to do whatever you like with it. testData objx.Map @@ -209,6 +218,27 @@ func (m *Mock) TestData() objx.Map { Setting expectations */ +// Test sets the test struct variable of the mock object +func (m *Mock) Test(t TestingT) { + m.mutex.Lock() + defer m.mutex.Unlock() + m.test = t +} + +// fail fails the current test with the given formatted format and args. +// In case that a test was defined, it uses the test APIs for failing a test, +// otherwise it uses panic. +func (m *Mock) fail(format string, args ...interface{}) { + m.mutex.Lock() + defer m.mutex.Unlock() + + if m.test == nil { + panic(fmt.Sprintf(format, args...)) + } + m.test.Errorf(format, args...) + m.test.FailNow() +} + // On starts a description of an expectation of the specified method // being called. // @@ -222,7 +252,7 @@ func (m *Mock) On(methodName string, arguments ...interface{}) *Call { m.mutex.Lock() defer m.mutex.Unlock() - c := newCall(m, methodName, arguments...) + c := newCall(m, methodName, assert.CallerInfo(), arguments...) m.ExpectedCalls = append(m.ExpectedCalls, c) return c } @@ -245,27 +275,25 @@ func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, * return -1, nil } -func (m *Mock) findClosestCall(method string, arguments ...interface{}) (bool, *Call) { - diffCount := 0 +func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) { + var diffCount int var closestCall *Call + var err string for _, call := range m.expectedCalls() { if call.Method == method { - _, tempDiffCount := call.Arguments.Diff(arguments) + errInfo, tempDiffCount := call.Arguments.Diff(arguments) if tempDiffCount < diffCount || diffCount == 0 { diffCount = tempDiffCount closestCall = call + err = errInfo } } } - if closestCall == nil { - return false, nil - } - - return true, closestCall + return closestCall, err } func callString(method string, arguments Arguments, includeArgumentValues bool) string { @@ -312,6 +340,7 @@ func (m *Mock) Called(arguments ...interface{}) Arguments { // If Call.WaitFor is set, blocks until the channel is closed or receives a message. func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments { m.mutex.Lock() + //TODO: could combine expected and closes in single loop found, call := m.findExpectedCall(methodName, arguments...) if found < 0 { @@ -322,13 +351,18 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen // b) the arguments are not what was expected, or // c) the developer has forgotten to add an accompanying On...Return pair. - closestFound, closestCall := m.findClosestCall(methodName, arguments...) + closestCall, mismatch := m.findClosestCall(methodName, arguments...) m.mutex.Unlock() - if closestFound { - panic(fmt.Sprintf("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\n", callString(methodName, arguments, true), callString(methodName, closestCall.Arguments, true), diffArguments(closestCall.Arguments, arguments))) + if closestCall != nil { + m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s", + callString(methodName, arguments, true), + callString(methodName, closestCall.Arguments, true), + diffArguments(closestCall.Arguments, arguments), + strings.TrimSpace(mismatch), + ) } else { - panic(fmt.Sprintf("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo())) + m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) } } @@ -340,7 +374,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen call.totalCalls++ // add the call - m.Calls = append(m.Calls, *newCall(m, methodName, arguments...)) + m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...)) m.mutex.Unlock() // block if specified @@ -378,6 +412,9 @@ type assertExpectationser interface { // // Calls may have occurred in any order. func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } for _, obj := range testObjects { if m, ok := obj.(Mock); ok { t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") @@ -385,6 +422,7 @@ func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { } m := obj.(assertExpectationser) if !m.AssertExpectations(t) { + t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m)) return false } } @@ -394,6 +432,9 @@ func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { // AssertExpectations asserts that everything specified with On and Return was // in fact called as expected. Calls may have occurred in any order. func (m *Mock) AssertExpectations(t TestingT) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } m.mutex.Lock() defer m.mutex.Unlock() var somethingMissing bool @@ -405,13 +446,14 @@ func (m *Mock) AssertExpectations(t TestingT) bool { if !expectedCall.optional && !m.methodWasCalled(expectedCall.Method, expectedCall.Arguments) && expectedCall.totalCalls == 0 { somethingMissing = true failedExpectations++ - t.Logf("\u274C\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + t.Logf("FAIL:\t%s(%s)\n\t\tat: %s", expectedCall.Method, expectedCall.Arguments.String(), expectedCall.callerInfo) } else { if expectedCall.Repeatability > 0 { somethingMissing = true failedExpectations++ + t.Logf("FAIL:\t%s(%s)\n\t\tat: %s", expectedCall.Method, expectedCall.Arguments.String(), expectedCall.callerInfo) } else { - t.Logf("\u2705\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + t.Logf("PASS:\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) } } } @@ -425,6 +467,9 @@ func (m *Mock) AssertExpectations(t TestingT) bool { // AssertNumberOfCalls asserts that the method was called expectedCalls times. func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } m.mutex.Lock() defer m.mutex.Unlock() var actualCalls int @@ -439,11 +484,22 @@ func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls // AssertCalled asserts that the method was called. // It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } m.mutex.Lock() defer m.mutex.Unlock() - if !assert.True(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method should have been called with %d argument(s), but was not.", methodName, len(arguments))) { - t.Logf("%v", m.expectedCalls()) - return false + if !m.methodWasCalled(methodName, arguments) { + var calledWithArgs []string + for _, call := range m.calls() { + calledWithArgs = append(calledWithArgs, fmt.Sprintf("%v", call.Arguments)) + } + if len(calledWithArgs) == 0 { + return assert.Fail(t, "Should have called with given arguments", + fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments)) + } + return assert.Fail(t, "Should have called with given arguments", + fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n"))) } return true } @@ -451,11 +507,14 @@ func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interfac // AssertNotCalled asserts that the method was not called. // It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } m.mutex.Lock() defer m.mutex.Unlock() - if !assert.False(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method was called with %d argument(s), but should NOT have been.", methodName, len(arguments))) { - t.Logf("%v", m.expectedCalls()) - return false + if m.methodWasCalled(methodName, arguments) { + return assert.Fail(t, "Should not have called with given arguments", + fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments)) } return true } @@ -495,7 +554,7 @@ type Arguments []interface{} const ( // Anything is used in Diff and Assert when the argument being tested // shouldn't be taken into consideration. - Anything string = "mock.Anything" + Anything = "mock.Anything" ) // AnythingOfTypeArgument is a string that contains the type of an argument @@ -598,6 +657,7 @@ func (args Arguments) Is(objects ...interface{}) bool { // // Returns the diff string and number of differences found. func (args Arguments) Diff(objects []interface{}) (string, int) { + //TODO: could return string as error and nil for No difference var output = "\n" var differences int @@ -609,25 +669,30 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { for i := 0; i < maxArgCount; i++ { var actual, expected interface{} + var actualFmt, expectedFmt string if len(objects) <= i { actual = "(Missing)" + actualFmt = "(Missing)" } else { actual = objects[i] + actualFmt = fmt.Sprintf("(%[1]T=%[1]v)", actual) } if len(args) <= i { expected = "(Missing)" + expectedFmt = "(Missing)" } else { expected = args[i] + expectedFmt = fmt.Sprintf("(%[1]T=%[1]v)", expected) } if matcher, ok := expected.(argumentMatcher); ok { if matcher.Matches(actual) { - output = fmt.Sprintf("%s\t%d: \u2705 %s matched by %s\n", output, i, actual, matcher) + output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher) } else { differences++ - output = fmt.Sprintf("%s\t%d: \u2705 %s not matched by %s\n", output, i, actual, matcher) + output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher) } } else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() { @@ -635,7 +700,7 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { if reflect.TypeOf(actual).Name() != string(expected.(AnythingOfTypeArgument)) && reflect.TypeOf(actual).String() != string(expected.(AnythingOfTypeArgument)) { // not match differences++ - output = fmt.Sprintf("%s\t%d: \u274C type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actual) + output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) } } else { @@ -644,11 +709,11 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { // match - output = fmt.Sprintf("%s\t%d: \u2705 %s == %s\n", output, i, actual, expected) + output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) } else { // not match differences++ - output = fmt.Sprintf("%s\t%d: \u274C %s != %s\n", output, i, actual, expected) + output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) } } @@ -665,6 +730,9 @@ func (args Arguments) Diff(objects []interface{}) (string, int) { // Assert compares the arguments with the specified objects and fails if // they do not exactly match. func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } // get the differences diff, diffCount := args.Diff(objects) @@ -812,3 +880,7 @@ var spewConfig = spew.ConfigState{ DisableCapacities: true, SortKeys: true, } + +type tHelper interface { + Helper() +} diff --git a/vendor/github.com/stretchr/testify/mock/mock_test.go b/vendor/github.com/stretchr/testify/mock/mock_test.go index cb245ba..2608f5a 100644 --- a/vendor/github.com/stretchr/testify/mock/mock_test.go +++ b/vendor/github.com/stretchr/testify/mock/mock_test.go @@ -3,6 +3,8 @@ package mock import ( "errors" "fmt" + "regexp" + "runtime" "sync" "testing" "time" @@ -30,6 +32,7 @@ func (i *TestExampleImplementation) TheExampleMethod(a, b, c int) (int, error) { return args.Int(0), errors.New("Whoops") } +//go:noinline func (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) { i.Called(yesorno) } @@ -90,6 +93,34 @@ func (i *TestExampleImplementation) TheExampleMethodFuncType(fn ExampleFuncType) return args.Error(0) } +// MockTestingT mocks a test struct +type MockTestingT struct { + logfCount, errorfCount, failNowCount int +} + +const mockTestingTFailNowCalled = "FailNow was called" + +func (m *MockTestingT) Logf(string, ...interface{}) { + m.logfCount++ +} + +func (m *MockTestingT) Errorf(string, ...interface{}) { + m.errorfCount++ +} + +// FailNow mocks the FailNow call. +// It panics in order to mimic the FailNow behavior in the sense that +// the execution stops. +// When expecting this method, the call that invokes it should use the following code: +// +// assert.PanicsWithValue(t, mockTestingTFailNowCalled, func() {...}) +func (m *MockTestingT) FailNow() { + m.failNowCount++ + + // this function should panic now to stop the execution as expected + panic(mockTestingTFailNowCalled) +} + /* Mock */ @@ -119,6 +150,8 @@ func Test_Mock_Chained_On(t *testing.T) { // make a test impl object var mockedService = new(TestExampleImplementation) + // determine our current line number so we can assert the expected calls callerInfo properly + _, _, line, _ := runtime.Caller(0) mockedService. On("TheExampleMethod", 1, 2, 3). Return(0). @@ -126,17 +159,19 @@ func Test_Mock_Chained_On(t *testing.T) { Return(nil) expectedCalls := []*Call{ - &Call{ + { Parent: &mockedService.Mock, Method: "TheExampleMethod", Arguments: []interface{}{1, 2, 3}, ReturnArguments: []interface{}{0}, + callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+2)}, }, - &Call{ + { Parent: &mockedService.Mock, Method: "TheExampleMethod3", Arguments: []interface{}{AnythingOfType("*mock.ExampleType")}, ReturnArguments: []interface{}{nil}, + callerInfo: []string{fmt.Sprintf("mock_test.go:%d", line+4)}, }, } assert.Equal(t, expectedCalls, mockedService.ExpectedCalls) @@ -198,6 +233,34 @@ func Test_Mock_On_WithIntArgMatcher(t *testing.T) { }) } +func TestMock_WithTest(t *testing.T) { + var ( + mockedService TestExampleImplementation + mockedTest MockTestingT + ) + + mockedService.Test(&mockedTest) + mockedService.On("TheExampleMethod", 1, 2, 3).Return(0, nil) + + // Test that on an expected call, the test was not failed + + mockedService.TheExampleMethod(1, 2, 3) + + // Assert that Errorf and FailNow were not called + assert.Equal(t, 0, mockedTest.errorfCount) + assert.Equal(t, 0, mockedTest.failNowCount) + + // Test that on unexpected call, the mocked test was called to fail the test + + assert.PanicsWithValue(t, mockTestingTFailNowCalled, func() { + mockedService.TheExampleMethod(1, 1, 1) + }) + + // Assert that Errorf and FailNow were called once + assert.Equal(t, 1, mockedTest.errorfCount) + assert.Equal(t, 1, mockedTest.failNowCount) +} + func Test_Mock_On_WithPtrArgMatcher(t *testing.T) { var mockedService TestExampleImplementation @@ -1125,8 +1188,8 @@ func Test_Arguments_Diff(t *testing.T) { diff, count = args.Diff([]interface{}{"Hello World", 456, "false"}) assert.Equal(t, 2, count) - assert.Contains(t, diff, `%!s(int=456) != %!s(int=123)`) - assert.Contains(t, diff, `false != %!s(bool=true)`) + assert.Contains(t, diff, `(int=456) != (int=123)`) + assert.Contains(t, diff, `(string=false) != (bool=true)`) } @@ -1138,7 +1201,7 @@ func Test_Arguments_Diff_DifferentNumberOfArgs(t *testing.T) { diff, count = args.Diff([]interface{}{"string", 456, "false", "extra"}) assert.Equal(t, 3, count) - assert.Contains(t, diff, `extra != (Missing)`) + assert.Contains(t, diff, `(string=extra) != (Missing)`) } @@ -1180,7 +1243,7 @@ func Test_Arguments_Diff_WithAnythingOfTypeArgument_Failing(t *testing.T) { diff, count = args.Diff([]interface{}{"string", 123, true}) assert.Equal(t, 1, count) - assert.Contains(t, diff, `string != type int - %!s(int=123)`) + assert.Contains(t, diff, `string != type int - (int=123)`) } @@ -1192,14 +1255,14 @@ func Test_Arguments_Diff_WithArgMatcher(t *testing.T) { diff, count := args.Diff([]interface{}{"string", 124, true}) assert.Equal(t, 1, count) - assert.Contains(t, diff, `%!s(int=124) not matched by func(int) bool`) + assert.Contains(t, diff, `(int=124) not matched by func(int) bool`) diff, count = args.Diff([]interface{}{"string", false, true}) assert.Equal(t, 1, count) - assert.Contains(t, diff, `%!s(bool=false) not matched by func(int) bool`) + assert.Contains(t, diff, `(bool=false) not matched by func(int) bool`) diff, count = args.Diff([]interface{}{"string", 123, false}) - assert.Contains(t, diff, `%!s(int=123) matched by func(int) bool`) + assert.Contains(t, diff, `(int=123) matched by func(int) bool`) diff, count = args.Diff([]interface{}{"string", 123, true}) assert.Equal(t, 0, count) @@ -1260,7 +1323,7 @@ func Test_Arguments_Bool(t *testing.T) { func Test_WaitUntil_Parallel(t *testing.T) { // make a test impl object - var mockedService *TestExampleImplementation = new(TestExampleImplementation) + var mockedService = new(TestExampleImplementation) ch1 := make(chan time.Time) ch2 := make(chan time.Time) @@ -1323,6 +1386,37 @@ func (s *timer) GetTime(i int) string { return s.Called(i).Get(0).(string) } +type tCustomLogger struct { + *testing.T + logs []string + errs []string +} + +func (tc *tCustomLogger) Logf(format string, args ...interface{}) { + tc.T.Logf(format, args...) + tc.logs = append(tc.logs, fmt.Sprintf(format, args...)) +} + +func (tc *tCustomLogger) Errorf(format string, args ...interface{}) { + tc.errs = append(tc.errs, fmt.Sprintf(format, args...)) +} + +func (tc *tCustomLogger) FailNow() {} + +func TestLoggingAssertExpectations(t *testing.T) { + m := new(timer) + m.On("GetTime", 0).Return("") + tcl := &tCustomLogger{t, []string{}, []string{}} + + AssertExpectationsForObjects(tcl, m, new(TestExampleImplementation)) + + require.Equal(t, 1, len(tcl.errs)) + assert.Regexp(t, regexp.MustCompile("(?s)FAIL: 0 out of 1 expectation\\(s\\) were met.*The code you are testing needs to make 1 more call\\(s\\).*"), tcl.errs[0]) + require.Equal(t, 2, len(tcl.logs)) + assert.Regexp(t, regexp.MustCompile("(?s)FAIL:\tGetTime\\(int\\).*"), tcl.logs[0]) + require.Equal(t, "Expectations didn't match for Mock: *mock.timer", tcl.logs[1]) +} + func TestAfterTotalWaitTimeWhileExecution(t *testing.T) { waitDuration := 1 total, waitMs := 5, time.Millisecond*time.Duration(waitDuration) @@ -1342,11 +1436,64 @@ func TestAfterTotalWaitTimeWhileExecution(t *testing.T) { elapsedTime := end.Sub(start) assert.True(t, elapsedTime > waitMs, fmt.Sprintf("Total elapsed time:%v should be atleast greater than %v", elapsedTime, waitMs)) assert.Equal(t, total, len(results)) - for i, _ := range results { + for i := range results { assert.Equal(t, fmt.Sprintf("Time%d", i), results[i], "Return value of method should be same") } } +func TestArgumentMatcherToPrintMismatch(t *testing.T) { + defer func() { + if r := recover(); r != nil { + matchingExp := regexp.MustCompile( + `\s+mock: Unexpected Method Call\s+-*\s+GetTime\(int\)\s+0: 1\s+The closest call I have is:\s+GetTime\(mock.argumentMatcher\)\s+0: mock.argumentMatcher\{.*?\}\s+Diff:.*\(int=1\) not matched by func\(int\) bool`) + assert.Regexp(t, matchingExp, r) + } + }() + + m := new(timer) + m.On("GetTime", MatchedBy(func(i int) bool { return false })).Return("SomeTime").Once() + + res := m.GetTime(1) + require.Equal(t, "SomeTime", res) + m.AssertExpectations(t) +} + +func TestClosestCallMismatchedArgumentInformationShowsTheClosest(t *testing.T) { + defer func() { + if r := recover(); r != nil { + matchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod(int,int,int)`, `0: 1\s+1: 1\s+2: 2`, `0: 1\s+1: 1\s+2: 1`, `0: PASS: \(int=1\) == \(int=1\)\s+1: PASS: \(int=1\) == \(int=1\)\s+2: FAIL: \(int=2\) != \(int=1\)`)) + assert.Regexp(t, matchingExp, r) + } + }() + + m := new(TestExampleImplementation) + m.On("TheExampleMethod", 1, 1, 1).Return(1, nil).Once() + m.On("TheExampleMethod", 2, 2, 2).Return(2, nil).Once() + + m.TheExampleMethod(1, 1, 2) +} + +func TestClosestCallMismatchedArgumentValueInformation(t *testing.T) { + defer func() { + if r := recover(); r != nil { + matchingExp := regexp.MustCompile(unexpectedCallRegex(`GetTime(int)`, "0: 1", "0: 999", `0: FAIL: \(int=1\) != \(int=999\)`)) + assert.Regexp(t, matchingExp, r) + } + }() + + m := new(timer) + m.On("GetTime", 999).Return("SomeTime").Once() + + _ = m.GetTime(1) +} + +func unexpectedCallRegex(method, calledArg, expectedArg, diff string) string { + rMethod := regexp.QuoteMeta(method) + return fmt.Sprintf(`\s+mock: Unexpected Method Call\s+-*\s+%s\s+%s\s+The closest call I have is:\s+%s\s+%s\s+Diff: %s`, + rMethod, calledArg, rMethod, expectedArg, diff) +} + +//go:noinline func ConcurrencyTestMethod(m *Mock) { m.Called() } diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go index a21d02f..535f293 100644 --- a/vendor/github.com/stretchr/testify/require/require.go +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -14,16 +14,24 @@ import ( // Condition uses a Comparison to assert a complex condition. func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { - if !assert.Condition(t, comp, msgAndArgs...) { - t.FailNow() + if assert.Condition(t, comp, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Conditionf uses a Comparison to assert a complex condition. func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) { - if !assert.Conditionf(t, comp, msg, args...) { - t.FailNow() + if assert.Conditionf(t, comp, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Contains asserts that the specified string, list(array, slice...) or map contains the @@ -32,12 +40,14 @@ func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interfac // assert.Contains(t, "Hello World", "World") // assert.Contains(t, ["Hello", "World"], "World") // assert.Contains(t, {"Hello": "World"}, "Hello") -// -// Returns whether the assertion was successful (true) or not (false). func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if !assert.Contains(t, s, contains, msgAndArgs...) { - t.FailNow() + if assert.Contains(t, s, contains, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Containsf asserts that the specified string, list(array, slice...) or map contains the @@ -46,91 +56,111 @@ func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...int // assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") // assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") // assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { - if !assert.Containsf(t, s, contains, msg, args...) { - t.FailNow() + if assert.Containsf(t, s, contains, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { - if !assert.DirExists(t, path, msgAndArgs...) { - t.FailNow() + if assert.DirExists(t, path, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func DirExistsf(t TestingT, path string, msg string, args ...interface{}) { - if !assert.DirExistsf(t, path, msg, args...) { - t.FailNow() + if assert.DirExistsf(t, path, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // ElementsMatch asserts that the specified listA(array, slice...) is equal to specified // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])) -// -// Returns whether the assertion was successful (true) or not (false). +// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { - if !assert.ElementsMatch(t, listA, listB, msgAndArgs...) { - t.FailNow() + if assert.ElementsMatch(t, listA, listB, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")) -// -// Returns whether the assertion was successful (true) or not (false). +// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { - if !assert.ElementsMatchf(t, listA, listB, msg, args...) { - t.FailNow() + if assert.ElementsMatchf(t, listA, listB, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either // a slice or a channel with len == 0. // // assert.Empty(t, obj) -// -// Returns whether the assertion was successful (true) or not (false). func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if !assert.Empty(t, object, msgAndArgs...) { - t.FailNow() + if assert.Empty(t, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either // a slice or a channel with len == 0. // // assert.Emptyf(t, obj, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { - if !assert.Emptyf(t, object, msg, args...) { - t.FailNow() + if assert.Emptyf(t, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Equal asserts that two objects are equal. // // assert.Equal(t, 123, 123) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if !assert.Equal(t, expected, actual, msgAndArgs...) { - t.FailNow() + if assert.Equal(t, expected, actual, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // EqualError asserts that a function returned an error (i.e. not `nil`) @@ -138,12 +168,14 @@ func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...i // // actualObj, err := SomeFunction() // assert.EqualError(t, err, expectedErrorString) -// -// Returns whether the assertion was successful (true) or not (false). func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { - if !assert.EqualError(t, theError, errString, msgAndArgs...) { - t.FailNow() + if assert.EqualError(t, theError, errString, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // EqualErrorf asserts that a function returned an error (i.e. not `nil`) @@ -151,51 +183,59 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte // // actualObj, err := SomeFunction() // assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) { - if !assert.EqualErrorf(t, theError, errString, msg, args...) { - t.FailNow() + if assert.EqualErrorf(t, theError, errString, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // EqualValues asserts that two objects are equal or convertable to the same types // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if !assert.EqualValues(t, expected, actual, msgAndArgs...) { - t.FailNow() + if assert.EqualValues(t, expected, actual, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // EqualValuesf asserts that two objects are equal or convertable to the same types // and equal. // // assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if !assert.EqualValuesf(t, expected, actual, msg, args...) { - t.FailNow() + if assert.EqualValuesf(t, expected, actual, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Equalf asserts that two objects are equal. // // assert.Equalf(t, 123, 123, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if !assert.Equalf(t, expected, actual, msg, args...) { - t.FailNow() + if assert.Equalf(t, expected, actual, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Error asserts that a function returned an error (i.e. not `nil`). @@ -204,12 +244,14 @@ func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ar // if assert.Error(t, err) { // assert.Equal(t, expectedError, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func Error(t TestingT, err error, msgAndArgs ...interface{}) { - if !assert.Error(t, err, msgAndArgs...) { - t.FailNow() + if assert.Error(t, err, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Errorf asserts that a function returned an error (i.e. not `nil`). @@ -218,146 +260,196 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) { // if assert.Errorf(t, err, "error message %s", "formatted") { // assert.Equal(t, expectedErrorf, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func Errorf(t TestingT, err error, msg string, args ...interface{}) { - if !assert.Errorf(t, err, msg, args...) { - t.FailNow() + if assert.Errorf(t, err, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Exactly asserts that two objects are equal in value and type. // // assert.Exactly(t, int32(123), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if !assert.Exactly(t, expected, actual, msgAndArgs...) { - t.FailNow() + if assert.Exactly(t, expected, actual, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Exactlyf asserts that two objects are equal in value and type. // // assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if !assert.Exactlyf(t, expected, actual, msg, args...) { - t.FailNow() + if assert.Exactlyf(t, expected, actual, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Fail reports a failure through func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { - if !assert.Fail(t, failureMessage, msgAndArgs...) { - t.FailNow() + if assert.Fail(t, failureMessage, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // FailNow fails test func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { - if !assert.FailNow(t, failureMessage, msgAndArgs...) { - t.FailNow() + if assert.FailNow(t, failureMessage, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // FailNowf fails test func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { - if !assert.FailNowf(t, failureMessage, msg, args...) { - t.FailNow() + if assert.FailNowf(t, failureMessage, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Failf reports a failure through func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) { - if !assert.Failf(t, failureMessage, msg, args...) { - t.FailNow() + if assert.Failf(t, failureMessage, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // False asserts that the specified value is false. // // assert.False(t, myBool) -// -// Returns whether the assertion was successful (true) or not (false). func False(t TestingT, value bool, msgAndArgs ...interface{}) { - if !assert.False(t, value, msgAndArgs...) { - t.FailNow() + if assert.False(t, value, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Falsef asserts that the specified value is false. // // assert.Falsef(t, myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Falsef(t TestingT, value bool, msg string, args ...interface{}) { - if !assert.Falsef(t, value, msg, args...) { - t.FailNow() + if assert.Falsef(t, value, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func FileExists(t TestingT, path string, msgAndArgs ...interface{}) { - if !assert.FileExists(t, path, msgAndArgs...) { - t.FailNow() + if assert.FileExists(t, path, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func FileExistsf(t TestingT, path string, msg string, args ...interface{}) { - if !assert.FileExistsf(t, path, msg, args...) { - t.FailNow() + if assert.FileExistsf(t, path, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPBodyContains asserts that a specified handler returns a // body that contains a string. // -// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if !assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) { - t.FailNow() + if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPBodyContainsf asserts that a specified handler returns a // body that contains a string. // -// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if !assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) { - t.FailNow() + if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPBodyNotContains asserts that a specified handler returns a // body that does not contain a string. // -// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if !assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) { - t.FailNow() + if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPBodyNotContainsf asserts that a specified handler returns a // body that does not contain a string. // -// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) { - t.FailNow() + if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPError asserts that a specified handler returns an error status code. @@ -366,9 +458,13 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u // // Returns whether the assertion was successful (true) or not (false). func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if !assert.HTTPError(t, handler, method, url, values, msgAndArgs...) { - t.FailNow() + if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPErrorf asserts that a specified handler returns an error status code. @@ -377,9 +473,13 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if !assert.HTTPErrorf(t, handler, method, url, values, msg, args...) { - t.FailNow() + if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPRedirect asserts that a specified handler returns a redirect status code. @@ -388,9 +488,13 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, // // Returns whether the assertion was successful (true) or not (false). func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if !assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) { - t.FailNow() + if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPRedirectf asserts that a specified handler returns a redirect status code. @@ -399,9 +503,13 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url strin // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if !assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) { - t.FailNow() + if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPSuccess asserts that a specified handler returns a success status code. @@ -410,9 +518,13 @@ func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url stri // // Returns whether the assertion was successful (true) or not (false). func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if !assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) { - t.FailNow() + if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // HTTPSuccessf asserts that a specified handler returns a success status code. @@ -421,191 +533,255 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string // // Returns whether the assertion was successful (true) or not (false). func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if !assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) { - t.FailNow() + if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Implements asserts that an object is implemented by the specified interface. // // assert.Implements(t, (*MyInterface)(nil), new(MyObject)) func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { - if !assert.Implements(t, interfaceObject, object, msgAndArgs...) { - t.FailNow() + if assert.Implements(t, interfaceObject, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Implementsf asserts that an object is implemented by the specified interface. // // assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { - if !assert.Implementsf(t, interfaceObject, object, msg, args...) { - t.FailNow() + if assert.Implementsf(t, interfaceObject, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDelta asserts that the two numerals are within delta of each other. // // assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) { - t.FailNow() + if assert.InDelta(t, expected, actual, delta, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if !assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) { - t.FailNow() + if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if !assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) { - t.FailNow() + if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDeltaSlice is the same as InDelta, except it compares two slices. func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { - t.FailNow() + if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDeltaSlicef is the same as InDelta, except it compares two slices. func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) { - t.FailNow() + if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InDeltaf asserts that the two numerals are within delta of each other. // // assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if !assert.InDeltaf(t, expected, actual, delta, msg, args...) { - t.FailNow() + if assert.InDeltaf(t, expected, actual, delta, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { - t.FailNow() + if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if !assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) { - t.FailNow() + if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) { - t.FailNow() + if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // InEpsilonf asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) { - t.FailNow() + if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // IsType asserts that the specified objects are of the same type. func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { - if !assert.IsType(t, expectedType, object, msgAndArgs...) { - t.FailNow() + if assert.IsType(t, expectedType, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // IsTypef asserts that the specified objects are of the same type. func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { - if !assert.IsTypef(t, expectedType, object, msg, args...) { - t.FailNow() + if assert.IsTypef(t, expectedType, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // JSONEq asserts that two JSON strings are equivalent. // // assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { - if !assert.JSONEq(t, expected, actual, msgAndArgs...) { - t.FailNow() + if assert.JSONEq(t, expected, actual, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // JSONEqf asserts that two JSON strings are equivalent. // // assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { - if !assert.JSONEqf(t, expected, actual, msg, args...) { - t.FailNow() + if assert.JSONEqf(t, expected, actual, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Len asserts that the specified object has specific length. // Len also fails if the object has a type that len() not accept. // // assert.Len(t, mySlice, 3) -// -// Returns whether the assertion was successful (true) or not (false). func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { - if !assert.Len(t, object, length, msgAndArgs...) { - t.FailNow() + if assert.Len(t, object, length, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Lenf asserts that the specified object has specific length. // Lenf also fails if the object has a type that len() not accept. // // assert.Lenf(t, mySlice, 3, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) { - if !assert.Lenf(t, object, length, msg, args...) { - t.FailNow() + if assert.Lenf(t, object, length, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Nil asserts that the specified object is nil. // // assert.Nil(t, err) -// -// Returns whether the assertion was successful (true) or not (false). func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if !assert.Nil(t, object, msgAndArgs...) { - t.FailNow() + if assert.Nil(t, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Nilf asserts that the specified object is nil. // // assert.Nilf(t, err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) { - if !assert.Nilf(t, object, msg, args...) { - t.FailNow() + if assert.Nilf(t, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NoError asserts that a function returned no error (i.e. `nil`). @@ -614,12 +790,14 @@ func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) { // if assert.NoError(t, err) { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func NoError(t TestingT, err error, msgAndArgs ...interface{}) { - if !assert.NoError(t, err, msgAndArgs...) { - t.FailNow() + if assert.NoError(t, err, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NoErrorf asserts that a function returned no error (i.e. `nil`). @@ -628,12 +806,14 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) { // if assert.NoErrorf(t, err, "error message %s", "formatted") { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { - if !assert.NoErrorf(t, err, msg, args...) { - t.FailNow() + if assert.NoErrorf(t, err, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -642,12 +822,14 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { // assert.NotContains(t, "Hello World", "Earth") // assert.NotContains(t, ["Hello", "World"], "Earth") // assert.NotContains(t, {"Hello": "World"}, "Earth") -// -// Returns whether the assertion was successful (true) or not (false). func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if !assert.NotContains(t, s, contains, msgAndArgs...) { - t.FailNow() + if assert.NotContains(t, s, contains, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -656,12 +838,14 @@ func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ... // assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") // assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") // assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { - if !assert.NotContainsf(t, s, contains, msg, args...) { - t.FailNow() + if assert.NotContainsf(t, s, contains, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either @@ -670,12 +854,14 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if !assert.NotEmpty(t, object, msgAndArgs...) { - t.FailNow() + if assert.NotEmpty(t, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either @@ -684,296 +870,358 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { - if !assert.NotEmptyf(t, object, msg, args...) { - t.FailNow() + if assert.NotEmptyf(t, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotEqual asserts that the specified values are NOT equal. // // assert.NotEqual(t, obj1, obj2) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if !assert.NotEqual(t, expected, actual, msgAndArgs...) { - t.FailNow() + if assert.NotEqual(t, expected, actual, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotEqualf asserts that the specified values are NOT equal. // // assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if !assert.NotEqualf(t, expected, actual, msg, args...) { - t.FailNow() + if assert.NotEqualf(t, expected, actual, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotNil asserts that the specified object is not nil. // // assert.NotNil(t, err) -// -// Returns whether the assertion was successful (true) or not (false). func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if !assert.NotNil(t, object, msgAndArgs...) { - t.FailNow() + if assert.NotNil(t, object, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotNilf asserts that the specified object is not nil. // // assert.NotNilf(t, err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) { - if !assert.NotNilf(t, object, msg, args...) { - t.FailNow() + if assert.NotNilf(t, object, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. // // assert.NotPanics(t, func(){ RemainCalm() }) -// -// Returns whether the assertion was successful (true) or not (false). func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if !assert.NotPanics(t, f, msgAndArgs...) { - t.FailNow() + if assert.NotPanics(t, f, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. // // assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { - if !assert.NotPanicsf(t, f, msg, args...) { - t.FailNow() + if assert.NotPanicsf(t, f, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotRegexp asserts that a specified regexp does not match a string. // // assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") // assert.NotRegexp(t, "^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if !assert.NotRegexp(t, rx, str, msgAndArgs...) { - t.FailNow() + if assert.NotRegexp(t, rx, str, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotRegexpf asserts that a specified regexp does not match a string. // // assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") // assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { - if !assert.NotRegexpf(t, rx, str, msg, args...) { - t.FailNow() + if assert.NotRegexpf(t, rx, str, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotSubset asserts that the specified list(array, slice...) contains not all // elements given in the specified subset(array, slice...). // // assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if !assert.NotSubset(t, list, subset, msgAndArgs...) { - t.FailNow() + if assert.NotSubset(t, list, subset, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // NotSubsetf asserts that the specified list(array, slice...) contains not all // elements given in the specified subset(array, slice...). // // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { - if !assert.NotSubsetf(t, list, subset, msg, args...) { - t.FailNow() + if assert.NotSubsetf(t, list, subset, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } -// NotZero asserts that i is not the zero value for its type and returns the truth. +// NotZero asserts that i is not the zero value for its type. func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { - if !assert.NotZero(t, i, msgAndArgs...) { - t.FailNow() + if assert.NotZero(t, i, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } -// NotZerof asserts that i is not the zero value for its type and returns the truth. +// NotZerof asserts that i is not the zero value for its type. func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) { - if !assert.NotZerof(t, i, msg, args...) { - t.FailNow() + if assert.NotZerof(t, i, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Panics asserts that the code inside the specified PanicTestFunc panics. // // assert.Panics(t, func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if !assert.Panics(t, f, msgAndArgs...) { - t.FailNow() + if assert.Panics(t, f, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that // the recovered panic value equals the expected panic value. // // assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if !assert.PanicsWithValue(t, expected, f, msgAndArgs...) { - t.FailNow() + if assert.PanicsWithValue(t, expected, f, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that // the recovered panic value equals the expected panic value. // // assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { - if !assert.PanicsWithValuef(t, expected, f, msg, args...) { - t.FailNow() + if assert.PanicsWithValuef(t, expected, f, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Panicsf asserts that the code inside the specified PanicTestFunc panics. // // assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { - if !assert.Panicsf(t, f, msg, args...) { - t.FailNow() + if assert.Panicsf(t, f, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Regexp asserts that a specified regexp matches a string. // // assert.Regexp(t, regexp.MustCompile("start"), "it's starting") // assert.Regexp(t, "start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if !assert.Regexp(t, rx, str, msgAndArgs...) { - t.FailNow() + if assert.Regexp(t, rx, str, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Regexpf asserts that a specified regexp matches a string. // // assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") // assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { - if !assert.Regexpf(t, rx, str, msg, args...) { - t.FailNow() + if assert.Regexpf(t, rx, str, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Subset asserts that the specified list(array, slice...) contains all // elements given in the specified subset(array, slice...). // // assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if !assert.Subset(t, list, subset, msgAndArgs...) { - t.FailNow() + if assert.Subset(t, list, subset, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Subsetf asserts that the specified list(array, slice...) contains all // elements given in the specified subset(array, slice...). // // assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { - if !assert.Subsetf(t, list, subset, msg, args...) { - t.FailNow() + if assert.Subsetf(t, list, subset, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // True asserts that the specified value is true. // // assert.True(t, myBool) -// -// Returns whether the assertion was successful (true) or not (false). func True(t TestingT, value bool, msgAndArgs ...interface{}) { - if !assert.True(t, value, msgAndArgs...) { - t.FailNow() + if assert.True(t, value, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // Truef asserts that the specified value is true. // // assert.Truef(t, myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func Truef(t TestingT, value bool, msg string, args ...interface{}) { - if !assert.Truef(t, value, msg, args...) { - t.FailNow() + if assert.Truef(t, value, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // WithinDuration asserts that the two times are within duration delta of each other. // // assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) -// -// Returns whether the assertion was successful (true) or not (false). func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { - if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { - t.FailNow() + if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } // WithinDurationf asserts that the two times are within duration delta of each other. // // assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { - if !assert.WithinDurationf(t, expected, actual, delta, msg, args...) { - t.FailNow() + if assert.WithinDurationf(t, expected, actual, delta, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } -// Zero asserts that i is the zero value for its type and returns the truth. +// Zero asserts that i is the zero value for its type. func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { - if !assert.Zero(t, i, msgAndArgs...) { - t.FailNow() + if assert.Zero(t, i, msgAndArgs...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } -// Zerof asserts that i is the zero value for its type and returns the truth. +// Zerof asserts that i is the zero value for its type. func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) { - if !assert.Zerof(t, i, msg, args...) { - t.FailNow() + if assert.Zerof(t, i, msg, args...) { + return } + if h, ok := t.(tHelper); ok { + h.Helper() + } + t.FailNow() } diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl index d2c38f6..6ffc751 100644 --- a/vendor/github.com/stretchr/testify/require/require.go.tmpl +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -1,6 +1,6 @@ {{.Comment}} func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { - if !assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { - t.FailNow() - } + if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } + if h, ok := t.(tHelper); ok { h.Helper() } + t.FailNow() } diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go index 7694085..9fe41db 100644 --- a/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -14,11 +14,17 @@ import ( // Condition uses a Comparison to assert a complex condition. func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Condition(a.t, comp, msgAndArgs...) } // Conditionf uses a Comparison to assert a complex condition. func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Conditionf(a.t, comp, msg, args...) } @@ -28,9 +34,10 @@ func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...inte // a.Contains("Hello World", "World") // a.Contains(["Hello", "World"], "World") // a.Contains({"Hello": "World"}, "Hello") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Contains(a.t, s, contains, msgAndArgs...) } @@ -40,19 +47,26 @@ func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs .. // a.Containsf("Hello World", "World", "error message %s", "formatted") // a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") // a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Containsf(a.t, s, contains, msg, args...) } // DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } DirExists(a.t, path, msgAndArgs...) } // DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists. func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } DirExistsf(a.t, path, msg, args...) } @@ -60,10 +74,11 @@ func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) { // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])) -// -// Returns whether the assertion was successful (true) or not (false). +// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } ElementsMatch(a.t, listA, listB, msgAndArgs...) } @@ -71,10 +86,11 @@ func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndA // listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, // the number of appearances of each of them in both lists should match. // -// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")) -// -// Returns whether the assertion was successful (true) or not (false). +// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } ElementsMatchf(a.t, listA, listB, msg, args...) } @@ -82,9 +98,10 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st // a slice or a channel with len == 0. // // a.Empty(obj) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Empty(a.t, object, msgAndArgs...) } @@ -92,9 +109,10 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { // a slice or a channel with len == 0. // // a.Emptyf(obj, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Emptyf(a.t, object, msg, args...) } @@ -102,12 +120,13 @@ func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) // // a.Equal(123, 123) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Equal(a.t, expected, actual, msgAndArgs...) } @@ -116,9 +135,10 @@ func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs // // actualObj, err := SomeFunction() // a.EqualError(err, expectedErrorString) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } EqualError(a.t, theError, errString, msgAndArgs...) } @@ -127,9 +147,10 @@ func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ... // // actualObj, err := SomeFunction() // a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } EqualErrorf(a.t, theError, errString, msg, args...) } @@ -137,9 +158,10 @@ func (a *Assertions) EqualErrorf(theError error, errString string, msg string, a // and equal. // // a.EqualValues(uint32(123), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } EqualValues(a.t, expected, actual, msgAndArgs...) } @@ -147,9 +169,10 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn // and equal. // // a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } EqualValuesf(a.t, expected, actual, msg, args...) } @@ -157,12 +180,13 @@ func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg // // a.Equalf(123, 123, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). Function equality // cannot be determined and will always fail. func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Equalf(a.t, expected, actual, msg, args...) } @@ -172,9 +196,10 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // if a.Error(err) { // assert.Equal(t, expectedError, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Error(a.t, err, msgAndArgs...) } @@ -184,115 +209,150 @@ func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { // if a.Errorf(err, "error message %s", "formatted") { // assert.Equal(t, expectedErrorf, err) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Errorf(a.t, err, msg, args...) } // Exactly asserts that two objects are equal in value and type. // // a.Exactly(int32(123), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Exactly(a.t, expected, actual, msgAndArgs...) } // Exactlyf asserts that two objects are equal in value and type. // // a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123)) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Exactlyf(a.t, expected, actual, msg, args...) } // Fail reports a failure through func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Fail(a.t, failureMessage, msgAndArgs...) } // FailNow fails test func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } FailNow(a.t, failureMessage, msgAndArgs...) } // FailNowf fails test func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } FailNowf(a.t, failureMessage, msg, args...) } // Failf reports a failure through func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Failf(a.t, failureMessage, msg, args...) } // False asserts that the specified value is false. // // a.False(myBool) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } False(a.t, value, msgAndArgs...) } // Falsef asserts that the specified value is false. // // a.Falsef(myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Falsef(a.t, value, msg, args...) } // FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } FileExists(a.t, path, msgAndArgs...) } // FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file. func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } FileExistsf(a.t, path, msg, args...) } // HTTPBodyContains asserts that a specified handler returns a // body that contains a string. // -// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) } // HTTPBodyContainsf asserts that a specified handler returns a // body that contains a string. // -// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) } // HTTPBodyNotContains asserts that a specified handler returns a // body that does not contain a string. // -// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) } // HTTPBodyNotContainsf asserts that a specified handler returns a // body that does not contain a string. // -// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) } @@ -302,6 +362,9 @@ func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method strin // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPError(a.t, handler, method, url, values, msgAndArgs...) } @@ -311,6 +374,9 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPErrorf(a.t, handler, method, url, values, msg, args...) } @@ -320,6 +386,9 @@ func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url str // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) } @@ -329,6 +398,9 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s // // Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false). func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPRedirectf(a.t, handler, method, url, values, msg, args...) } @@ -338,6 +410,9 @@ func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) } @@ -347,6 +422,9 @@ func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url st // // Returns whether the assertion was successful (true) or not (false). func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } HTTPSuccessf(a.t, handler, method, url, values, msg, args...) } @@ -354,6 +432,9 @@ func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url s // // a.Implements((*MyInterface)(nil), new(MyObject)) func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Implements(a.t, interfaceObject, object, msgAndArgs...) } @@ -361,96 +442,129 @@ func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, // // a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject)) func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Implementsf(a.t, interfaceObject, object, msg, args...) } // InDelta asserts that the two numerals are within delta of each other. // // a.InDelta(math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDelta(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) } // InDeltaSlice is the same as InDelta, except it compares two slices. func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) } // InDeltaSlicef is the same as InDelta, except it compares two slices. func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDeltaSlicef(a.t, expected, actual, delta, msg, args...) } // InDeltaf asserts that the two numerals are within delta of each other. // // a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InDeltaf(a.t, expected, actual, delta, msg, args...) } // InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) } // InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) } // InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) } // InEpsilonf asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } InEpsilonf(a.t, expected, actual, epsilon, msg, args...) } // IsType asserts that the specified objects are of the same type. func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } IsType(a.t, expectedType, object, msgAndArgs...) } // IsTypef asserts that the specified objects are of the same type. func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } IsTypef(a.t, expectedType, object, msg, args...) } // JSONEq asserts that two JSON strings are equivalent. // // a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } JSONEq(a.t, expected, actual, msgAndArgs...) } // JSONEqf asserts that two JSON strings are equivalent. // // a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } JSONEqf(a.t, expected, actual, msg, args...) } @@ -458,9 +572,10 @@ func (a *Assertions) JSONEqf(expected string, actual string, msg string, args .. // Len also fails if the object has a type that len() not accept. // // a.Len(mySlice, 3) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Len(a.t, object, length, msgAndArgs...) } @@ -468,27 +583,30 @@ func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface // Lenf also fails if the object has a type that len() not accept. // // a.Lenf(mySlice, 3, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Lenf(a.t, object, length, msg, args...) } // Nil asserts that the specified object is nil. // // a.Nil(err) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Nil(a.t, object, msgAndArgs...) } // Nilf asserts that the specified object is nil. // // a.Nilf(err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Nilf(a.t, object, msg, args...) } @@ -498,9 +616,10 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { // if a.NoError(err) { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NoError(a.t, err, msgAndArgs...) } @@ -510,9 +629,10 @@ func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { // if a.NoErrorf(err, "error message %s", "formatted") { // assert.Equal(t, expectedObj, actualObj) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NoErrorf(a.t, err, msg, args...) } @@ -522,9 +642,10 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { // a.NotContains("Hello World", "Earth") // a.NotContains(["Hello", "World"], "Earth") // a.NotContains({"Hello": "World"}, "Earth") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotContains(a.t, s, contains, msgAndArgs...) } @@ -534,9 +655,10 @@ func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs // a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") // a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") // a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotContainsf(a.t, s, contains, msg, args...) } @@ -546,9 +668,10 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotEmpty(a.t, object, msgAndArgs...) } @@ -558,9 +681,10 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) // } -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotEmptyf(a.t, object, msg, args...) } @@ -568,11 +692,12 @@ func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface // // a.NotEqual(obj1, obj2) // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotEqual(a.t, expected, actual, msgAndArgs...) } @@ -580,47 +705,52 @@ func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndAr // // a.NotEqualf(obj1, obj2, "error message %s", "formatted") // -// Returns whether the assertion was successful (true) or not (false). -// // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotEqualf(a.t, expected, actual, msg, args...) } // NotNil asserts that the specified object is not nil. // // a.NotNil(err) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotNil(a.t, object, msgAndArgs...) } // NotNilf asserts that the specified object is not nil. // // a.NotNilf(err, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotNilf(a.t, object, msg, args...) } // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. // // a.NotPanics(func(){ RemainCalm() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotPanics(a.t, f, msgAndArgs...) } // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. // // a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotPanicsf(a.t, f, msg, args...) } @@ -628,9 +758,10 @@ func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...inte // // a.NotRegexp(regexp.MustCompile("starts"), "it's starting") // a.NotRegexp("^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotRegexp(a.t, rx, str, msgAndArgs...) } @@ -638,9 +769,10 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in // // a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting") // a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotRegexpf(a.t, rx, str, msg, args...) } @@ -648,9 +780,10 @@ func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, arg // elements given in the specified subset(array, slice...). // // a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotSubset(a.t, list, subset, msgAndArgs...) } @@ -658,28 +791,36 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs // elements given in the specified subset(array, slice...). // // a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotSubsetf(a.t, list, subset, msg, args...) } -// NotZero asserts that i is not the zero value for its type and returns the truth. +// NotZero asserts that i is not the zero value for its type. func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotZero(a.t, i, msgAndArgs...) } -// NotZerof asserts that i is not the zero value for its type and returns the truth. +// NotZerof asserts that i is not the zero value for its type. func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } NotZerof(a.t, i, msg, args...) } // Panics asserts that the code inside the specified PanicTestFunc panics. // // a.Panics(func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Panics(a.t, f, msgAndArgs...) } @@ -687,9 +828,10 @@ func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { // the recovered panic value equals the expected panic value. // // a.PanicsWithValue("crazy error", func(){ GoCrazy() }) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } PanicsWithValue(a.t, expected, f, msgAndArgs...) } @@ -697,18 +839,20 @@ func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFun // the recovered panic value equals the expected panic value. // // a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } PanicsWithValuef(a.t, expected, f, msg, args...) } // Panicsf asserts that the code inside the specified PanicTestFunc panics. // // a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Panicsf(a.t, f, msg, args...) } @@ -716,9 +860,10 @@ func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interfa // // a.Regexp(regexp.MustCompile("start"), "it's starting") // a.Regexp("start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Regexp(a.t, rx, str, msgAndArgs...) } @@ -726,9 +871,10 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter // // a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting") // a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Regexpf(a.t, rx, str, msg, args...) } @@ -736,9 +882,10 @@ func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args . // elements given in the specified subset(array, slice...). // // a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Subset(a.t, list, subset, msgAndArgs...) } @@ -746,54 +893,65 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... // elements given in the specified subset(array, slice...). // // a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Subsetf(a.t, list, subset, msg, args...) } // True asserts that the specified value is true. // // a.True(myBool) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } True(a.t, value, msgAndArgs...) } // Truef asserts that the specified value is true. // // a.Truef(myBool, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) Truef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Truef(a.t, value, msg, args...) } // WithinDuration asserts that the two times are within duration delta of each other. // // a.WithinDuration(time.Now(), time.Now(), 10*time.Second) -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } WithinDuration(a.t, expected, actual, delta, msgAndArgs...) } // WithinDurationf asserts that the two times are within duration delta of each other. // // a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } WithinDurationf(a.t, expected, actual, delta, msg, args...) } -// Zero asserts that i is the zero value for its type and returns the truth. +// Zero asserts that i is the zero value for its type. func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Zero(a.t, i, msgAndArgs...) } -// Zerof asserts that i is the zero value for its type and returns the truth. +// Zerof asserts that i is the zero value for its type. func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } Zerof(a.t, i, msg, args...) } diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl index b93569e..54124df 100644 --- a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl +++ b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl @@ -1,4 +1,5 @@ {{.CommentWithoutT "a"}} func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { + if h, ok := a.t.(tHelper); ok { h.Helper() } {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) } diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go index e404f01..6b85c5e 100644 --- a/vendor/github.com/stretchr/testify/require/requirements.go +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -6,4 +6,24 @@ type TestingT interface { FailNow() } +type tHelper interface { + Helper() +} + +// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful +// for table driven tests. +type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) + +// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful +// for table driven tests. +type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) + +// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful +// for table driven tests. +type BoolAssertionFunc func(TestingT, bool, ...interface{}) + +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful +// for table driven tests. +type ErrorAssertionFunc func(TestingT, error, ...interface{}) + //go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs diff --git a/vendor/github.com/stretchr/testify/require/requirements_test.go b/vendor/github.com/stretchr/testify/require/requirements_test.go index d2ccc99..39467d9 100644 --- a/vendor/github.com/stretchr/testify/require/requirements_test.go +++ b/vendor/github.com/stretchr/testify/require/requirements_test.go @@ -1,6 +1,7 @@ package require import ( + "encoding/json" "errors" "testing" "time" @@ -367,3 +368,199 @@ func TestJSONEq_ArraysOfDifferentOrder(t *testing.T) { t.Error("Check should fail") } } + +func ExampleComparisonAssertionFunc() { + t := &testing.T{} // provided by test + + adder := func(x, y int) int { + return x + y + } + + type args struct { + x int + y int + } + + tests := []struct { + name string + args args + expect int + assertion ComparisonAssertionFunc + }{ + {"2+2=4", args{2, 2}, 4, Equal}, + {"2+2!=5", args{2, 2}, 5, NotEqual}, + {"2+3==5", args{2, 3}, 5, Exactly}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.expect, adder(tt.args.x, tt.args.y)) + }) + } +} + +func TestComparisonAssertionFunc(t *testing.T) { + type iface interface { + Name() string + } + + tests := []struct { + name string + expect interface{} + got interface{} + assertion ComparisonAssertionFunc + }{ + {"implements", (*iface)(nil), t, Implements}, + {"isType", (*testing.T)(nil), t, IsType}, + {"equal", t, t, Equal}, + {"equalValues", t, t, EqualValues}, + {"exactly", t, t, Exactly}, + {"notEqual", t, nil, NotEqual}, + {"notContains", []int{1, 2, 3}, 4, NotContains}, + {"subset", []int{1, 2, 3, 4}, []int{2, 3}, Subset}, + {"notSubset", []int{1, 2, 3, 4}, []int{0, 3}, NotSubset}, + {"elementsMatch", []byte("abc"), []byte("bac"), ElementsMatch}, + {"regexp", "^t.*y$", "testify", Regexp}, + {"notRegexp", "^t.*y$", "Testify", NotRegexp}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.expect, tt.got) + }) + } +} + +func ExampleValueAssertionFunc() { + t := &testing.T{} // provided by test + + dumbParse := func(input string) interface{} { + var x interface{} + json.Unmarshal([]byte(input), &x) + return x + } + + tests := []struct { + name string + arg string + assertion ValueAssertionFunc + }{ + {"true is not nil", "true", NotNil}, + {"empty string is nil", "", Nil}, + {"zero is not nil", "0", NotNil}, + {"zero is zero", "0", Zero}, + {"false is zero", "false", Zero}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, dumbParse(tt.arg)) + }) + } +} + +func TestValueAssertionFunc(t *testing.T) { + tests := []struct { + name string + value interface{} + assertion ValueAssertionFunc + }{ + {"notNil", true, NotNil}, + {"nil", nil, Nil}, + {"empty", []int{}, Empty}, + {"notEmpty", []int{1}, NotEmpty}, + {"zero", false, Zero}, + {"notZero", 42, NotZero}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.value) + }) + } +} + +func ExampleBoolAssertionFunc() { + t := &testing.T{} // provided by test + + isOkay := func(x int) bool { + return x >= 42 + } + + tests := []struct { + name string + arg int + assertion BoolAssertionFunc + }{ + {"-1 is bad", -1, False}, + {"42 is good", 42, True}, + {"41 is bad", 41, False}, + {"45 is cool", 45, True}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, isOkay(tt.arg)) + }) + } +} + +func TestBoolAssertionFunc(t *testing.T) { + tests := []struct { + name string + value bool + assertion BoolAssertionFunc + }{ + {"true", true, True}, + {"false", false, False}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.value) + }) + } +} + +func ExampleErrorAssertionFunc() { + t := &testing.T{} // provided by test + + dumbParseNum := func(input string, v interface{}) error { + return json.Unmarshal([]byte(input), v) + } + + tests := []struct { + name string + arg string + assertion ErrorAssertionFunc + }{ + {"1.2 is number", "1.2", NoError}, + {"1.2.3 not number", "1.2.3", Error}, + {"true is not number", "true", Error}, + {"3 is number", "3", NoError}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var x float64 + tt.assertion(t, dumbParseNum(tt.arg, &x)) + }) + } +} + +func TestErrorAssertionFunc(t *testing.T) { + tests := []struct { + name string + err error + assertion ErrorAssertionFunc + }{ + {"noError", nil, NoError}, + {"error", errors.New("whoops"), Error}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.assertion(t, tt.err) + }) + } +} diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go index e20afbc..5cea8f8 100644 --- a/vendor/github.com/stretchr/testify/suite/suite.go +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -55,10 +55,32 @@ func (suite *Suite) Assert() *assert.Assertions { return suite.Assertions } +func failOnPanic(t *testing.T) { + r := recover() + if r != nil { + t.Errorf("test panicked: %v", r) + t.FailNow() + } +} + +// Run provides suite functionality around golang subtests. It should be +// called in place of t.Run(name, func(t *testing.T)) in test suite code. +// The passed-in func will be executed as a subtest with a fresh instance of t. +// Provides compatibility with go test pkg -run TestSuite/TestName/SubTestName. +func (suite *Suite) Run(name string, subtest func()) bool { + oldT := suite.T() + defer suite.SetT(oldT) + return oldT.Run(name, func(t *testing.T) { + suite.SetT(t) + subtest() + }) +} + // Run takes a testing suite and runs all of the tests attached // to it. func Run(t *testing.T, suite TestingSuite) { suite.SetT(t) + defer failOnPanic(t) if setupAllSuite, ok := suite.(SetupAllSuite); ok { setupAllSuite.SetupSuite() @@ -84,6 +106,8 @@ func Run(t *testing.T, suite TestingSuite) { F: func(t *testing.T) { parentT := suite.T() suite.SetT(t) + defer failOnPanic(t) + if setupTestSuite, ok := suite.(SetupTestSuite); ok { setupTestSuite.SetupTest() } diff --git a/vendor/github.com/stretchr/testify/suite/suite_test.go b/vendor/github.com/stretchr/testify/suite/suite_test.go index b75fa4a..6dfba08 100644 --- a/vendor/github.com/stretchr/testify/suite/suite_test.go +++ b/vendor/github.com/stretchr/testify/suite/suite_test.go @@ -42,6 +42,99 @@ func (s *SuiteRequireTwice) TestRequireTwo() { r.Equal(1, 2) } +type panickingSuite struct { + Suite + panicInSetupSuite bool + panicInSetupTest bool + panicInBeforeTest bool + panicInTest bool + panicInAfterTest bool + panicInTearDownTest bool + panicInTearDownSuite bool +} + +func (s *panickingSuite) SetupSuite() { + if s.panicInSetupSuite { + panic("oops in setup suite") + } +} + +func (s *panickingSuite) SetupTest() { + if s.panicInSetupTest { + panic("oops in setup test") + } +} + +func (s *panickingSuite) BeforeTest(_, _ string) { + if s.panicInBeforeTest { + panic("oops in before test") + } +} + +func (s *panickingSuite) Test() { + if s.panicInTest { + panic("oops in test") + } +} + +func (s *panickingSuite) AfterTest(_, _ string) { + if s.panicInAfterTest { + panic("oops in after test") + } +} + +func (s *panickingSuite) TearDownTest() { + if s.panicInTearDownTest { + panic("oops in tear down test") + } +} + +func (s *panickingSuite) TearDownSuite() { + if s.panicInTearDownSuite { + panic("oops in tear down suite") + } +} + +func TestSuiteRecoverPanic(t *testing.T) { + ok := true + panickingTests := []testing.InternalTest{ + { + Name: "TestPanicInSetupSuite", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupSuite: true}) }, + }, + { + Name: "TestPanicInSetupTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInSetupTest: true}) }, + }, + { + Name: "TestPanicInBeforeTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInBeforeTest: true}) }, + }, + { + Name: "TestPanicInTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTest: true}) }, + }, + { + Name: "TestPanicInAfterTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInAfterTest: true}) }, + }, + { + Name: "TestPanicInTearDownTest", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownTest: true}) }, + }, + { + Name: "TestPanicInTearDownSuite", + F: func(t *testing.T) { Run(t, &panickingSuite{panicInTearDownSuite: true}) }, + }, + } + + require.NotPanics(t, func() { + ok = testing.RunTests(allTestsFilter, panickingTests) + }) + + assert.False(t, ok) +} + // This suite is intended to store values to make sure that only // testing-suite-related methods are run. It's also a fully // functional example of a testing suite, using setup/teardown methods @@ -59,6 +152,7 @@ type SuiteTester struct { TearDownTestRunCount int TestOneRunCount int TestTwoRunCount int + TestSubtestRunCount int NonTestMethodRunCount int SuiteNameBefore []string @@ -153,6 +247,27 @@ func (suite *SuiteTester) NonTestMethod() { suite.NonTestMethodRunCount++ } +func (suite *SuiteTester) TestSubtest() { + suite.TestSubtestRunCount++ + + for _, t := range []struct { + testName string + }{ + {"first"}, + {"second"}, + } { + suiteT := suite.T() + suite.Run(t.testName, func() { + // We should get a different *testing.T for subtests, so that + // go test recognizes them as proper subtests for output formatting + // and running individual subtests + subTestT := suite.T() + suite.NotEqual(subTestT, suiteT) + }) + suite.Equal(suiteT, suite.T()) + } +} + // TestRunSuite will be run by the 'go test' command, so within it, we // can run our suite using the Run(*testing.T, TestingSuite) function. func TestRunSuite(t *testing.T) { @@ -168,18 +283,20 @@ func TestRunSuite(t *testing.T) { assert.Equal(t, suiteTester.SetupSuiteRunCount, 1) assert.Equal(t, suiteTester.TearDownSuiteRunCount, 1) - assert.Equal(t, len(suiteTester.SuiteNameAfter), 3) - assert.Equal(t, len(suiteTester.SuiteNameBefore), 3) - assert.Equal(t, len(suiteTester.TestNameAfter), 3) - assert.Equal(t, len(suiteTester.TestNameBefore), 3) + assert.Equal(t, len(suiteTester.SuiteNameAfter), 4) + assert.Equal(t, len(suiteTester.SuiteNameBefore), 4) + assert.Equal(t, len(suiteTester.TestNameAfter), 4) + assert.Equal(t, len(suiteTester.TestNameBefore), 4) assert.Contains(t, suiteTester.TestNameAfter, "TestOne") assert.Contains(t, suiteTester.TestNameAfter, "TestTwo") assert.Contains(t, suiteTester.TestNameAfter, "TestSkip") + assert.Contains(t, suiteTester.TestNameAfter, "TestSubtest") assert.Contains(t, suiteTester.TestNameBefore, "TestOne") assert.Contains(t, suiteTester.TestNameBefore, "TestTwo") assert.Contains(t, suiteTester.TestNameBefore, "TestSkip") + assert.Contains(t, suiteTester.TestNameBefore, "TestSubtest") for _, suiteName := range suiteTester.SuiteNameAfter { assert.Equal(t, "SuiteTester", suiteName) @@ -197,15 +314,16 @@ func TestRunSuite(t *testing.T) { assert.False(t, when.IsZero()) } - // There are three test methods (TestOne, TestTwo, and TestSkip), so + // There are four test methods (TestOne, TestTwo, TestSkip, and TestSubtest), so // the SetupTest and TearDownTest methods (which should be run once for - // each test) should have been run three times. - assert.Equal(t, suiteTester.SetupTestRunCount, 3) - assert.Equal(t, suiteTester.TearDownTestRunCount, 3) + // each test) should have been run four times. + assert.Equal(t, suiteTester.SetupTestRunCount, 4) + assert.Equal(t, suiteTester.TearDownTestRunCount, 4) // Each test should have been run once. assert.Equal(t, suiteTester.TestOneRunCount, 1) assert.Equal(t, suiteTester.TestTwoRunCount, 1) + assert.Equal(t, suiteTester.TestSubtestRunCount, 1) // Methods that don't match the test method identifier shouldn't // have been run at all. diff --git a/zk.go b/zk.go index dd711e0..4bc9ede 100644 --- a/zk.go +++ b/zk.go @@ -24,14 +24,14 @@ import ( "github.com/samuel/go-zookeeper/zk" ) -type Endpoint struct { +type endpoint struct { Host string `json:"host"` Port int `json:"port"` } -type ServiceInstance struct { - Service Endpoint `json:"serviceEndpoint"` - AdditionalEndpoints map[string]Endpoint `json:"additionalEndpoints"` +type serviceInstance struct { + Service endpoint `json:"serviceEndpoint"` + AdditionalEndpoints map[string]endpoint `json:"additionalEndpoints"` Status string `json:"status"` } @@ -40,47 +40,54 @@ type zkConfig struct { path string backoff Backoff timeout time.Duration - logger Logger + logger logger } +// ZKOpt - Configuration option for the Zookeeper client used. type ZKOpt func(z *zkConfig) +// ZKEndpoints - Endpoints on which a Zookeeper instance is running to be used by the client. func ZKEndpoints(endpoints ...string) ZKOpt { return func(z *zkConfig) { z.endpoints = endpoints } } +// ZKPath - Path to look for information in when connected to Zookeeper. func ZKPath(path string) ZKOpt { return func(z *zkConfig) { z.path = path } } +// ZKBackoff - Configuration for Retry mechanism used when connecting to Zookeeper. +// TODO(rdelvalle): Determine if this is really necessary as the ZK library already has a retry built in. func ZKBackoff(b Backoff) ZKOpt { return func(z *zkConfig) { z.backoff = b } } +// ZKTimeout - How long to wait on a response from the Zookeeper instance before considering it dead. func ZKTimeout(d time.Duration) ZKOpt { return func(z *zkConfig) { z.timeout = d } } -func ZKLogger(l Logger) ZKOpt { +// ZKLogger - Attach a logger to the Zookeeper client in order to debug issues. +func ZKLogger(l logger) ZKOpt { return func(z *zkConfig) { z.logger = l } } -// Retrieves current Aurora leader from ZK. +// LeaderFromZK - Retrieves current Aurora leader from ZK. func LeaderFromZK(cluster Cluster) (string, error) { return LeaderFromZKOpts(ZKEndpoints(strings.Split(cluster.ZK, ",")...), ZKPath(cluster.SchedZKPath)) } -// Retrieves current Aurora leader from ZK with a custom configuration. +// LeaderFromZKOpts - Retrieves current Aurora leader from ZK with a custom configuration. func LeaderFromZKOpts(options ...ZKOpt) (string, error) { var leaderURL string @@ -103,7 +110,7 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { c, _, err := zk.Connect(config.endpoints, config.timeout, func(c *zk.Conn) { c.SetLogger(config.logger) }) if err != nil { - return false, NewTemporaryError(errors.Wrap(err, "Failed to connect to Zookeeper")) + return false, NewTemporaryError(errors.Wrap(err, "failed to connect to Zookeeper")) } defer c.Close() @@ -117,11 +124,10 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { return false, errors.Wrapf(err, "path %s is an invalid Zookeeper path", config.path) } - return false, NewTemporaryError(errors.Wrapf(err, "Path %s doesn't exist on Zookeeper ", config.path)) + return false, NewTemporaryError(errors.Wrapf(err, "path %s doesn't exist on Zookeeper ", config.path)) } // Search for the leader through all the children in the given path - serviceInst := new(ServiceInstance) for _, child := range children { // Only the leader will start with member_ @@ -134,19 +140,21 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { return false, errors.Wrapf(err, "path %s is an invalid Zookeeper path", childPath) } - return false, NewTemporaryError(errors.Wrap(err, "Error fetching contents of leader")) + return false, NewTemporaryError(errors.Wrap(err, "unable to fetch contents of leader")) } - err = json.Unmarshal([]byte(data), serviceInst) + var serviceInst serviceInstance + err = json.Unmarshal([]byte(data), &serviceInst) if err != nil { - return false, NewTemporaryError(errors.Wrap(err, "Unable to unmarshall contents of leader")) + return false, NewTemporaryError(errors.Wrap(err, "unable to unmarshal contents of leader")) } // Should only be one endpoint. // This should never be encountered as it would indicate Aurora // writing bad info into Zookeeper but is kept here as a safety net. if len(serviceInst.AdditionalEndpoints) > 1 { - return false, NewTemporaryError(errors.New("ambiguous endpoints in json blob, Aurora wrote bad info to ZK")) + return false, + NewTemporaryError(errors.New("ambiguous endpoints in json blob, Aurora wrote bad info to ZK")) } var scheme, host, port string @@ -162,11 +170,11 @@ func LeaderFromZKOpts(options ...ZKOpt) (string, error) { } // Leader data might not be available yet, try to fetch again. - return false, NewTemporaryError(errors.New("No leader found")) + return false, NewTemporaryError(errors.New("no leader found")) }) if retryErr != nil { - config.logger.Printf("Failed to determine leader after %v attempts", config.backoff.Steps) + config.logger.Printf("failed to determine leader after %v attempts", config.backoff.Steps) return "", retryErr } diff --git a/zk_test.go b/zk_test.go index c23ff75..b4e5d22 100644 --- a/zk_test.go +++ b/zk_test.go @@ -24,11 +24,12 @@ import ( "github.com/stretchr/testify/assert" ) -var backoff realis.Backoff = realis.Backoff{ // Reduce penalties for this test to make it quick +var backoff = realis.Backoff{ // Reduce penalties for this test to make it quick Steps: 5, Duration: 1 * time.Second, Factor: 1.0, - Jitter: 0.1} + Jitter: 0.1, +} // Test for behavior when no endpoints are given to the ZK leader finding function. func TestZKNoEndpoints(t *testing.T) {