commit 327c6c369d0e8da74caa0457c348d39d73e19e7c Author: Renan DelValle Date: Tue Aug 2 11:42:00 2016 -0700 Public release of gorealis diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c8f3ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6057035 --- /dev/null +++ b/README.md @@ -0,0 +1,133 @@ +# GoRealis + +Go library for communicating with Apache Aurora. +Named after the northern lights (Aurora Borealis). + +## Usage + +### Using the Sample client with Thermos +Clone Aurora: +``` +$ git clone git://git.apache.org/aurora.git +``` + +Bring up the vagrant image: +``` +$ cd aurora +$ vagrant up +``` + +Download and run the Client to create a Thermos Job: +``` +$ go get github.com/rdelval/gorealis +$ go run $GOPATH/src/github.com/rdelval/gorealis/examples/Client.go -executor=thermos -url=http://192.168.33.7:8081 -cmd=create +``` + +### Using the Sample client with Docker Compose executor + +Clone modified version of Aurora repo and checkout the right branch: +``` +$ git clone git@github.com:rdelval/aurora.git +$ git checkout DockerComposeExecutor +``` + +Bring up the vagrant image: +``` +$ cd aurora +$ vagrant up +``` + +Download and run the Client to create a Docker-Compose Job: +``` +$ go get github.com/rdelval/gorealis +$ go run $GOPATH/src/github.com/rdelval/gorealis/examples/Client.go -executor=compose -url=http://192.168.33.7:8081 -cmd=create +``` +From the [Aurora web UI](http://192.168.33.7:8081/scheduler/vagrant/prod/docker-compose/0), create struct dump by clicking on the task ID. +In the struct dump, find the port assigned to the task (named "port0"). + +Navigate to the 192.168.33.7:``. Currently the redis image being deployed is broken, so an error is expected. +If the page is not found, wait a few minutes while the docker image is downloaded and the container is deployed. + +Finally, terminate the job: +``` +$ go run $GOPATH/src/github.com/rdelval/gorealis.git/examples/Client.go -executor=compose -url=http://192.168.33.7:8081 -cmd=kill +``` + +### Leveraging the library +Commands available: create, kill, restart + +Create a default configuration file (alternatively, manually create your own Config): +``` +config, err := realis.NewDefaultConfig(*url) +``` + +Create a new Realis struct by passing the configuration struct in: +``` +r := realis.NewClient(config) +defer r.Close() +``` + +Construct a job using an AuroraJob struct. +``` +job = realis.NewJob().SetEnvironment("prod"). + SetRole("vagrant"). + SetName("hello_world_from_gorealis"). + SetExecutorName("docker-compose-executor"). + SetExecutorData("{}"). + SetNumCpus(1). + SetRam(64). + SetDisk(100). + SetIsService(false). + SetInstanceCount(1). + AddPorts(1). + AddLabel("fileName", "sample-app/sample-app.yml"). + AddURI("https://dl.bintray.com/rdelvalle/mesos-compose-executor/sample-app.tar.gz", true, true) + +``` + +Use client to send a job to Aurora: +``` +r.CreateJob(job) +``` + +Killing an Aurora Job: +``` +r.KillJob(job.GetKey()) +``` + +Restarting all instances of an Aurora Job: +``` +r.RestartJob(job.GetKey()) +``` + +Adding instances (based on config of instance 0) to Aurora: +``` +r.AddInstances(job.GetKey(), 5) +``` + +Updating the job configuration of a service job: +``` +updateJob := realis.NewUpdateJob(job) +updateJob.SetInstanceCount(1) +updateJob.SetRam(128) + +msg, err := r.UpdateJob(updateJob, "") +``` + +### Methods: + +|Method | Arguments | Description| +|----------|------------|------------| +|CreateJob | `*Job` | Sends a job create request to Apache Aurora | +|KillJob | `*aurora.JobKey` | Attempts to kill all active instances running in Aurora. Only needs environment, role, name | +|RestartJob| `*aurora.JobKey` | Attempts to restart all active instances running in Aurora | +|AddInstances|`*aurora.JobKey`, `int32`| Launches the specified number of new instances based on existing job config | +|StartUpdateJob|`*UpdateJob`, `string`| Updates a service job with a new configuration | +|AbortUpdateJob|`*aurora.Jobkey`, `string`, `string`| Abort the job update that matches the ID | + +## To Do +* Create or import a custom transport that uses https://github.com/jmcvetta/napping to improve efficiency +* Allow library to use ZK to find the master + +## Contributions +Contributions are very much welcome. Please raise an issue so that the contribution may be discussed before it's made. diff --git a/auroraAPI.thrift b/auroraAPI.thrift new file mode 100644 index 0000000..8310415 --- /dev/null +++ b/auroraAPI.thrift @@ -0,0 +1,1204 @@ +/* + * 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. + */ + +namespace java org.apache.aurora.gen +namespace py gen.apache.aurora.api +namespace go gen.apache.aurora + +// Thrift interface definition for the aurora scheduler. + +/* + * TODO(wfarner): It would be nice if we could put some HTML tags here, regex doesn't handle it though. + * The result of an API operation. A result may only be specified when this is OK. + */ +enum ResponseCode { + INVALID_REQUEST = 0, + OK = 1, + ERROR = 2, + WARNING = 3, + AUTH_FAILED = 4, + /** Raised when a Lock-protected operation failed due to lock validation. */ + LOCK_ERROR = 5, + /** Raised when a scheduler is transiently unavailable and later retry is recommended. */ + ERROR_TRANSIENT = 6 +} + +// Aurora executor framework name. +const string AURORA_EXECUTOR_NAME = 'AuroraExecutor' + +// TODO(maxim): Remove in 0.7.0. (AURORA-749) +struct Identity { + 2: string user +} + +/** A single host attribute. */ +struct Attribute { + 1: string name + 2: set values +} + +enum MaintenanceMode { + NONE = 1, + SCHEDULED = 2, + DRAINING = 3, + DRAINED = 4 +} + +/** The attributes assigned to a host. */ +struct HostAttributes { + 1: string host + 2: set attributes + 3: optional MaintenanceMode mode + 4: optional string slaveId +} + +/** + * A constraint that specifies an explicit set of values, at least one of which must be present + * on a host for a task to be scheduled there. + */ +struct ValueConstraint { + /** If true, treat this as a 'not' - to avoid specific values. */ + 1: bool negated + 2: set values +} + +/** + * A constraint the specifies the maximum number of active tasks on a host with a matching + * attribute that may be scheduled simultaneously. + */ +struct LimitConstraint { + 1: i32 limit +} + +/** Types of constraints that may be applied to a task. */ +union TaskConstraint { + 1: ValueConstraint value + 2: LimitConstraint limit +} + +/** A constraint that defines whether a task may be scheduled on a host. */ +struct Constraint { + /** Mesos slave attribute that the constraint is matched against. */ + 1: string name + 2: TaskConstraint constraint +} + +struct Package { + 1: string role + 2: string name + 3: i32 version +} + +/** Arbitrary key-value metadata to be included into TaskConfig. */ +struct Metadata { + 1: string key + 2: string value +} + +/** A unique identifier for a Job. */ +struct JobKey { + /** User role (Unix service account), for example "mesos" */ + 1: string role + /** Environment, for example "devel" */ + 2: string environment + /** Name, for example "labrat" */ + 3: string name +} + +/** A unique lock key. */ +union LockKey { + 1: JobKey job +} + +/** A generic lock struct to facilitate context specific resource/operation serialization. */ +struct Lock { + /** ID of the lock - unique per storage */ + 1: LockKey key + /** UUID - facilitating soft lock authorization */ + 2: string token + /** Lock creator */ + 3: string user + /** Lock creation timestamp in milliseconds */ + 4: i64 timestampMs + /** Optional message to record with the lock */ + 5: optional string message +} + +/** A unique identifier for the active task within a job. */ +struct InstanceKey { + /** Key identifying the job. */ + 1: JobKey jobKey + /** Unique instance ID for the active task in a job. */ + 2: i32 instanceId +} + +/** URI which mirrors CommandInfo.URI in the Mesos Protobuf */ +struct MesosFetcherURI { + /** Where to get the resource from */ + 1: string value + /** Extract compressed archive after downloading */ + 2: optional bool extract + /** Cache value using Mesos Fetcher caching mechanism **/ + 3: optional bool cache +} + +struct ExecutorConfig { + /** Name identifying the Executor. */ + 1: string name + /** Executor configuration data. */ + 2: string data +} + +/** The mode for a volume mount */ +enum Mode { + /** Read Write */ + RW = 1 + /** Read Only */ + RO = 2 +} + +/** A volume mount point within a container */ +struct Volume { + /** The path inside the container where the mount will be created. */ + 1: string containerPath + /** The path on the host that will serve as the source for the mount. */ + 2: string hostPath + /** The access mode */ + 3: Mode mode +} + +/** Describes an image for use with the Mesos unified containerizer in the Docker format */ +struct DockerImage { + /** The name of the image to run */ + 1: string name + /** The Docker tag identifying the image */ + 2: string tag +} + +/** Describes an image for use with the Mesos unified containerizer in the AppC format */ +struct AppcImage { + /** The name of the image to run */ + 1: string name + /** The appc image id identifying the image */ + 2: string imageId +} + +/** Describes an image to be used with the Mesos unified containerizer */ +union Image { + 1: DockerImage docker + 2: AppcImage appc +} + +/** Describes a mesos container, this is the default */ +struct MesosContainer { + /** the optional filesystem image to use when launching this task. */ + 1: optional Image image +} + +/** Describes a parameter passed to docker cli */ +struct DockerParameter { + /** a parameter to pass to docker. (e.g. volume) */ + 1: string name + /** the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) */ + 2: string value +} + +/** Describes a docker container */ +struct DockerContainer { + /** The container image to be run */ + 1: string image + /** The arbitrary parameters to pass to container */ + 2: optional list parameters +} + +/** Describes a container to be used in a task */ +union Container { + 1: MesosContainer mesos + 2: DockerContainer docker +} + +/** Describes resource value required to run a task. */ +union Resource { + 1: double numCpus + 2: i64 ramMb + 3: i64 diskMb + 4: string namedPort + 5: i64 numGpus +} + +/** Description of the tasks contained within a job. */ +struct TaskConfig { + /** Job task belongs to. */ + 28: JobKey job + // TODO(maxim): Deprecated. See AURORA-749. + /** contains the role component of JobKey */ + 17: Identity owner + 7: bool isService + // TODO(maxim): Deprecated. See AURORA-1707. + 8: double numCpus + // TODO(maxim): Deprecated. See AURORA-1707. + 9: i64 ramMb + // TODO(maxim): Deprecated. See AURORA-1707. + 10: i64 diskMb + 11: i32 priority + 13: i32 maxTaskFailures + // TODO(mnurolahzade): Deprecated. See AURORA-1708. + /** Whether this is a production task, which can preempt. */ + 18: optional bool production + /** Task tier type. */ + 30: optional string tier + /** All resources required to run a task. */ + 32: set resources + /** Resources to retrieve with Mesos Fetcher */ + 33: optional set mesosFetcherUris + + 20: set constraints + /** a list of named ports this task requests */ + 21: set requestedPorts + /** + * Custom links to include when displaying this task on the scheduler dashboard. Keys are anchor + * text, values are URLs. Wildcards are supported for dynamic link crafting based on host, ports, + * instance, etc. + */ + 22: optional map taskLinks + 23: optional string contactEmail + /** Executor configuration */ + 25: optional ExecutorConfig executorConfig + /** Used to display additional details in the UI. */ + 27: optional set metadata + + // This field is deliberately placed at the end to work around a bug in the immutable wrapper + // code generator. See AURORA-1185 for details. + /** the container the task should use to execute */ + 29: Container container = { "mesos": {} } +} + +struct ResourceAggregate { + // TODO(maxim): Deprecated. See AURORA-1707. + /** Number of CPU cores allotted. */ + 1: double numCpus + // TODO(maxim): Deprecated. See AURORA-1707. + /** Megabytes of RAM allotted. */ + 2: i64 ramMb + // TODO(maxim): Deprecated. See AURORA-1707. + /** Megabytes of disk space allotted. */ + 3: i64 diskMb + /** Aggregated resource values. */ + 4: set resources +} + +/** Defines the policy for launching a new cron job when one is already running. */ +enum CronCollisionPolicy { + /** Kills the existing job with the colliding name, and runs the new cron job. */ + KILL_EXISTING = 0, + /** Cancels execution of the new job, leaving the running job in tact. */ + CANCEL_NEW = 1, + /** + * DEPRECATED. For existing jobs, treated the same as CANCEL_NEW. + * createJob will reject jobs with this policy. + */ + RUN_OVERLAP = 2 +} + +/** + * Description of an Aurora job. One task will be scheduled for each instance within the job. + */ +struct JobConfiguration { + /** + * Key for this job. If not specified name, owner.role, and a reasonable default environment are + * used to construct it server-side. + */ + 9: JobKey key + // TODO(maxim): Deprecated. See AURORA-749. + /** Owner of this job. */ + 7: Identity owner + /** + * If present, the job will be handled as a cron job with this crontab-syntax schedule. + */ + 4: optional string cronSchedule + /** Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. */ + 5: CronCollisionPolicy cronCollisionPolicy + /** Task configuration for this job. */ + 6: TaskConfig taskConfig + /** + * The number of instances in the job. Generated instance IDs for tasks will be in the range + * [0, instances). + */ + 8: i32 instanceCount +} + +struct JobStats { + /** Number of tasks in active state for this job. */ + 1: i32 activeTaskCount + /** Number of tasks in finished state for this job. */ + 2: i32 finishedTaskCount + /** Number of failed tasks for this job. */ + 3: i32 failedTaskCount + /** Number of tasks in pending state for this job. */ + 4: i32 pendingTaskCount +} + +struct JobSummary { + 1: JobConfiguration job + 2: JobStats stats + /** Timestamp of next cron run in ms since epoch, for a cron job */ + 3: optional i64 nextCronRunMs +} + +/** Closed range of integers. */ +struct Range { + 1: i32 first + 2: i32 last +} + +struct ConfigGroup { + 1: TaskConfig config + 3: set instances +} + +struct ConfigSummary { + 1: JobKey key + 2: set groups +} + +struct PopulateJobResult { + 2: TaskConfig taskConfig +} + +struct GetQuotaResult { + /** Total allocated resource quota. */ + 1: ResourceAggregate quota + /** Resources consumed by production jobs from a shared resource pool. */ + 2: optional ResourceAggregate prodSharedConsumption + /** Resources consumed by non-production jobs from a shared resource pool. */ + 3: optional ResourceAggregate nonProdSharedConsumption + /** Resources consumed by production jobs from a dedicated resource pool. */ + 4: optional ResourceAggregate prodDedicatedConsumption + /** Resources consumed by non-production jobs from a dedicated resource pool. */ + 5: optional ResourceAggregate nonProdDedicatedConsumption +} + +/** States that a task may be in. */ +enum ScheduleStatus { + // TODO(maxim): This state does not add much value. Consider dropping it completely. + /* Initial state for a task. A task will remain in this state until it has been persisted. */ + INIT = 11, + /** The task will be rescheduled, but is being throttled for restarting too frequently. */ + THROTTLED = 16, + /** Task is awaiting assignment to a slave. */ + PENDING = 0, + /** Task has been assigned to a slave. */ + ASSIGNED = 9, + /** Slave has acknowledged receipt of task and is bootstrapping the task. */ + STARTING = 1, + /** The task is running on the slave. */ + RUNNING = 2, + /** The task terminated with an exit code of zero. */ + FINISHED = 3, + /** The task is being preempted by another task. */ + PREEMPTING = 13, + /** The task is being restarted in response to a user request. */ + RESTARTING = 12, + /** The task is being restarted in response to a host maintenance request. */ + DRAINING = 17, + /** The task terminated with a non-zero exit code. */ + FAILED = 4, + /** Execution of the task was terminated by the system. */ + KILLED = 5, + /** The task is being forcibly killed. */ + KILLING = 6, + /** A fault in the task environment has caused the system to believe the task no longer exists. + * This can happen, for example, when a slave process disappears. + */ + LOST = 7 +} + +// States that a task may be in while still considered active. +const set ACTIVE_STATES = [ScheduleStatus.ASSIGNED, + ScheduleStatus.DRAINING, + ScheduleStatus.KILLING, + ScheduleStatus.PENDING, + ScheduleStatus.PREEMPTING, + ScheduleStatus.RESTARTING + ScheduleStatus.RUNNING, + ScheduleStatus.STARTING, + ScheduleStatus.THROTTLED] + +// States that a task may be in while associated with a slave machine and non-terminal. +const set SLAVE_ASSIGNED_STATES = [ScheduleStatus.ASSIGNED, + ScheduleStatus.DRAINING, + ScheduleStatus.KILLING, + ScheduleStatus.PREEMPTING, + ScheduleStatus.RESTARTING, + ScheduleStatus.RUNNING, + ScheduleStatus.STARTING] + +// States that a task may be in while in an active sandbox. +const set LIVE_STATES = [ScheduleStatus.KILLING, + ScheduleStatus.PREEMPTING, + ScheduleStatus.RESTARTING, + ScheduleStatus.DRAINING, + ScheduleStatus.RUNNING] + +// States a completed task may be in. +const set TERMINAL_STATES = [ScheduleStatus.FAILED, + ScheduleStatus.FINISHED, + ScheduleStatus.KILLED, + ScheduleStatus.LOST] + +// Regular expressions for matching valid identifiers for job path components. All expressions +// below should accept and reject the same set of inputs. +const string GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$" +// JVM: Use with java.util.regex.Pattern#compile +const string GOOD_IDENTIFIER_PATTERN_JVM = GOOD_IDENTIFIER_PATTERN +// Python: Use with re.compile +const string GOOD_IDENTIFIER_PATTERN_PYTHON = GOOD_IDENTIFIER_PATTERN + +/** Event marking a state transition within a task's lifecycle. */ +struct TaskEvent { + /** Epoch timestamp in milliseconds. */ + 1: i64 timestamp + /** New status of the task. */ + 2: ScheduleStatus status + /** Audit message that explains why a transition occurred. */ + 3: optional string message + /** Hostname of the scheduler machine that performed the event. */ + 4: optional string scheduler +} + +/** A task assignment that is provided to an executor. */ +struct AssignedTask { + /** The mesos task ID for this task. Guaranteed to be globally unique */ + 1: string taskId + + /** + * The mesos slave ID that this task has been assigned to. + * This will not be populated for a PENDING task. + */ + 2: string slaveId + + /** + * The name of the machine that this task has been assigned to. + * This will not be populated for a PENDING task. + */ + 3: string slaveHost + + /** Information about how to run this task. */ + 4: TaskConfig task + /** Ports reserved on the machine while this task is running. */ + 5: map assignedPorts + + /** + * The instance ID assigned to this task. Instance IDs must be unique and contiguous within a + * job, and will be in the range [0, N-1] (inclusive) for a job that has N instances. + */ + 6: i32 instanceId +} + +/** A task that has been scheduled. */ +struct ScheduledTask { + /** The task that was scheduled. */ + 1: AssignedTask assignedTask + /** The current status of this task. */ + 2: ScheduleStatus status + /** + * The number of failures that this task has accumulated over the multi-generational history of + * this task. + */ + 3: i32 failureCount + /** State change history for this task. */ + 4: list taskEvents + /** + * The task ID of the previous generation of this task. When a task is automatically rescheduled, + * a copy of the task is created and ancestor ID of the previous task's task ID. + */ + 5: string ancestorId +} + +struct ScheduleStatusResult { + 1: list tasks +} + +struct GetJobsResult { + 1: set configs +} + +/** + * Contains a set of restrictions on matching tasks where all restrictions must be met + * (terms are AND'ed together). + */ +struct TaskQuery { + 14: string role + 9: string environment + 2: string jobName + 4: set taskIds + 5: set statuses + 7: set instanceIds + 10: set slaveHosts + 11: set jobKeys + 12: i32 offset + 13: i32 limit +} + +struct HostStatus { + 1: string host + 2: MaintenanceMode mode +} + +struct RoleSummary { + 1: string role + 2: i32 jobCount + 3: i32 cronJobCount +} + +struct Hosts { + 1: set hostNames +} + +struct PendingReason { + 1: string taskId + 2: string reason +} + +/** States that a job update may be in. */ +enum JobUpdateStatus { + /** Update is in progress. */ + ROLLING_FORWARD = 0, + + /** Update has failed and is being rolled back. */ + ROLLING_BACK = 1, + + /** Update has been paused while in progress. */ + ROLL_FORWARD_PAUSED = 2, + + /** Update has been paused during rollback. */ + ROLL_BACK_PAUSED = 3, + + /** Update has completed successfully. */ + ROLLED_FORWARD = 4, + + /** Update has failed and rolled back. */ + ROLLED_BACK = 5, + + /** Update was aborted. */ + ABORTED = 6, + + /** Unknown error during update. */ + ERROR = 7, + + /** + * Update failed to complete. + * This can happen if failure thresholds are met while rolling forward, but rollback is disabled, + * or if failure thresholds are met when rolling back. + */ + FAILED = 8, + + /** Update has been blocked while in progress due to missing/expired pulse. */ + ROLL_FORWARD_AWAITING_PULSE = 9, + + /** Update has been blocked during rollback due to missing/expired pulse. */ + ROLL_BACK_AWAITING_PULSE = 10 +} + +/** States the job update can be in while still considered active. */ +const set ACTIVE_JOB_UPDATE_STATES = [JobUpdateStatus.ROLLING_FORWARD, + JobUpdateStatus.ROLLING_BACK, + JobUpdateStatus.ROLL_FORWARD_PAUSED, + JobUpdateStatus.ROLL_BACK_PAUSED, + JobUpdateStatus.ROLL_FORWARD_AWAITING_PULSE, + JobUpdateStatus.ROLL_BACK_AWAITING_PULSE] + +/** Job update actions that can be applied to job instances. */ +enum JobUpdateAction { + /** + * An instance was moved to the target state successfully, and declared healthy if the desired + * state did not involve deleting the instance. + */ + INSTANCE_UPDATED = 1, + + /** + * An instance was rolled back because the job update did not succeed. The instance was reverted + * to the original state prior to the job update, which means that the instance was removed if + * the update added instances to the job. + */ + INSTANCE_ROLLED_BACK = 2, + + /** + * An instance is being moved from the original state to the desired state. + */ + INSTANCE_UPDATING = 3, + + /** + * An instance is being moved from the desired state back to the original state, because the job + * update failed. + */ + INSTANCE_ROLLING_BACK = 4, + + /** An instance update was attempted but failed and was not rolled back. */ + INSTANCE_UPDATE_FAILED = 5, + + /** An instance rollback was attempted but failed. */ + INSTANCE_ROLLBACK_FAILED = 6 +} + +/** Status of the coordinated update. Intended as a response to pulseJobUpdate RPC. */ +enum JobUpdatePulseStatus { + /** + * Update is active. See ACTIVE_JOB_UPDATE_STATES for statuses considered active. + */ + OK = 1, + + /** + * Update has reached terminal state. See TERMINAL_JOB_UPDATE_STATES for statuses + * considered terminal. + */ + FINISHED = 2 +} + +/** Job update key. */ +struct JobUpdateKey { + /** Job being updated */ + 1: JobKey job + + /** Update ID. */ + 2: string id +} + +/** Job update thresholds and limits. */ +struct JobUpdateSettings { + /** 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. */ + 2: i32 maxPerInstanceFailures + + /** Max number of FAILED instances to tolerate before terminating the update. */ + 3: i32 maxFailedInstances + + /** Min time to watch a RUNNING instance. */ + 5: i32 minWaitInInstanceRunningMs + + /** If true, enables failed update rollback. */ + 6: bool rollbackOnFailure + + /** Instance IDs to act on. All instances will be affected if this is not set. */ + 7: set updateOnlyTheseInstances + + /** + * If true, use updateGroupSize as strict batching boundaries, and avoid proceeding to another + * batch until the preceding batch finishes updating. + */ + 8: bool waitForBatchCompletion + + /** + * 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 + * block. A blocked update is unable to continue but retains its current status. It may only get + * unblocked by a fresh pulseJobUpdate call. + */ + 9: optional i32 blockIfNoPulsesAfterMs +} + +/** Event marking a state transition in job update lifecycle. */ +struct JobUpdateEvent { + /** Update status. */ + 1: JobUpdateStatus status + + /** Epoch timestamp in milliseconds. */ + 2: i64 timestampMs + + /** User who performed this event (if user-initiated). */ + 3: optional string user + + /** + * Message from the user (for user-initiated transitions) or the scheduler about why the state was + * changed. + */ + 4: optional string message +} + +/** Event marking a state transition in job instance update lifecycle. */ +struct JobInstanceUpdateEvent { + /** Job instance ID. */ + 1: i32 instanceId + + /** Epoch timestamp in milliseconds. */ + 2: i64 timestampMs + + /** Job update action taken on the instance. */ + 3: JobUpdateAction action +} + +/** Maps instance IDs to TaskConfigs it. */ +struct InstanceTaskConfig { + /** A TaskConfig associated with instances. */ + 1: TaskConfig task + + /** Instances associated with the TaskConfig. */ + 2: set instances +} + +/** Current job update state including status and created/modified timestamps. */ +struct JobUpdateState { + /** Current status of the update. */ + 1: JobUpdateStatus status + + /** Created timestamp in milliseconds. */ + 2: i64 createdTimestampMs + + /** Last modified timestamp in milliseconds. */ + 3: i64 lastModifiedTimestampMs +} + +/** Summary of the job update including job key, user and current state. */ +struct JobUpdateSummary { + /** Unique identifier for the update. */ + 5: JobUpdateKey key + + /** User initiated an update. */ + 3: string user + + /** Current job update state. */ + 4: JobUpdateState state +} + +/** Update configuration and setting details. */ +struct JobUpdateInstructions { + /** Actual InstanceId -> TaskConfig mapping when the update was requested. */ + 1: set initialState + + /** Desired configuration when the update completes. */ + 2: InstanceTaskConfig desiredState + + /** Update specific settings. */ + 3: JobUpdateSettings settings +} + +/** Full definition of the job update. */ +struct JobUpdate { + /** Update summary. */ + 1: JobUpdateSummary summary + + /** Update configuration. */ + 2: JobUpdateInstructions instructions +} + +struct JobUpdateDetails { + /** Update definition. */ + 1: JobUpdate update + + /** History for this update. */ + 2: list updateEvents + + /** History for the individual instances updated. */ + 3: list instanceEvents +} + +/** A request to update the following instances of an existing job. Used by startUpdate. */ +struct JobUpdateRequest { + /** Desired TaskConfig to apply. */ + 1: TaskConfig taskConfig + + /** Desired number of instances of the task config. */ + 2: i32 instanceCount + + /** Update settings and limits. */ + 3: JobUpdateSettings settings +} + +/** + * Contains a set of restrictions on matching job updates where all restrictions must be met + * (terms are AND'ed together). + */ +struct JobUpdateQuery { + /** Job role. */ + 2: string role + + /** Unique identifier for a job update. */ + 8: JobUpdateKey key + + /** Job key. */ + 3: JobKey jobKey + + /** User who created the update. */ + 4: string user + + /** Set of update statuses. */ + 5: set updateStatuses + + /** Offset to serve data from. Used by pagination. */ + 6: i32 offset + + /** Number or records to serve. Used by pagination. */ + 7: i32 limit +} + +struct ListBackupsResult { + 1: set backups +} + +struct StartMaintenanceResult { + 1: set statuses +} + +struct DrainHostsResult { + 1: set statuses +} + +struct QueryRecoveryResult { + 1: set tasks +} + +struct MaintenanceStatusResult { + 1: set statuses +} + +struct EndMaintenanceResult { + 1: set statuses +} + +struct RoleSummaryResult { + 1: set summaries +} + +struct JobSummaryResult { + 1: set summaries +} + +struct ConfigSummaryResult { + 1: ConfigSummary summary +} + +struct GetPendingReasonResult { + 1: set reasons +} + +/** Result of the startUpdate call. */ +struct StartJobUpdateResult { + /** Unique identifier for the job update. */ + 1: JobUpdateKey key +} + +/** Result of the getJobUpdateSummaries call. */ +struct GetJobUpdateSummariesResult { + 1: list updateSummaries +} + +/** Result of the getJobUpdateDetails call. */ +struct GetJobUpdateDetailsResult { + 1: JobUpdateDetails details +} + +/** Result of the pulseJobUpdate call. */ +struct PulseJobUpdateResult { + 1: JobUpdatePulseStatus status +} + +struct GetJobUpdateDiffResult { + /** Instance addition diff details. */ + 1: set add + + /** Instance removal diff details. */ + 2: set remove + + /** Instance update diff details. */ + 3: set update + + /** Instances unchanged by the update. */ + 4: set unchanged +} + +/** Tier information. */ +struct TierConfig { + /** Name of tier. */ + 1: string name + /** Tier attributes. */ + 2: map settings +} + +/** Result of the getTierConfigResult call. */ +struct GetTierConfigResult { + /** Name of the default tier. */ + 1: string defaultTierName + /** Set of tier configurations. */ + 2: set tiers +} + +/** Information about the scheduler. */ +struct ServerInfo { + 1: string clusterName + /** A url prefix for job container stats. */ + 3: string statsUrlPrefix +} + +union Result { + 1: PopulateJobResult populateJobResult + 3: ScheduleStatusResult scheduleStatusResult + 4: GetJobsResult getJobsResult + 5: GetQuotaResult getQuotaResult + 6: ListBackupsResult listBackupsResult + 7: StartMaintenanceResult startMaintenanceResult + 8: DrainHostsResult drainHostsResult + 9: QueryRecoveryResult queryRecoveryResult + 10: MaintenanceStatusResult maintenanceStatusResult + 11: EndMaintenanceResult endMaintenanceResult + 17: RoleSummaryResult roleSummaryResult + 18: JobSummaryResult jobSummaryResult + 20: ConfigSummaryResult configSummaryResult + 21: GetPendingReasonResult getPendingReasonResult + 22: StartJobUpdateResult startJobUpdateResult + 23: GetJobUpdateSummariesResult getJobUpdateSummariesResult + 24: GetJobUpdateDetailsResult getJobUpdateDetailsResult + 25: PulseJobUpdateResult pulseJobUpdateResult + 26: GetJobUpdateDiffResult getJobUpdateDiffResult + 27: GetTierConfigResult getTierConfigResult +} + +struct ResponseDetail { + 1: string message +} + +struct Response { + 1: ResponseCode responseCode + 5: ServerInfo serverInfo + /** Payload from the invoked RPC. */ + 3: optional Result result + /** + * Messages from the server relevant to the request, such as warnings or use of deprecated + * features. + */ + 6: list details +} + +// A service that provides all the read only calls to the Aurora scheduler. +service ReadOnlyScheduler { + /** Returns a summary of the jobs grouped by role. */ + Response getRoleSummary() + + /** Returns a summary of jobs, optionally only those owned by a specific role. */ + Response getJobSummary(1: string role) + + /** Fetches the status of tasks. */ + Response getTasksStatus(1: TaskQuery query) + + /** + * Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set. + * This is an interim solution until we have a better way to query TaskConfigs (AURORA-541). + */ + Response getTasksWithoutConfigs(1: TaskQuery query) + + /** Returns user-friendly reasons (if available) for tasks retained in PENDING state. */ + Response getPendingReason(1: TaskQuery query) + + /** Fetches the configuration summary of active tasks for the specified job. */ + Response getConfigSummary(1: JobKey job) + + /** + * Fetches the status of jobs. + * ownerRole is optional, in which case all jobs are returned. + */ + Response getJobs(1: string ownerRole) + + /** Fetches the quota allocated for a user. */ + Response getQuota(1: string ownerRole) + + /** + * Populates fields in a job configuration as though it were about to be run. + * This can be used to diff a configuration running tasks. + */ + Response populateJobConfig(1: JobConfiguration description) + + /** Gets job update summaries. */ + Response getJobUpdateSummaries(1: JobUpdateQuery jobUpdateQuery) + + /** Gets job update details. */ + Response getJobUpdateDetails(1: JobUpdateKey key) + + /** Gets the diff between client (desired) and server (current) job states. */ + Response getJobUpdateDiff(1: JobUpdateRequest request) + + /** Gets tier configurations. */ + Response getTierConfigs() +} + +service AuroraSchedulerManager extends ReadOnlyScheduler { + /** + * Creates a new job. The request will be denied if a job with the provided name already exists + * in the cluster. + */ + Response createJob(1: JobConfiguration description) + + /** + * Enters a job into the cron schedule, without actually starting the job. + * If the job is already present in the schedule, this will update the schedule entry with the new + * configuration. + */ + Response scheduleCronJob(1: JobConfiguration description) + + /** + * Removes a job from the cron schedule. The request will be denied if the job was not previously + * scheduled with scheduleCronJob. + */ + Response descheduleCronJob(4: JobKey job) + + /** + * Starts a cron job immediately. The request will be denied if the specified job does not + * exist for the role account, or the job is not a cron job. + */ + Response startCronJob(4: JobKey job) + + /** Restarts a batch of shards. */ + Response restartShards(5: JobKey job, 3: set shardIds) + + /** Initiates a kill on tasks. */ + Response killTasks(4: JobKey job, 5: set instances) + + /** + * Adds new instances with the TaskConfig of the existing instance pointed by the key. + */ + Response addInstances(3: InstanceKey key, 4: i32 count) + + // TODO(maxim): reevaluate if it's still needed when client updater is gone (AURORA-785). + /** + * Replaces the template (configuration) for the existing cron job. + * The cron job template (configuration) must exist for the call to succeed. + */ + Response replaceCronTemplate(1: JobConfiguration config) + + /** Starts update of the existing service job. */ + Response startJobUpdate( + /** A description of how to change the job. */ + 1: JobUpdateRequest request, + /** A user-specified message to include with the induced job update state change. */ + 3: string message) + + /** + * Pauses the specified job update. Can be resumed by resumeUpdate call. + */ + Response pauseJobUpdate( + /** The update to pause. */ + 1: JobUpdateKey key, + /** A user-specified message to include with the induced job update state change. */ + 3: string message) + + /** Resumes progress of a previously paused job update. */ + Response resumeJobUpdate( + /** The update to resume. */ + 1: JobUpdateKey key, + /** A user-specified message to include with the induced job update state change. */ + 3: string message) + + /** Permanently aborts the job update. Does not remove the update history. */ + Response abortJobUpdate( + /** The update to abort. */ + 1: JobUpdateKey key, + /** A user-specified message to include with the induced job update state change. */ + 3: string message) + + /** + * Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in + * JobUpdateSettings. Unblocks progress if the update was previously blocked. + * Responds with ResponseCode.INVALID_REQUEST in case an unknown update key is specified. + */ + Response pulseJobUpdate(1: JobUpdateKey key) +} + +struct InstanceConfigRewrite { + /** Key for the task to rewrite. */ + 1: InstanceKey instanceKey + /** The original configuration. */ + 2: TaskConfig oldTask + /** The rewritten configuration. */ + 3: TaskConfig rewrittenTask +} + +struct JobConfigRewrite { + /** The original job configuration. */ + 1: JobConfiguration oldJob + /** The rewritten job configuration. */ + 2: JobConfiguration rewrittenJob +} + +union ConfigRewrite { + 1: JobConfigRewrite jobRewrite + 2: InstanceConfigRewrite instanceRewrite +} + +struct RewriteConfigsRequest { + 1: list rewriteCommands +} + +// It would be great to compose these services rather than extend, but that won't be possible until +// https://issues.apache.org/jira/browse/THRIFT-66 is resolved. +service AuroraAdmin extends AuroraSchedulerManager { + /** Assign quota to a user. This will overwrite any pre-existing quota for the user. */ + Response setQuota(1: string ownerRole, 2: ResourceAggregate quota) + + /** + * Forces a task into a specific state. This does not guarantee the task will enter the given + * state, as the task must still transition within the bounds of the state machine. However, + * it attempts to enter that state via the state machine. + */ + Response forceTaskState( + 1: string taskId, + 2: ScheduleStatus status) + + /** Immediately writes a storage snapshot to disk. */ + Response performBackup() + + /** Lists backups that are available for recovery. */ + Response listBackups() + + /** Loads a backup to an in-memory storage. This must precede all other recovery operations. */ + Response stageRecovery(1: string backupId) + + /** Queries for tasks in a staged recovery. */ + Response queryRecovery(1: TaskQuery query) + + /** Deletes tasks from a staged recovery. */ + Response deleteRecoveryTasks(1: TaskQuery query) + + /** Commits a staged recovery, completely replacing the previous storage state. */ + Response commitRecovery() + + /** Unloads (aborts) a staged recovery. */ + Response unloadRecovery() + + /** Put the given hosts into maintenance mode. */ + Response startMaintenance(1: Hosts hosts) + + /** Ask scheduler to begin moving tasks scheduled on given hosts. */ + Response drainHosts(1: Hosts hosts) + + /** Retrieve the current maintenance states for a group of hosts. */ + Response maintenanceStatus(1: Hosts hosts) + + /** Set the given hosts back into serving mode. */ + Response endMaintenance(1: Hosts hosts) + + /** Start a storage snapshot and block until it completes. */ + Response snapshot() + + /** + * Forcibly rewrites the stored definition of user configurations. This is intended to be used + * in a controlled setting, primarily to migrate pieces of configurations that are opaque to the + * scheduler (e.g. executorConfig). + * The scheduler may do some validation of the rewritten configurations, but it is important + * that the caller take care to provide valid input and alter only necessary fields. + */ + Response rewriteConfigs(1: RewriteConfigsRequest request) +} + +// The name of the header that should be sent to bypass leader redirection in the Scheduler. +const string BYPASS_LEADER_REDIRECT_HEADER_NAME = 'Bypass-Leader-Redirect' diff --git a/examples/Client.go b/examples/Client.go new file mode 100644 index 0000000..b355d7d --- /dev/null +++ b/examples/Client.go @@ -0,0 +1,148 @@ +/** + * 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 main + +import ( + "flag" + "fmt" + "gen-go/apache/aurora" + "github.com/rdelval/gorealis" + "io/ioutil" + "os" +) + +func main() { + + cmd := flag.String("cmd", "", "Action to execute on Apache Aurora Sched") + executor := flag.String("executor", "thermos", "Executor to use, thermos by default") + url := flag.String("url", "", "URL at which the Apache Aurora Scheduler exists [url]:[port]") + updateId := flag.String("updateId", "", "Update ID to operate on") + flag.Parse() + + //Create new configuration with default transport layer + config, err := realis.NewDefaultConfig(*url) + if err != nil { + fmt.Print(err) + os.Exit(1) + } + + // Needed for authorization for Vagrant + realis.AddBasicAuth(&config, "aurora", "secret") + r := realis.NewClient(config) + defer r.Close() + + var job *realis.Job + + switch *executor { + case "thermos": + payload, err := ioutil.ReadFile("thermos_payload.json") + + if err != nil { + fmt.Print("Error reading json config file: ", err) + os.Exit(1) + } + job = realis.NewJob().SetEnvironment("prod"). + SetRole("vagrant"). + SetName("hello_world_from_gorealis"). + SetExecutorName(aurora.AURORA_EXECUTOR_NAME). + SetExecutorData(string(payload)). + SetNumCpus(1). + SetRam(64). + SetDisk(100). + SetIsService(true). + SetInstanceCount(1). + AddPorts(1) + break + case "compose": + job = realis.NewJob().SetEnvironment("prod"). + SetRole("vagrant"). + SetName("docker-compose"). + SetExecutorName("docker-compose-executor"). + SetExecutorData("{}"). + SetNumCpus(1). + SetRam(64). + SetDisk(100). + SetIsService(false). + SetInstanceCount(1). + AddPorts(1). + AddLabel("fileName", "sample-app/sample-app.yml"). + AddURI("https://dl.bintray.com/rdelvalle/mesos-compose-executor/sample-app.tar.gz", true, true) + break + default: + fmt.Println("Only thermos and compose are supported for now") + os.Exit(1) + } + + switch *cmd { + case "create": + fmt.Println("Creating job") + msg, err := r.CreateJob(job) + if err != nil { + fmt.Print(err) + } + + fmt.Print(msg) + break + case "kill": + fmt.Println("Killing job") + + msg, err := r.KillJob(job.GetJobKey()) + if err != nil { + fmt.Print(err) + } + + fmt.Print(msg) + break + case "restart": + fmt.Println("Restarting job") + msg, err := r.RestartJob(job.GetJobKey()) + if err != nil { + fmt.Print(err) + } + + fmt.Print(msg) + break + case "flexUp": + fmt.Println("Flexing up job") + msg, err := r.AddInstances(job.GetJobKey(), 5) + if err != nil { + fmt.Print(err) + } + fmt.Print(msg) + break + case "update": + fmt.Println("Updating a job with a new name") + updateJob := realis.NewUpdateJob(job) + + updateJob.SetInstanceCount(3).SetRam(128) + + msg, err := r.StartJobUpdate(updateJob, "") + if err != nil { + fmt.Print(err) + } + fmt.Print(msg) + break + case "abortUpdate": + fmt.Println("Abort update") + msg, err := r.AbortJobUpdate(job.GetJobKey(), *updateId, "") + if err != nil { + fmt.Print(err) + } + fmt.Print(msg) + break + default: + fmt.Println("Only Create, Kill, and Restart are supported now") + os.Exit(1) + } +} diff --git a/examples/thermos_payload.json b/examples/thermos_payload.json new file mode 100644 index 0000000..72b63f6 --- /dev/null +++ b/examples/thermos_payload.json @@ -0,0 +1,62 @@ +{ + "environment": "prod", + "health_check_config": { + "initial_interval_secs": 15.0, + "health_checker": { + "http": { + "expected_response_code": 0, + "endpoint": "/health", + "expected_response": "ok" + } + }, + "interval_secs": 10.0, + "timeout_secs": 1.0, + "max_consecutive_failures": 0 + }, + "name": "hello_world_from_gorealis", + "service": false, + "max_task_failures": 1, + "cron_collision_policy": "KILL_EXISTING", + "enable_hooks": false, + "cluster": "devcluster", + "task": { + "processes": [ + { + "daemon": false, + "name": "hello", + "ephemeral": false, + "max_failures": 1, + "min_duration": 5, + "cmdline": "\n while true; do\n echo hello world from GoRealis\n sleep 10\n done\n ", + "final": false + } + ], + "name": "hello", + "finalization_wait": 30, + "max_failures": 1, + "max_concurrency": 0, + "resources": { + "gpu": 0, + "disk": 134217728, + "ram": 134217728, + "cpu": 1.0 + }, + "constraints": [ + { + "order": [ + "hello" + ] + } + ] + }, + "production": false, + "role": "vagrant", + "lifecycle": { + "http": { + "graceful_shutdown_endpoint": "/quitquitquit", + "port": "health", + "shutdown_endpoint": "/abortabortabort" + } + }, + "priority": 0 +} \ No newline at end of file diff --git a/generateBindings.sh b/generateBindings.sh new file mode 100755 index 0000000..bbc2f71 --- /dev/null +++ b/generateBindings.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +THRIFT_VER=0.9.3 + +if [[ $(thrift -version | grep -e $THRIFT_VER -c) -ne 1 ]]; then + echo "Warning: This wrapper has only been tested with version" $THRIFT_VER; +fi + +echo "Generating bindings and placing them in the vendor folder..."; +thrift -o vendor/ -r -gen go:package=apache.aurora auroraAPI.thrift; +echo "Done"; diff --git a/job.go b/job.go new file mode 100644 index 0000000..55ea741 --- /dev/null +++ b/job.go @@ -0,0 +1,194 @@ +/** + * 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 ( + "gen-go/apache/aurora" + "strconv" +) + +type Job struct { + jobConfig *aurora.JobConfiguration + numCpus *aurora.Resource + ramMb *aurora.Resource + diskMb *aurora.Resource + portCount int +} + +type CreateJobBuilder struct { + jobConfig *aurora.JobConfiguration + jobKey *aurora.JobKey + taskConfig *aurora.TaskConfig + numCpus *aurora.Resource + ramMb *aurora.Resource + diskMb *aurora.Resource +} + +func NewJob() *Job { + jobConfig := aurora.NewJobConfiguration() + taskConfig := aurora.NewTaskConfig() + jobKey := aurora.NewJobKey() + + //Job Config + jobConfig.Key = jobKey + jobConfig.TaskConfig = taskConfig + + //Task Config + taskConfig.Job = jobKey + taskConfig.Container = aurora.NewContainer() + taskConfig.Container.Mesos = aurora.NewMesosContainer() + taskConfig.ExecutorConfig = aurora.NewExecutorConfig() + taskConfig.MesosFetcherUris = make(map[*aurora.MesosFetcherURI]bool) + taskConfig.Metadata = make(map[*aurora.Metadata]bool) + taskConfig.Constraints = make(map[*aurora.Constraint]bool) + + //Resources + numCpus := aurora.NewResource() + ramMb := aurora.NewResource() + diskMb := aurora.NewResource() + + taskConfig.Resources = make(map[*aurora.Resource]bool) + taskConfig.Resources[numCpus] = true + taskConfig.Resources[ramMb] = true + taskConfig.Resources[diskMb] = true + + return &Job{jobConfig, numCpus, ramMb, diskMb, 0} +} + +func (a *Job) SetEnvironment(env string) *Job { + a.jobConfig.Key.Environment = env + return a +} + +func (a *Job) SetRole(role string) *Job { + a.jobConfig.Key.Role = role + + //Will be deprecated + identity := &aurora.Identity{role} + a.jobConfig.Owner = identity + a.jobConfig.TaskConfig.Owner = identity + return a +} + +func (a *Job) SetName(name string) *Job { + a.jobConfig.Key.Name = name + return a +} + +func (a *Job) SetExecutorName(name string) *Job { + a.jobConfig.TaskConfig.ExecutorConfig.Name = name + return a +} + +func (a *Job) SetExecutorData(data string) *Job { + a.jobConfig.TaskConfig.ExecutorConfig.Data = data + return a +} + +func (a *Job) SetNumCpus(cpus float64) *Job { + a.numCpus.NumCpus = &cpus + a.jobConfig.TaskConfig.NumCpus = cpus //Will be deprecated soon + + return a +} + +func (a *Job) SetRam(ram int64) *Job { + a.ramMb.RamMb = &ram + a.jobConfig.TaskConfig.RamMb = ram //Will be deprecated soon + + return a +} + +func (a *Job) SetDisk(disk int64) *Job { + a.diskMb.DiskMb = &disk + a.jobConfig.TaskConfig.DiskMb = disk //Will be deprecated + + return a +} + +func (a *Job) SetMaxFailure(maxFail int32) *Job { + a.jobConfig.TaskConfig.MaxTaskFailures = maxFail + return a +} + +func (a *Job) SetInstanceCount(instCount int32) *Job { + a.jobConfig.InstanceCount = instCount + return a +} + +func (a *Job) SetIsService(isService bool) *Job { + a.jobConfig.TaskConfig.IsService = isService + return a +} + +func (a *Job) GetJobKey() *aurora.JobKey { + return a.jobConfig.Key +} + +func (a *Job) AddURI(value string, extract bool, cache bool) *Job { + a.jobConfig.TaskConfig.MesosFetcherUris[&aurora.MesosFetcherURI{value, &extract, &cache}] = true + return a +} + +func (a *Job) AddURIs(extract bool, cache bool, values ...string) *Job { + for _, value := range values { + a.jobConfig.TaskConfig.MesosFetcherUris[&aurora.MesosFetcherURI{value, &extract, &cache}] = true + } + return a +} + +// Note: By default Aurora will add the prefix "org.apache.aurora.metadata." to the beginning of each key +func (a *Job) AddLabel(key string, value string) *Job { + a.jobConfig.TaskConfig.Metadata[&aurora.Metadata{key, value}] = true + return a +} + +//Each port is equivalent to Marathon's 0 port +func (a *Job) AddPorts(num int) *Job { + start := a.portCount + a.portCount += num + for i := start; i < a.portCount; i++ { + portName := "port" + strconv.Itoa(i) + a.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &portName}] = true + } + + return a +} + +// 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. +func (a *Job) AddValueConstraint(name string, + negated bool, + values ...string) *Job { + + constraintValues := make(map[string]bool) + for _, value := range values { + constraintValues[value] = true + } + a.jobConfig.TaskConfig.Constraints[&aurora.Constraint{name, + &aurora.TaskConstraint{&aurora.ValueConstraint{negated, constraintValues}, nil}}] = true + + return a +} + +// From Aurora Docs: A constraint the specifies the maximum number of active tasks on a host with +// a matching attribute that may be scheduled simultaneously. +func (a *Job) AddLimitConstraint(name string, limit int32) *Job { + + a.jobConfig.TaskConfig.Constraints[&aurora.Constraint{name, + &aurora.TaskConstraint{nil, &aurora.LimitConstraint{limit}}}] = true + + return a +} diff --git a/realis.go b/realis.go new file mode 100644 index 0000000..d121942 --- /dev/null +++ b/realis.go @@ -0,0 +1,205 @@ +/** + * 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 provides the ability to use Thrift API to communicate with Apache Aurora. +package realis + +import ( + "encoding/base64" + "fmt" + "gen-go/apache/aurora" + "git.apache.org/thrift.git/lib/go/thrift" + "github.com/pkg/errors" + "net/http" + "net/http/cookiejar" + "os" + "time" +) + +type Realis struct { + client *aurora.AuroraSchedulerManagerClient +} + +// Wrap object to provide future flexibility +type RealisConfig struct { + transport thrift.TTransport +} + +// Create a new Client +func NewClient(config RealisConfig) *Realis { + + httpTrans := (config.transport).(*thrift.THttpClient) + httpTrans.SetHeader("User-Agent", "GoRealis v0.1") + + // Aurora can only communicate in JSON, leave it here as default + protocolFactory := thrift.NewTJSONProtocolFactory() + + return &Realis{client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, protocolFactory)} +} + +// Create a default configuration of the transport layer, requires a URL +func NewDefaultConfig(url string) (RealisConfig, error) { + jar, err := cookiejar.New(nil) + + if err != nil { + return RealisConfig{}, errors.Wrap(err, "Error creating Cookie Jar") + } + + //Custom client to timeout after 10 seconds to avoid hanging + trans, err := thrift.NewTHttpPostClientWithOptions(url+"/api", + thrift.THttpClientOptions{Client: &http.Client{Timeout: time.Second * 10, Jar: jar}}) + + if err != nil { + return RealisConfig{}, errors.Wrap(err, "Error creating transport") + } + + if err := trans.Open(); err != nil { + fmt.Fprintln(os.Stderr) + return RealisConfig{}, errors.Wrapf(err, "Error opening connection to %s", url) + } + + return RealisConfig{transport: trans}, nil + +} + +// Helper function to add basic authorization needed to communicate with Apache Aurora +func AddBasicAuth(config *RealisConfig, username string, password string) { + httpTrans := (config.transport).(*thrift.THttpClient) + httpTrans.SetHeader("Authorization", "Basic "+basicAuth(username, password)) +} + +func basicAuth(username, password string) string { + auth := username + ":" + password + return base64.StdEncoding.EncodeToString([]byte(auth)) +} + +// Releases resources associated with the realis client +func (r *Realis) Close() { + r.client.Transport.Close() +} + +// Uses predefined set of states to retrieve a set of active jobs in Apache Aurora +func (r *Realis) getActiveTaskIds(key *aurora.JobKey) (map[int32]bool, error) { + taskQ := &aurora.TaskQuery{Role: key.Role, + Environment: key.Environment, + JobName: key.Name, + Statuses: aurora.ACTIVE_STATES} + + response, err := r.client.GetTasksWithoutConfigs(taskQ) + if err != nil { + return nil, errors.Wrap(err, "Error querying Aurora Scheduler") + } + + tasks := response.GetResult_().GetScheduleStatusResult_().GetTasks() + + jobTaskIds := make(map[int32]bool) + for _, task := range tasks { + jobTaskIds[task.GetAssignedTask().GetInstanceId()] = true + } + + return jobTaskIds, nil +} + +// Sends a kill message to the scheduler for all active tasks under a job +func (r *Realis) KillJob(key *aurora.JobKey) (string, error) { + + taskIds, err := r.getActiveTaskIds(key) + if err != nil { + return "", errors.Wrap(err, "Could not retrieve relevant task IDs") + } + + if len(taskIds) > 0 { + response, err := r.client.KillTasks(key, taskIds) + + if err != nil { + return "", errors.Wrap(err, "Error sending Kill command to Aurora Scheduler") + } + return response.String(), nil + } else { + return "No tasks in the Active state.", nil + } +} + +// Sends a create job message to the scheduler with a specific job configuration +func (r *Realis) CreateJob(auroraJob *Job) (string, error) { + response, err := r.client.CreateJob(auroraJob.jobConfig) + + if err != nil { + return "", errors.Wrap(err, "Error sending Create command to Aurora Scheduler") + } + + return response.String(), nil +} + +// Restarts all active tasks under a job configuration +func (r *Realis) RestartJob(key *aurora.JobKey) (string, error) { + + taskIds, err := r.getActiveTaskIds(key) + if err != nil { + return "", errors.Wrap(err, "Could not retrieve relevant task IDs") + } + + if len(taskIds) > 0 { + response, err := r.client.RestartShards(key, taskIds) + + if err != nil { + return "", errors.Wrap(err, "Error sending Restart command to Aurora Scheduler") + } + + return response.String(), nil + } else { + return "No tasks in the Active state.", nil + } +} + +// Update all tasks under a job configuration +func (r *Realis) StartJobUpdate(updateJob *UpdateJob, message string) (string, error) { + + response, err := r.client.StartJobUpdate(updateJob.req, message) + + if err != nil { + return "", errors.Wrap(err, "Error sending StartJobUpdate command to Aurora Scheduler") + } + + return response.String(), nil +} + +func (r *Realis) AbortJobUpdate( + key *aurora.JobKey, + updateId string, + message string) (string, error) { + + response, err := r.client.AbortJobUpdate(&aurora.JobUpdateKey{key, updateId}, message) + + if err != nil { + return "", errors.Wrap(err, "Error sending AbortJobUpdate command to Aurora Scheduler") + } + + return response.String(), nil +} + +// Scale up the number of instances under a job configuration +func (r *Realis) AddInstances(key *aurora.JobKey, count int32) (string, error) { + + //Scale up using the config from task 0. All tasks should be homogeneous. + instKey := &aurora.InstanceKey{key, 0} + + response, err := r.client.AddInstances(instKey, count) + + if err != nil { + return "", errors.Wrap(err, "Error sending AddInstances command to Aurora Scheduler") + } + + return response.String(), nil + +} diff --git a/updatejob.go b/updatejob.go new file mode 100644 index 0000000..2ba0729 --- /dev/null +++ b/updatejob.go @@ -0,0 +1,84 @@ +/** + * 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 "gen-go/apache/aurora" + +type UpdateJob struct { + *Job //Go Embedding, SetInstanceCount for job is hidden + req *aurora.JobUpdateRequest +} + +func NewUpdateJob(job *Job) *UpdateJob { + + req := aurora.NewJobUpdateRequest() + req.TaskConfig = job.jobConfig.TaskConfig + req.Settings = aurora.NewJobUpdateSettings() + + // Mirrors defaults set by Pystachio + req.Settings.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool) + req.Settings.UpdateGroupSize = 1 + req.Settings.WaitForBatchCompletion = false + req.Settings.MinWaitInInstanceRunningMs = 45000 // Deprecated + req.Settings.MaxPerInstanceFailures = 0 + req.Settings.MaxFailedInstances = 0 + req.Settings.RollbackOnFailure = true + req.Settings.WaitForBatchCompletion = false + + //TODO(rdelvalle): Deep copy job + return &UpdateJob{job, req} +} + +func (u *UpdateJob) SetInstanceCount(inst int32) *UpdateJob { + u.req.InstanceCount = inst + return u +} + +// Max number of instances being updated at any given moment. +func (u *UpdateJob) SetBatchSize(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 +func (u *UpdateJob) SetWatchTime(milliseconds int32) *UpdateJob { + u.req.Settings.MaxPerInstanceFailures = milliseconds + return u +} + +// Wait for all instances in a group to be done before moving on +func (u *UpdateJob) SetWaitForBatchCompletion(batchWait bool) *UpdateJob { + u.req.Settings.WaitForBatchCompletion = batchWait + return u +} + +// Max number of instance failures to tolerate before marking instance as FAILED. +func (u *UpdateJob) SetMaxPerInstanceFailures(inst int32) *UpdateJob { + u.req.Settings.MaxPerInstanceFailures = inst + return u +} + +// Max number of FAILED instances to tolerate before terminating the update. +func (u *UpdateJob) SetMaxFailedInstances(inst int32) *UpdateJob { + + u.req.Settings.MaxFailedInstances = inst + return u +} + +// When False, prevents auto rollback of a failed update +func (u *UpdateJob) SetRollbackOnFail(rollback bool) *UpdateJob { + + u.req.Settings.RollbackOnFailure = rollback + return u +} diff --git a/vendor/errors/errors.go b/vendor/errors/errors.go new file mode 100644 index 0000000..3085a79 --- /dev/null +++ b/vendor/errors/errors.go @@ -0,0 +1,20 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errors implements functions to manipulate errors. +package errors + +// New returns an error that formats as the given text. +func New(text string) error { + return &errorString{text} +} + +// errorString is a trivial implementation of error. +type errorString struct { + s string +} + +func (e *errorString) Error() string { + return e.s +} diff --git a/vendor/errors/errors_test.go b/vendor/errors/errors_test.go new file mode 100644 index 0000000..63c05d7 --- /dev/null +++ b/vendor/errors/errors_test.go @@ -0,0 +1,53 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package errors_test + +import ( + "errors" + "fmt" + "testing" +) + +func TestNewEqual(t *testing.T) { + // Different allocations should not be equal. + if errors.New("abc") == errors.New("abc") { + t.Errorf(`New("abc") == New("abc")`) + } + if errors.New("abc") == errors.New("xyz") { + t.Errorf(`New("abc") == New("xyz")`) + } + + // Same allocation should be equal to itself (not crash). + err := errors.New("jkl") + if err != err { + t.Errorf(`err != err`) + } +} + +func TestErrorMethod(t *testing.T) { + err := errors.New("abc") + if err.Error() != "abc" { + t.Errorf(`New("abc").Error() = %q, want %q`, err.Error(), "abc") + } +} + +func ExampleNew() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } + // Output: emit macho dwarf: elf header corrupted +} + +// The fmt package's Errorf function lets us use the package's formatting +// features to create descriptive error messages. +func ExampleNew_errorf() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } + // Output: user "bimmler" (id 17) not found +} diff --git a/vendor/errors/example_test.go b/vendor/errors/example_test.go new file mode 100644 index 0000000..0e86828 --- /dev/null +++ b/vendor/errors/example_test.go @@ -0,0 +1,34 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package errors_test + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func Example() { + if err := oops(); err != nil { + fmt.Println(err) + } + // Output: 1989-03-15 22:30:00 +0000 UTC: the file system has gone away +} diff --git a/vendor/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go b/vendor/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go new file mode 100755 index 0000000..2c513d0 --- /dev/null +++ b/vendor/gen-go/apache/aurora/aurora_admin-remote/aurora_admin-remote.go @@ -0,0 +1,1055 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package main + +import ( + "apache/aurora" + "flag" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" +) + +func Usage() { + fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") + flag.PrintDefaults() + fmt.Fprintln(os.Stderr, "\nFunctions:") + fmt.Fprintln(os.Stderr, " Response setQuota(string ownerRole, ResourceAggregate quota)") + fmt.Fprintln(os.Stderr, " Response forceTaskState(string taskId, ScheduleStatus status)") + fmt.Fprintln(os.Stderr, " Response performBackup()") + fmt.Fprintln(os.Stderr, " Response listBackups()") + fmt.Fprintln(os.Stderr, " Response stageRecovery(string backupId)") + fmt.Fprintln(os.Stderr, " Response queryRecovery(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response deleteRecoveryTasks(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response commitRecovery()") + fmt.Fprintln(os.Stderr, " Response unloadRecovery()") + fmt.Fprintln(os.Stderr, " Response startMaintenance(Hosts hosts)") + fmt.Fprintln(os.Stderr, " Response drainHosts(Hosts hosts)") + fmt.Fprintln(os.Stderr, " Response maintenanceStatus(Hosts hosts)") + fmt.Fprintln(os.Stderr, " Response endMaintenance(Hosts hosts)") + fmt.Fprintln(os.Stderr, " Response snapshot()") + fmt.Fprintln(os.Stderr, " Response rewriteConfigs(RewriteConfigsRequest request)") + fmt.Fprintln(os.Stderr, " Response createJob(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response scheduleCronJob(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response descheduleCronJob(JobKey job)") + fmt.Fprintln(os.Stderr, " Response startCronJob(JobKey job)") + fmt.Fprintln(os.Stderr, " Response restartShards(JobKey job, shardIds)") + fmt.Fprintln(os.Stderr, " Response killTasks(JobKey job, instances)") + fmt.Fprintln(os.Stderr, " Response addInstances(InstanceKey key, i32 count)") + fmt.Fprintln(os.Stderr, " Response replaceCronTemplate(JobConfiguration config)") + fmt.Fprintln(os.Stderr, " Response startJobUpdate(JobUpdateRequest request, string message)") + fmt.Fprintln(os.Stderr, " Response pauseJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response resumeJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response abortJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response pulseJobUpdate(JobUpdateKey key)") + fmt.Fprintln(os.Stderr, " Response getRoleSummary()") + fmt.Fprintln(os.Stderr, " Response getJobSummary(string role)") + fmt.Fprintln(os.Stderr, " Response getTasksStatus(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getTasksWithoutConfigs(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getPendingReason(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getConfigSummary(JobKey job)") + fmt.Fprintln(os.Stderr, " Response getJobs(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response getQuota(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response populateJobConfig(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDetails(JobUpdateKey key)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDiff(JobUpdateRequest request)") + fmt.Fprintln(os.Stderr, " Response getTierConfigs()") + fmt.Fprintln(os.Stderr) + os.Exit(0) +} + +func main() { + flag.Usage = Usage + var host string + var port int + var protocol string + var urlString string + var framed bool + var useHttp bool + var parsedUrl url.URL + var trans thrift.TTransport + _ = strconv.Atoi + _ = math.Abs + flag.Usage = Usage + flag.StringVar(&host, "h", "localhost", "Specify host and port") + flag.IntVar(&port, "p", 9090, "Specify port") + flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") + flag.StringVar(&urlString, "u", "", "Specify the url") + flag.BoolVar(&framed, "framed", false, "Use framed transport") + flag.BoolVar(&useHttp, "http", false, "Use http") + flag.Parse() + + if len(urlString) > 0 { + parsedUrl, err := url.Parse(urlString) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + host = parsedUrl.Host + useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" + } else if useHttp { + _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + } + + cmd := flag.Arg(0) + var err error + if useHttp { + trans, err = thrift.NewTHttpClient(parsedUrl.String()) + } else { + portStr := fmt.Sprint(port) + if strings.Contains(host, ":") { + host, portStr, err = net.SplitHostPort(host) + if err != nil { + fmt.Fprintln(os.Stderr, "error with host:", err) + os.Exit(1) + } + } + trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) + if err != nil { + fmt.Fprintln(os.Stderr, "error resolving address:", err) + os.Exit(1) + } + if framed { + trans = thrift.NewTFramedTransport(trans) + } + } + if err != nil { + fmt.Fprintln(os.Stderr, "Error creating transport", err) + os.Exit(1) + } + defer trans.Close() + var protocolFactory thrift.TProtocolFactory + switch protocol { + case "compact": + protocolFactory = thrift.NewTCompactProtocolFactory() + break + case "simplejson": + protocolFactory = thrift.NewTSimpleJSONProtocolFactory() + break + case "json": + protocolFactory = thrift.NewTJSONProtocolFactory() + break + case "binary", "": + protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() + break + default: + fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) + Usage() + os.Exit(1) + } + client := aurora.NewAuroraAdminClientFactory(trans, protocolFactory) + if err := trans.Open(); err != nil { + fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) + os.Exit(1) + } + + switch cmd { + case "setQuota": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "SetQuota requires 2 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + arg336 := flag.Arg(2) + mbTrans337 := thrift.NewTMemoryBufferLen(len(arg336)) + defer mbTrans337.Close() + _, err338 := mbTrans337.WriteString(arg336) + if err338 != nil { + Usage() + return + } + factory339 := thrift.NewTSimpleJSONProtocolFactory() + jsProt340 := factory339.GetProtocol(mbTrans337) + argvalue1 := aurora.NewResourceAggregate() + err341 := argvalue1.Read(jsProt340) + if err341 != nil { + Usage() + return + } + value1 := argvalue1 + fmt.Print(client.SetQuota(value0, value1)) + fmt.Print("\n") + break + case "forceTaskState": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "ForceTaskState requires 2 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + tmp1, err := (strconv.Atoi(flag.Arg(2))) + if err != nil { + Usage() + return + } + argvalue1 := aurora.ScheduleStatus(tmp1) + value1 := argvalue1 + fmt.Print(client.ForceTaskState(value0, value1)) + fmt.Print("\n") + break + case "performBackup": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "PerformBackup requires 0 args") + flag.Usage() + } + fmt.Print(client.PerformBackup()) + fmt.Print("\n") + break + case "listBackups": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "ListBackups requires 0 args") + flag.Usage() + } + fmt.Print(client.ListBackups()) + fmt.Print("\n") + break + case "stageRecovery": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "StageRecovery requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.StageRecovery(value0)) + fmt.Print("\n") + break + case "queryRecovery": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "QueryRecovery requires 1 args") + flag.Usage() + } + arg344 := flag.Arg(1) + mbTrans345 := thrift.NewTMemoryBufferLen(len(arg344)) + defer mbTrans345.Close() + _, err346 := mbTrans345.WriteString(arg344) + if err346 != nil { + Usage() + return + } + factory347 := thrift.NewTSimpleJSONProtocolFactory() + jsProt348 := factory347.GetProtocol(mbTrans345) + argvalue0 := aurora.NewTaskQuery() + err349 := argvalue0.Read(jsProt348) + if err349 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.QueryRecovery(value0)) + fmt.Print("\n") + break + case "deleteRecoveryTasks": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "DeleteRecoveryTasks requires 1 args") + flag.Usage() + } + arg350 := flag.Arg(1) + mbTrans351 := thrift.NewTMemoryBufferLen(len(arg350)) + defer mbTrans351.Close() + _, err352 := mbTrans351.WriteString(arg350) + if err352 != nil { + Usage() + return + } + factory353 := thrift.NewTSimpleJSONProtocolFactory() + jsProt354 := factory353.GetProtocol(mbTrans351) + argvalue0 := aurora.NewTaskQuery() + err355 := argvalue0.Read(jsProt354) + if err355 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.DeleteRecoveryTasks(value0)) + fmt.Print("\n") + break + case "commitRecovery": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "CommitRecovery requires 0 args") + flag.Usage() + } + fmt.Print(client.CommitRecovery()) + fmt.Print("\n") + break + case "unloadRecovery": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "UnloadRecovery requires 0 args") + flag.Usage() + } + fmt.Print(client.UnloadRecovery()) + fmt.Print("\n") + break + case "startMaintenance": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "StartMaintenance requires 1 args") + flag.Usage() + } + arg356 := flag.Arg(1) + mbTrans357 := thrift.NewTMemoryBufferLen(len(arg356)) + defer mbTrans357.Close() + _, err358 := mbTrans357.WriteString(arg356) + if err358 != nil { + Usage() + return + } + factory359 := thrift.NewTSimpleJSONProtocolFactory() + jsProt360 := factory359.GetProtocol(mbTrans357) + argvalue0 := aurora.NewHosts() + err361 := argvalue0.Read(jsProt360) + if err361 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.StartMaintenance(value0)) + fmt.Print("\n") + break + case "drainHosts": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "DrainHosts requires 1 args") + flag.Usage() + } + arg362 := flag.Arg(1) + mbTrans363 := thrift.NewTMemoryBufferLen(len(arg362)) + defer mbTrans363.Close() + _, err364 := mbTrans363.WriteString(arg362) + if err364 != nil { + Usage() + return + } + factory365 := thrift.NewTSimpleJSONProtocolFactory() + jsProt366 := factory365.GetProtocol(mbTrans363) + argvalue0 := aurora.NewHosts() + err367 := argvalue0.Read(jsProt366) + if err367 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.DrainHosts(value0)) + fmt.Print("\n") + break + case "maintenanceStatus": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "MaintenanceStatus requires 1 args") + flag.Usage() + } + arg368 := flag.Arg(1) + mbTrans369 := thrift.NewTMemoryBufferLen(len(arg368)) + defer mbTrans369.Close() + _, err370 := mbTrans369.WriteString(arg368) + if err370 != nil { + Usage() + return + } + factory371 := thrift.NewTSimpleJSONProtocolFactory() + jsProt372 := factory371.GetProtocol(mbTrans369) + argvalue0 := aurora.NewHosts() + err373 := argvalue0.Read(jsProt372) + if err373 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.MaintenanceStatus(value0)) + fmt.Print("\n") + break + case "endMaintenance": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "EndMaintenance requires 1 args") + flag.Usage() + } + arg374 := flag.Arg(1) + mbTrans375 := thrift.NewTMemoryBufferLen(len(arg374)) + defer mbTrans375.Close() + _, err376 := mbTrans375.WriteString(arg374) + if err376 != nil { + Usage() + return + } + factory377 := thrift.NewTSimpleJSONProtocolFactory() + jsProt378 := factory377.GetProtocol(mbTrans375) + argvalue0 := aurora.NewHosts() + err379 := argvalue0.Read(jsProt378) + if err379 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.EndMaintenance(value0)) + fmt.Print("\n") + break + case "snapshot": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "Snapshot requires 0 args") + flag.Usage() + } + fmt.Print(client.Snapshot()) + fmt.Print("\n") + break + case "rewriteConfigs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "RewriteConfigs requires 1 args") + flag.Usage() + } + arg380 := flag.Arg(1) + mbTrans381 := thrift.NewTMemoryBufferLen(len(arg380)) + defer mbTrans381.Close() + _, err382 := mbTrans381.WriteString(arg380) + if err382 != nil { + Usage() + return + } + factory383 := thrift.NewTSimpleJSONProtocolFactory() + jsProt384 := factory383.GetProtocol(mbTrans381) + argvalue0 := aurora.NewRewriteConfigsRequest() + err385 := argvalue0.Read(jsProt384) + if err385 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.RewriteConfigs(value0)) + fmt.Print("\n") + break + case "createJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") + flag.Usage() + } + arg386 := flag.Arg(1) + mbTrans387 := thrift.NewTMemoryBufferLen(len(arg386)) + defer mbTrans387.Close() + _, err388 := mbTrans387.WriteString(arg386) + if err388 != nil { + Usage() + return + } + factory389 := thrift.NewTSimpleJSONProtocolFactory() + jsProt390 := factory389.GetProtocol(mbTrans387) + argvalue0 := aurora.NewJobConfiguration() + err391 := argvalue0.Read(jsProt390) + if err391 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.CreateJob(value0)) + fmt.Print("\n") + break + case "scheduleCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") + flag.Usage() + } + arg392 := flag.Arg(1) + mbTrans393 := thrift.NewTMemoryBufferLen(len(arg392)) + defer mbTrans393.Close() + _, err394 := mbTrans393.WriteString(arg392) + if err394 != nil { + Usage() + return + } + factory395 := thrift.NewTSimpleJSONProtocolFactory() + jsProt396 := factory395.GetProtocol(mbTrans393) + argvalue0 := aurora.NewJobConfiguration() + err397 := argvalue0.Read(jsProt396) + if err397 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.ScheduleCronJob(value0)) + fmt.Print("\n") + break + case "descheduleCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") + flag.Usage() + } + arg398 := flag.Arg(1) + mbTrans399 := thrift.NewTMemoryBufferLen(len(arg398)) + defer mbTrans399.Close() + _, err400 := mbTrans399.WriteString(arg398) + if err400 != nil { + Usage() + return + } + factory401 := thrift.NewTSimpleJSONProtocolFactory() + jsProt402 := factory401.GetProtocol(mbTrans399) + argvalue0 := aurora.NewJobKey() + err403 := argvalue0.Read(jsProt402) + if err403 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.DescheduleCronJob(value0)) + fmt.Print("\n") + break + case "startCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") + flag.Usage() + } + arg404 := flag.Arg(1) + mbTrans405 := thrift.NewTMemoryBufferLen(len(arg404)) + defer mbTrans405.Close() + _, err406 := mbTrans405.WriteString(arg404) + if err406 != nil { + Usage() + return + } + factory407 := thrift.NewTSimpleJSONProtocolFactory() + jsProt408 := factory407.GetProtocol(mbTrans405) + argvalue0 := aurora.NewJobKey() + err409 := argvalue0.Read(jsProt408) + if err409 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.StartCronJob(value0)) + fmt.Print("\n") + break + case "restartShards": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") + flag.Usage() + } + arg410 := flag.Arg(1) + mbTrans411 := thrift.NewTMemoryBufferLen(len(arg410)) + defer mbTrans411.Close() + _, err412 := mbTrans411.WriteString(arg410) + if err412 != nil { + Usage() + return + } + factory413 := thrift.NewTSimpleJSONProtocolFactory() + jsProt414 := factory413.GetProtocol(mbTrans411) + argvalue0 := aurora.NewJobKey() + err415 := argvalue0.Read(jsProt414) + if err415 != nil { + Usage() + return + } + value0 := argvalue0 + arg416 := flag.Arg(2) + mbTrans417 := thrift.NewTMemoryBufferLen(len(arg416)) + defer mbTrans417.Close() + _, err418 := mbTrans417.WriteString(arg416) + if err418 != nil { + Usage() + return + } + factory419 := thrift.NewTSimpleJSONProtocolFactory() + jsProt420 := factory419.GetProtocol(mbTrans417) + containerStruct1 := aurora.NewAuroraAdminRestartShardsArgs() + err421 := containerStruct1.ReadField2(jsProt420) + if err421 != nil { + Usage() + return + } + argvalue1 := containerStruct1.ShardIds + value1 := argvalue1 + fmt.Print(client.RestartShards(value0, value1)) + fmt.Print("\n") + break + case "killTasks": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "KillTasks requires 2 args") + flag.Usage() + } + arg422 := flag.Arg(1) + mbTrans423 := thrift.NewTMemoryBufferLen(len(arg422)) + defer mbTrans423.Close() + _, err424 := mbTrans423.WriteString(arg422) + if err424 != nil { + Usage() + return + } + factory425 := thrift.NewTSimpleJSONProtocolFactory() + jsProt426 := factory425.GetProtocol(mbTrans423) + argvalue0 := aurora.NewJobKey() + err427 := argvalue0.Read(jsProt426) + if err427 != nil { + Usage() + return + } + value0 := argvalue0 + arg428 := flag.Arg(2) + mbTrans429 := thrift.NewTMemoryBufferLen(len(arg428)) + defer mbTrans429.Close() + _, err430 := mbTrans429.WriteString(arg428) + if err430 != nil { + Usage() + return + } + factory431 := thrift.NewTSimpleJSONProtocolFactory() + jsProt432 := factory431.GetProtocol(mbTrans429) + containerStruct1 := aurora.NewAuroraAdminKillTasksArgs() + err433 := containerStruct1.ReadField2(jsProt432) + if err433 != nil { + Usage() + return + } + argvalue1 := containerStruct1.Instances + value1 := argvalue1 + fmt.Print(client.KillTasks(value0, value1)) + fmt.Print("\n") + break + case "addInstances": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") + flag.Usage() + } + arg434 := flag.Arg(1) + mbTrans435 := thrift.NewTMemoryBufferLen(len(arg434)) + defer mbTrans435.Close() + _, err436 := mbTrans435.WriteString(arg434) + if err436 != nil { + Usage() + return + } + factory437 := thrift.NewTSimpleJSONProtocolFactory() + jsProt438 := factory437.GetProtocol(mbTrans435) + argvalue0 := aurora.NewInstanceKey() + err439 := argvalue0.Read(jsProt438) + if err439 != nil { + Usage() + return + } + value0 := argvalue0 + tmp1, err440 := (strconv.Atoi(flag.Arg(2))) + if err440 != nil { + Usage() + return + } + argvalue1 := int32(tmp1) + value1 := argvalue1 + fmt.Print(client.AddInstances(value0, value1)) + fmt.Print("\n") + break + case "replaceCronTemplate": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") + flag.Usage() + } + arg441 := flag.Arg(1) + mbTrans442 := thrift.NewTMemoryBufferLen(len(arg441)) + defer mbTrans442.Close() + _, err443 := mbTrans442.WriteString(arg441) + if err443 != nil { + Usage() + return + } + factory444 := thrift.NewTSimpleJSONProtocolFactory() + jsProt445 := factory444.GetProtocol(mbTrans442) + argvalue0 := aurora.NewJobConfiguration() + err446 := argvalue0.Read(jsProt445) + if err446 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.ReplaceCronTemplate(value0)) + fmt.Print("\n") + break + case "startJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") + flag.Usage() + } + arg447 := flag.Arg(1) + mbTrans448 := thrift.NewTMemoryBufferLen(len(arg447)) + defer mbTrans448.Close() + _, err449 := mbTrans448.WriteString(arg447) + if err449 != nil { + Usage() + return + } + factory450 := thrift.NewTSimpleJSONProtocolFactory() + jsProt451 := factory450.GetProtocol(mbTrans448) + argvalue0 := aurora.NewJobUpdateRequest() + err452 := argvalue0.Read(jsProt451) + if err452 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.StartJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "pauseJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") + flag.Usage() + } + arg454 := flag.Arg(1) + mbTrans455 := thrift.NewTMemoryBufferLen(len(arg454)) + defer mbTrans455.Close() + _, err456 := mbTrans455.WriteString(arg454) + if err456 != nil { + Usage() + return + } + factory457 := thrift.NewTSimpleJSONProtocolFactory() + jsProt458 := factory457.GetProtocol(mbTrans455) + argvalue0 := aurora.NewJobUpdateKey() + err459 := argvalue0.Read(jsProt458) + if err459 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.PauseJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "resumeJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") + flag.Usage() + } + arg461 := flag.Arg(1) + mbTrans462 := thrift.NewTMemoryBufferLen(len(arg461)) + defer mbTrans462.Close() + _, err463 := mbTrans462.WriteString(arg461) + if err463 != nil { + Usage() + return + } + factory464 := thrift.NewTSimpleJSONProtocolFactory() + jsProt465 := factory464.GetProtocol(mbTrans462) + argvalue0 := aurora.NewJobUpdateKey() + err466 := argvalue0.Read(jsProt465) + if err466 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.ResumeJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "abortJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") + flag.Usage() + } + arg468 := flag.Arg(1) + mbTrans469 := thrift.NewTMemoryBufferLen(len(arg468)) + defer mbTrans469.Close() + _, err470 := mbTrans469.WriteString(arg468) + if err470 != nil { + Usage() + return + } + factory471 := thrift.NewTSimpleJSONProtocolFactory() + jsProt472 := factory471.GetProtocol(mbTrans469) + argvalue0 := aurora.NewJobUpdateKey() + err473 := argvalue0.Read(jsProt472) + if err473 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.AbortJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "pulseJobUpdate": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") + flag.Usage() + } + arg475 := flag.Arg(1) + mbTrans476 := thrift.NewTMemoryBufferLen(len(arg475)) + defer mbTrans476.Close() + _, err477 := mbTrans476.WriteString(arg475) + if err477 != nil { + Usage() + return + } + factory478 := thrift.NewTSimpleJSONProtocolFactory() + jsProt479 := factory478.GetProtocol(mbTrans476) + argvalue0 := aurora.NewJobUpdateKey() + err480 := argvalue0.Read(jsProt479) + if err480 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.PulseJobUpdate(value0)) + fmt.Print("\n") + break + case "getRoleSummary": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args") + flag.Usage() + } + fmt.Print(client.GetRoleSummary()) + fmt.Print("\n") + break + case "getJobSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobSummary(value0)) + fmt.Print("\n") + break + case "getTasksStatus": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") + flag.Usage() + } + arg482 := flag.Arg(1) + mbTrans483 := thrift.NewTMemoryBufferLen(len(arg482)) + defer mbTrans483.Close() + _, err484 := mbTrans483.WriteString(arg482) + if err484 != nil { + Usage() + return + } + factory485 := thrift.NewTSimpleJSONProtocolFactory() + jsProt486 := factory485.GetProtocol(mbTrans483) + argvalue0 := aurora.NewTaskQuery() + err487 := argvalue0.Read(jsProt486) + if err487 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksStatus(value0)) + fmt.Print("\n") + break + case "getTasksWithoutConfigs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") + flag.Usage() + } + arg488 := flag.Arg(1) + mbTrans489 := thrift.NewTMemoryBufferLen(len(arg488)) + defer mbTrans489.Close() + _, err490 := mbTrans489.WriteString(arg488) + if err490 != nil { + Usage() + return + } + factory491 := thrift.NewTSimpleJSONProtocolFactory() + jsProt492 := factory491.GetProtocol(mbTrans489) + argvalue0 := aurora.NewTaskQuery() + err493 := argvalue0.Read(jsProt492) + if err493 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksWithoutConfigs(value0)) + fmt.Print("\n") + break + case "getPendingReason": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") + flag.Usage() + } + arg494 := flag.Arg(1) + mbTrans495 := thrift.NewTMemoryBufferLen(len(arg494)) + defer mbTrans495.Close() + _, err496 := mbTrans495.WriteString(arg494) + if err496 != nil { + Usage() + return + } + factory497 := thrift.NewTSimpleJSONProtocolFactory() + jsProt498 := factory497.GetProtocol(mbTrans495) + argvalue0 := aurora.NewTaskQuery() + err499 := argvalue0.Read(jsProt498) + if err499 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetPendingReason(value0)) + fmt.Print("\n") + break + case "getConfigSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") + flag.Usage() + } + arg500 := flag.Arg(1) + mbTrans501 := thrift.NewTMemoryBufferLen(len(arg500)) + defer mbTrans501.Close() + _, err502 := mbTrans501.WriteString(arg500) + if err502 != nil { + Usage() + return + } + factory503 := thrift.NewTSimpleJSONProtocolFactory() + jsProt504 := factory503.GetProtocol(mbTrans501) + argvalue0 := aurora.NewJobKey() + err505 := argvalue0.Read(jsProt504) + if err505 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetConfigSummary(value0)) + fmt.Print("\n") + break + case "getJobs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobs requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobs(value0)) + fmt.Print("\n") + break + case "getQuota": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetQuota requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetQuota(value0)) + fmt.Print("\n") + break + case "populateJobConfig": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") + flag.Usage() + } + arg508 := flag.Arg(1) + mbTrans509 := thrift.NewTMemoryBufferLen(len(arg508)) + defer mbTrans509.Close() + _, err510 := mbTrans509.WriteString(arg508) + if err510 != nil { + Usage() + return + } + factory511 := thrift.NewTSimpleJSONProtocolFactory() + jsProt512 := factory511.GetProtocol(mbTrans509) + argvalue0 := aurora.NewJobConfiguration() + err513 := argvalue0.Read(jsProt512) + if err513 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.PopulateJobConfig(value0)) + fmt.Print("\n") + break + case "getJobUpdateSummaries": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") + flag.Usage() + } + arg514 := flag.Arg(1) + mbTrans515 := thrift.NewTMemoryBufferLen(len(arg514)) + defer mbTrans515.Close() + _, err516 := mbTrans515.WriteString(arg514) + if err516 != nil { + Usage() + return + } + factory517 := thrift.NewTSimpleJSONProtocolFactory() + jsProt518 := factory517.GetProtocol(mbTrans515) + argvalue0 := aurora.NewJobUpdateQuery() + err519 := argvalue0.Read(jsProt518) + if err519 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateSummaries(value0)) + fmt.Print("\n") + break + case "getJobUpdateDetails": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") + flag.Usage() + } + arg520 := flag.Arg(1) + mbTrans521 := thrift.NewTMemoryBufferLen(len(arg520)) + defer mbTrans521.Close() + _, err522 := mbTrans521.WriteString(arg520) + if err522 != nil { + Usage() + return + } + factory523 := thrift.NewTSimpleJSONProtocolFactory() + jsProt524 := factory523.GetProtocol(mbTrans521) + argvalue0 := aurora.NewJobUpdateKey() + err525 := argvalue0.Read(jsProt524) + if err525 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDetails(value0)) + fmt.Print("\n") + break + case "getJobUpdateDiff": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") + flag.Usage() + } + arg526 := flag.Arg(1) + mbTrans527 := thrift.NewTMemoryBufferLen(len(arg526)) + defer mbTrans527.Close() + _, err528 := mbTrans527.WriteString(arg526) + if err528 != nil { + Usage() + return + } + factory529 := thrift.NewTSimpleJSONProtocolFactory() + jsProt530 := factory529.GetProtocol(mbTrans527) + argvalue0 := aurora.NewJobUpdateRequest() + err531 := argvalue0.Read(jsProt530) + if err531 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDiff(value0)) + fmt.Print("\n") + break + case "getTierConfigs": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args") + flag.Usage() + } + fmt.Print(client.GetTierConfigs()) + fmt.Print("\n") + break + case "": + Usage() + break + default: + fmt.Fprintln(os.Stderr, "Invalid function ", cmd) + } +} diff --git a/vendor/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go b/vendor/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go new file mode 100755 index 0000000..771df5f --- /dev/null +++ b/vendor/gen-go/apache/aurora/aurora_scheduler_manager-remote/aurora_scheduler_manager-remote.go @@ -0,0 +1,771 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package main + +import ( + "apache/aurora" + "flag" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" +) + +func Usage() { + fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") + flag.PrintDefaults() + fmt.Fprintln(os.Stderr, "\nFunctions:") + fmt.Fprintln(os.Stderr, " Response createJob(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response scheduleCronJob(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response descheduleCronJob(JobKey job)") + fmt.Fprintln(os.Stderr, " Response startCronJob(JobKey job)") + fmt.Fprintln(os.Stderr, " Response restartShards(JobKey job, shardIds)") + fmt.Fprintln(os.Stderr, " Response killTasks(JobKey job, instances)") + fmt.Fprintln(os.Stderr, " Response addInstances(InstanceKey key, i32 count)") + fmt.Fprintln(os.Stderr, " Response replaceCronTemplate(JobConfiguration config)") + fmt.Fprintln(os.Stderr, " Response startJobUpdate(JobUpdateRequest request, string message)") + fmt.Fprintln(os.Stderr, " Response pauseJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response resumeJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response abortJobUpdate(JobUpdateKey key, string message)") + fmt.Fprintln(os.Stderr, " Response pulseJobUpdate(JobUpdateKey key)") + fmt.Fprintln(os.Stderr, " Response getRoleSummary()") + fmt.Fprintln(os.Stderr, " Response getJobSummary(string role)") + fmt.Fprintln(os.Stderr, " Response getTasksStatus(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getTasksWithoutConfigs(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getPendingReason(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getConfigSummary(JobKey job)") + fmt.Fprintln(os.Stderr, " Response getJobs(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response getQuota(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response populateJobConfig(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDetails(JobUpdateKey key)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDiff(JobUpdateRequest request)") + fmt.Fprintln(os.Stderr, " Response getTierConfigs()") + fmt.Fprintln(os.Stderr) + os.Exit(0) +} + +func main() { + flag.Usage = Usage + var host string + var port int + var protocol string + var urlString string + var framed bool + var useHttp bool + var parsedUrl url.URL + var trans thrift.TTransport + _ = strconv.Atoi + _ = math.Abs + flag.Usage = Usage + flag.StringVar(&host, "h", "localhost", "Specify host and port") + flag.IntVar(&port, "p", 9090, "Specify port") + flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") + flag.StringVar(&urlString, "u", "", "Specify the url") + flag.BoolVar(&framed, "framed", false, "Use framed transport") + flag.BoolVar(&useHttp, "http", false, "Use http") + flag.Parse() + + if len(urlString) > 0 { + parsedUrl, err := url.Parse(urlString) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + host = parsedUrl.Host + useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" + } else if useHttp { + _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + } + + cmd := flag.Arg(0) + var err error + if useHttp { + trans, err = thrift.NewTHttpClient(parsedUrl.String()) + } else { + portStr := fmt.Sprint(port) + if strings.Contains(host, ":") { + host, portStr, err = net.SplitHostPort(host) + if err != nil { + fmt.Fprintln(os.Stderr, "error with host:", err) + os.Exit(1) + } + } + trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) + if err != nil { + fmt.Fprintln(os.Stderr, "error resolving address:", err) + os.Exit(1) + } + if framed { + trans = thrift.NewTFramedTransport(trans) + } + } + if err != nil { + fmt.Fprintln(os.Stderr, "Error creating transport", err) + os.Exit(1) + } + defer trans.Close() + var protocolFactory thrift.TProtocolFactory + switch protocol { + case "compact": + protocolFactory = thrift.NewTCompactProtocolFactory() + break + case "simplejson": + protocolFactory = thrift.NewTSimpleJSONProtocolFactory() + break + case "json": + protocolFactory = thrift.NewTJSONProtocolFactory() + break + case "binary", "": + protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() + break + default: + fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) + Usage() + os.Exit(1) + } + client := aurora.NewAuroraSchedulerManagerClientFactory(trans, protocolFactory) + if err := trans.Open(); err != nil { + fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) + os.Exit(1) + } + + switch cmd { + case "createJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "CreateJob requires 1 args") + flag.Usage() + } + arg158 := flag.Arg(1) + mbTrans159 := thrift.NewTMemoryBufferLen(len(arg158)) + defer mbTrans159.Close() + _, err160 := mbTrans159.WriteString(arg158) + if err160 != nil { + Usage() + return + } + factory161 := thrift.NewTSimpleJSONProtocolFactory() + jsProt162 := factory161.GetProtocol(mbTrans159) + argvalue0 := aurora.NewJobConfiguration() + err163 := argvalue0.Read(jsProt162) + if err163 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.CreateJob(value0)) + fmt.Print("\n") + break + case "scheduleCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args") + flag.Usage() + } + arg164 := flag.Arg(1) + mbTrans165 := thrift.NewTMemoryBufferLen(len(arg164)) + defer mbTrans165.Close() + _, err166 := mbTrans165.WriteString(arg164) + if err166 != nil { + Usage() + return + } + factory167 := thrift.NewTSimpleJSONProtocolFactory() + jsProt168 := factory167.GetProtocol(mbTrans165) + argvalue0 := aurora.NewJobConfiguration() + err169 := argvalue0.Read(jsProt168) + if err169 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.ScheduleCronJob(value0)) + fmt.Print("\n") + break + case "descheduleCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args") + flag.Usage() + } + arg170 := flag.Arg(1) + mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170)) + defer mbTrans171.Close() + _, err172 := mbTrans171.WriteString(arg170) + if err172 != nil { + Usage() + return + } + factory173 := thrift.NewTSimpleJSONProtocolFactory() + jsProt174 := factory173.GetProtocol(mbTrans171) + argvalue0 := aurora.NewJobKey() + err175 := argvalue0.Read(jsProt174) + if err175 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.DescheduleCronJob(value0)) + fmt.Print("\n") + break + case "startCronJob": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args") + flag.Usage() + } + arg176 := flag.Arg(1) + mbTrans177 := thrift.NewTMemoryBufferLen(len(arg176)) + defer mbTrans177.Close() + _, err178 := mbTrans177.WriteString(arg176) + if err178 != nil { + Usage() + return + } + factory179 := thrift.NewTSimpleJSONProtocolFactory() + jsProt180 := factory179.GetProtocol(mbTrans177) + argvalue0 := aurora.NewJobKey() + err181 := argvalue0.Read(jsProt180) + if err181 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.StartCronJob(value0)) + fmt.Print("\n") + break + case "restartShards": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "RestartShards requires 2 args") + flag.Usage() + } + arg182 := flag.Arg(1) + mbTrans183 := thrift.NewTMemoryBufferLen(len(arg182)) + defer mbTrans183.Close() + _, err184 := mbTrans183.WriteString(arg182) + if err184 != nil { + Usage() + return + } + factory185 := thrift.NewTSimpleJSONProtocolFactory() + jsProt186 := factory185.GetProtocol(mbTrans183) + argvalue0 := aurora.NewJobKey() + err187 := argvalue0.Read(jsProt186) + if err187 != nil { + Usage() + return + } + value0 := argvalue0 + arg188 := flag.Arg(2) + mbTrans189 := thrift.NewTMemoryBufferLen(len(arg188)) + defer mbTrans189.Close() + _, err190 := mbTrans189.WriteString(arg188) + if err190 != nil { + Usage() + return + } + factory191 := thrift.NewTSimpleJSONProtocolFactory() + jsProt192 := factory191.GetProtocol(mbTrans189) + containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs() + err193 := containerStruct1.ReadField2(jsProt192) + if err193 != nil { + Usage() + return + } + argvalue1 := containerStruct1.ShardIds + value1 := argvalue1 + fmt.Print(client.RestartShards(value0, value1)) + fmt.Print("\n") + break + case "killTasks": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "KillTasks requires 2 args") + flag.Usage() + } + arg194 := flag.Arg(1) + mbTrans195 := thrift.NewTMemoryBufferLen(len(arg194)) + defer mbTrans195.Close() + _, err196 := mbTrans195.WriteString(arg194) + if err196 != nil { + Usage() + return + } + factory197 := thrift.NewTSimpleJSONProtocolFactory() + jsProt198 := factory197.GetProtocol(mbTrans195) + argvalue0 := aurora.NewJobKey() + err199 := argvalue0.Read(jsProt198) + if err199 != nil { + Usage() + return + } + value0 := argvalue0 + arg200 := flag.Arg(2) + mbTrans201 := thrift.NewTMemoryBufferLen(len(arg200)) + defer mbTrans201.Close() + _, err202 := mbTrans201.WriteString(arg200) + if err202 != nil { + Usage() + return + } + factory203 := thrift.NewTSimpleJSONProtocolFactory() + jsProt204 := factory203.GetProtocol(mbTrans201) + containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs() + err205 := containerStruct1.ReadField2(jsProt204) + if err205 != nil { + Usage() + return + } + argvalue1 := containerStruct1.Instances + value1 := argvalue1 + fmt.Print(client.KillTasks(value0, value1)) + fmt.Print("\n") + break + case "addInstances": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "AddInstances requires 2 args") + flag.Usage() + } + arg206 := flag.Arg(1) + mbTrans207 := thrift.NewTMemoryBufferLen(len(arg206)) + defer mbTrans207.Close() + _, err208 := mbTrans207.WriteString(arg206) + if err208 != nil { + Usage() + return + } + factory209 := thrift.NewTSimpleJSONProtocolFactory() + jsProt210 := factory209.GetProtocol(mbTrans207) + argvalue0 := aurora.NewInstanceKey() + err211 := argvalue0.Read(jsProt210) + if err211 != nil { + Usage() + return + } + value0 := argvalue0 + tmp1, err212 := (strconv.Atoi(flag.Arg(2))) + if err212 != nil { + Usage() + return + } + argvalue1 := int32(tmp1) + value1 := argvalue1 + fmt.Print(client.AddInstances(value0, value1)) + fmt.Print("\n") + break + case "replaceCronTemplate": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args") + flag.Usage() + } + arg213 := flag.Arg(1) + mbTrans214 := thrift.NewTMemoryBufferLen(len(arg213)) + defer mbTrans214.Close() + _, err215 := mbTrans214.WriteString(arg213) + if err215 != nil { + Usage() + return + } + factory216 := thrift.NewTSimpleJSONProtocolFactory() + jsProt217 := factory216.GetProtocol(mbTrans214) + argvalue0 := aurora.NewJobConfiguration() + err218 := argvalue0.Read(jsProt217) + if err218 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.ReplaceCronTemplate(value0)) + fmt.Print("\n") + break + case "startJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args") + flag.Usage() + } + arg219 := flag.Arg(1) + mbTrans220 := thrift.NewTMemoryBufferLen(len(arg219)) + defer mbTrans220.Close() + _, err221 := mbTrans220.WriteString(arg219) + if err221 != nil { + Usage() + return + } + factory222 := thrift.NewTSimpleJSONProtocolFactory() + jsProt223 := factory222.GetProtocol(mbTrans220) + argvalue0 := aurora.NewJobUpdateRequest() + err224 := argvalue0.Read(jsProt223) + if err224 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.StartJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "pauseJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args") + flag.Usage() + } + arg226 := flag.Arg(1) + mbTrans227 := thrift.NewTMemoryBufferLen(len(arg226)) + defer mbTrans227.Close() + _, err228 := mbTrans227.WriteString(arg226) + if err228 != nil { + Usage() + return + } + factory229 := thrift.NewTSimpleJSONProtocolFactory() + jsProt230 := factory229.GetProtocol(mbTrans227) + argvalue0 := aurora.NewJobUpdateKey() + err231 := argvalue0.Read(jsProt230) + if err231 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.PauseJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "resumeJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args") + flag.Usage() + } + arg233 := flag.Arg(1) + mbTrans234 := thrift.NewTMemoryBufferLen(len(arg233)) + defer mbTrans234.Close() + _, err235 := mbTrans234.WriteString(arg233) + if err235 != nil { + Usage() + return + } + factory236 := thrift.NewTSimpleJSONProtocolFactory() + jsProt237 := factory236.GetProtocol(mbTrans234) + argvalue0 := aurora.NewJobUpdateKey() + err238 := argvalue0.Read(jsProt237) + if err238 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.ResumeJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "abortJobUpdate": + if flag.NArg()-1 != 2 { + fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args") + flag.Usage() + } + arg240 := flag.Arg(1) + mbTrans241 := thrift.NewTMemoryBufferLen(len(arg240)) + defer mbTrans241.Close() + _, err242 := mbTrans241.WriteString(arg240) + if err242 != nil { + Usage() + return + } + factory243 := thrift.NewTSimpleJSONProtocolFactory() + jsProt244 := factory243.GetProtocol(mbTrans241) + argvalue0 := aurora.NewJobUpdateKey() + err245 := argvalue0.Read(jsProt244) + if err245 != nil { + Usage() + return + } + value0 := argvalue0 + argvalue1 := flag.Arg(2) + value1 := argvalue1 + fmt.Print(client.AbortJobUpdate(value0, value1)) + fmt.Print("\n") + break + case "pulseJobUpdate": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args") + flag.Usage() + } + arg247 := flag.Arg(1) + mbTrans248 := thrift.NewTMemoryBufferLen(len(arg247)) + defer mbTrans248.Close() + _, err249 := mbTrans248.WriteString(arg247) + if err249 != nil { + Usage() + return + } + factory250 := thrift.NewTSimpleJSONProtocolFactory() + jsProt251 := factory250.GetProtocol(mbTrans248) + argvalue0 := aurora.NewJobUpdateKey() + err252 := argvalue0.Read(jsProt251) + if err252 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.PulseJobUpdate(value0)) + fmt.Print("\n") + break + case "getRoleSummary": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args") + flag.Usage() + } + fmt.Print(client.GetRoleSummary()) + fmt.Print("\n") + break + case "getJobSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobSummary(value0)) + fmt.Print("\n") + break + case "getTasksStatus": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") + flag.Usage() + } + arg254 := flag.Arg(1) + mbTrans255 := thrift.NewTMemoryBufferLen(len(arg254)) + defer mbTrans255.Close() + _, err256 := mbTrans255.WriteString(arg254) + if err256 != nil { + Usage() + return + } + factory257 := thrift.NewTSimpleJSONProtocolFactory() + jsProt258 := factory257.GetProtocol(mbTrans255) + argvalue0 := aurora.NewTaskQuery() + err259 := argvalue0.Read(jsProt258) + if err259 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksStatus(value0)) + fmt.Print("\n") + break + case "getTasksWithoutConfigs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") + flag.Usage() + } + arg260 := flag.Arg(1) + mbTrans261 := thrift.NewTMemoryBufferLen(len(arg260)) + defer mbTrans261.Close() + _, err262 := mbTrans261.WriteString(arg260) + if err262 != nil { + Usage() + return + } + factory263 := thrift.NewTSimpleJSONProtocolFactory() + jsProt264 := factory263.GetProtocol(mbTrans261) + argvalue0 := aurora.NewTaskQuery() + err265 := argvalue0.Read(jsProt264) + if err265 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksWithoutConfigs(value0)) + fmt.Print("\n") + break + case "getPendingReason": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") + flag.Usage() + } + arg266 := flag.Arg(1) + mbTrans267 := thrift.NewTMemoryBufferLen(len(arg266)) + defer mbTrans267.Close() + _, err268 := mbTrans267.WriteString(arg266) + if err268 != nil { + Usage() + return + } + factory269 := thrift.NewTSimpleJSONProtocolFactory() + jsProt270 := factory269.GetProtocol(mbTrans267) + argvalue0 := aurora.NewTaskQuery() + err271 := argvalue0.Read(jsProt270) + if err271 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetPendingReason(value0)) + fmt.Print("\n") + break + case "getConfigSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") + flag.Usage() + } + arg272 := flag.Arg(1) + mbTrans273 := thrift.NewTMemoryBufferLen(len(arg272)) + defer mbTrans273.Close() + _, err274 := mbTrans273.WriteString(arg272) + if err274 != nil { + Usage() + return + } + factory275 := thrift.NewTSimpleJSONProtocolFactory() + jsProt276 := factory275.GetProtocol(mbTrans273) + argvalue0 := aurora.NewJobKey() + err277 := argvalue0.Read(jsProt276) + if err277 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetConfigSummary(value0)) + fmt.Print("\n") + break + case "getJobs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobs requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobs(value0)) + fmt.Print("\n") + break + case "getQuota": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetQuota requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetQuota(value0)) + fmt.Print("\n") + break + case "populateJobConfig": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") + flag.Usage() + } + arg280 := flag.Arg(1) + mbTrans281 := thrift.NewTMemoryBufferLen(len(arg280)) + defer mbTrans281.Close() + _, err282 := mbTrans281.WriteString(arg280) + if err282 != nil { + Usage() + return + } + factory283 := thrift.NewTSimpleJSONProtocolFactory() + jsProt284 := factory283.GetProtocol(mbTrans281) + argvalue0 := aurora.NewJobConfiguration() + err285 := argvalue0.Read(jsProt284) + if err285 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.PopulateJobConfig(value0)) + fmt.Print("\n") + break + case "getJobUpdateSummaries": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") + flag.Usage() + } + arg286 := flag.Arg(1) + mbTrans287 := thrift.NewTMemoryBufferLen(len(arg286)) + defer mbTrans287.Close() + _, err288 := mbTrans287.WriteString(arg286) + if err288 != nil { + Usage() + return + } + factory289 := thrift.NewTSimpleJSONProtocolFactory() + jsProt290 := factory289.GetProtocol(mbTrans287) + argvalue0 := aurora.NewJobUpdateQuery() + err291 := argvalue0.Read(jsProt290) + if err291 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateSummaries(value0)) + fmt.Print("\n") + break + case "getJobUpdateDetails": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") + flag.Usage() + } + arg292 := flag.Arg(1) + mbTrans293 := thrift.NewTMemoryBufferLen(len(arg292)) + defer mbTrans293.Close() + _, err294 := mbTrans293.WriteString(arg292) + if err294 != nil { + Usage() + return + } + factory295 := thrift.NewTSimpleJSONProtocolFactory() + jsProt296 := factory295.GetProtocol(mbTrans293) + argvalue0 := aurora.NewJobUpdateKey() + err297 := argvalue0.Read(jsProt296) + if err297 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDetails(value0)) + fmt.Print("\n") + break + case "getJobUpdateDiff": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") + flag.Usage() + } + arg298 := flag.Arg(1) + mbTrans299 := thrift.NewTMemoryBufferLen(len(arg298)) + defer mbTrans299.Close() + _, err300 := mbTrans299.WriteString(arg298) + if err300 != nil { + Usage() + return + } + factory301 := thrift.NewTSimpleJSONProtocolFactory() + jsProt302 := factory301.GetProtocol(mbTrans299) + argvalue0 := aurora.NewJobUpdateRequest() + err303 := argvalue0.Read(jsProt302) + if err303 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDiff(value0)) + fmt.Print("\n") + break + case "getTierConfigs": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args") + flag.Usage() + } + fmt.Print(client.GetTierConfigs()) + fmt.Print("\n") + break + case "": + Usage() + break + default: + fmt.Fprintln(os.Stderr, "Invalid function ", cmd) + } +} diff --git a/vendor/gen-go/apache/aurora/auroraadmin.go b/vendor/gen-go/apache/aurora/auroraadmin.go new file mode 100644 index 0000000..819cbe9 --- /dev/null +++ b/vendor/gen-go/apache/aurora/auroraadmin.go @@ -0,0 +1,4841 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package aurora + +import ( + "bytes" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = thrift.ZERO +var _ = fmt.Printf +var _ = bytes.Equal + +type AuroraAdmin interface { + AuroraSchedulerManager + + // Assign quota to a user. This will overwrite any pre-existing quota for the user. + // + // Parameters: + // - OwnerRole + // - Quota + SetQuota(ownerRole string, quota *ResourceAggregate) (r *Response, err error) + // Forces a task into a specific state. This does not guarantee the task will enter the given + // state, as the task must still transition within the bounds of the state machine. However, + // it attempts to enter that state via the state machine. + // + // Parameters: + // - TaskId + // - Status + ForceTaskState(taskId string, status ScheduleStatus) (r *Response, err error) + // Immediately writes a storage snapshot to disk. + PerformBackup() (r *Response, err error) + // Lists backups that are available for recovery. + ListBackups() (r *Response, err error) + // Loads a backup to an in-memory storage. This must precede all other recovery operations. + // + // Parameters: + // - BackupId + StageRecovery(backupId string) (r *Response, err error) + // Queries for tasks in a staged recovery. + // + // Parameters: + // - Query + QueryRecovery(query *TaskQuery) (r *Response, err error) + // Deletes tasks from a staged recovery. + // + // Parameters: + // - Query + DeleteRecoveryTasks(query *TaskQuery) (r *Response, err error) + // Commits a staged recovery, completely replacing the previous storage state. + CommitRecovery() (r *Response, err error) + // Unloads (aborts) a staged recovery. + UnloadRecovery() (r *Response, err error) + // Put the given hosts into maintenance mode. + // + // Parameters: + // - Hosts + StartMaintenance(hosts *Hosts) (r *Response, err error) + // Ask scheduler to begin moving tasks scheduled on given hosts. + // + // Parameters: + // - Hosts + DrainHosts(hosts *Hosts) (r *Response, err error) + // Retrieve the current maintenance states for a group of hosts. + // + // Parameters: + // - Hosts + MaintenanceStatus(hosts *Hosts) (r *Response, err error) + // Set the given hosts back into serving mode. + // + // Parameters: + // - Hosts + EndMaintenance(hosts *Hosts) (r *Response, err error) + // Start a storage snapshot and block until it completes. + Snapshot() (r *Response, err error) + // Forcibly rewrites the stored definition of user configurations. This is intended to be used + // in a controlled setting, primarily to migrate pieces of configurations that are opaque to the + // scheduler (e.g. executorConfig). + // The scheduler may do some validation of the rewritten configurations, but it is important + // that the caller take care to provide valid input and alter only necessary fields. + // + // Parameters: + // - Request + RewriteConfigs(request *RewriteConfigsRequest) (r *Response, err error) +} + +type AuroraAdminClient struct { + *AuroraSchedulerManagerClient +} + +func NewAuroraAdminClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AuroraAdminClient { + return &AuroraAdminClient{AuroraSchedulerManagerClient: NewAuroraSchedulerManagerClientFactory(t, f)} +} + +func NewAuroraAdminClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AuroraAdminClient { + return &AuroraAdminClient{AuroraSchedulerManagerClient: NewAuroraSchedulerManagerClientProtocol(t, iprot, oprot)} +} + +// Assign quota to a user. This will overwrite any pre-existing quota for the user. +// +// Parameters: +// - OwnerRole +// - Quota +func (p *AuroraAdminClient) SetQuota(ownerRole string, quota *ResourceAggregate) (r *Response, err error) { + if err = p.sendSetQuota(ownerRole, quota); err != nil { + return + } + return p.recvSetQuota() +} + +func (p *AuroraAdminClient) sendSetQuota(ownerRole string, quota *ResourceAggregate) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("setQuota", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminSetQuotaArgs{ + OwnerRole: ownerRole, + Quota: quota, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvSetQuota() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "setQuota" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "setQuota failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "setQuota failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error304 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error305 error + error305, err = error304.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error305 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "setQuota failed: invalid message type") + return + } + result := AuroraAdminSetQuotaResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Forces a task into a specific state. This does not guarantee the task will enter the given +// state, as the task must still transition within the bounds of the state machine. However, +// it attempts to enter that state via the state machine. +// +// Parameters: +// - TaskId +// - Status +func (p *AuroraAdminClient) ForceTaskState(taskId string, status ScheduleStatus) (r *Response, err error) { + if err = p.sendForceTaskState(taskId, status); err != nil { + return + } + return p.recvForceTaskState() +} + +func (p *AuroraAdminClient) sendForceTaskState(taskId string, status ScheduleStatus) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("forceTaskState", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminForceTaskStateArgs{ + TaskId: taskId, + Status: status, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvForceTaskState() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "forceTaskState" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "forceTaskState failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "forceTaskState failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error306 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error307 error + error307, err = error306.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error307 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "forceTaskState failed: invalid message type") + return + } + result := AuroraAdminForceTaskStateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Immediately writes a storage snapshot to disk. +func (p *AuroraAdminClient) PerformBackup() (r *Response, err error) { + if err = p.sendPerformBackup(); err != nil { + return + } + return p.recvPerformBackup() +} + +func (p *AuroraAdminClient) sendPerformBackup() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("performBackup", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminPerformBackupArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvPerformBackup() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "performBackup" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "performBackup failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "performBackup failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error308 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error309 error + error309, err = error308.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error309 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "performBackup failed: invalid message type") + return + } + result := AuroraAdminPerformBackupResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Lists backups that are available for recovery. +func (p *AuroraAdminClient) ListBackups() (r *Response, err error) { + if err = p.sendListBackups(); err != nil { + return + } + return p.recvListBackups() +} + +func (p *AuroraAdminClient) sendListBackups() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("listBackups", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminListBackupsArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvListBackups() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "listBackups" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "listBackups failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "listBackups failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error310 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error311 error + error311, err = error310.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error311 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "listBackups failed: invalid message type") + return + } + result := AuroraAdminListBackupsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Loads a backup to an in-memory storage. This must precede all other recovery operations. +// +// Parameters: +// - BackupId +func (p *AuroraAdminClient) StageRecovery(backupId string) (r *Response, err error) { + if err = p.sendStageRecovery(backupId); err != nil { + return + } + return p.recvStageRecovery() +} + +func (p *AuroraAdminClient) sendStageRecovery(backupId string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("stageRecovery", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminStageRecoveryArgs{ + BackupId: backupId, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvStageRecovery() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "stageRecovery" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "stageRecovery failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "stageRecovery failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error312 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error313 error + error313, err = error312.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error313 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "stageRecovery failed: invalid message type") + return + } + result := AuroraAdminStageRecoveryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Queries for tasks in a staged recovery. +// +// Parameters: +// - Query +func (p *AuroraAdminClient) QueryRecovery(query *TaskQuery) (r *Response, err error) { + if err = p.sendQueryRecovery(query); err != nil { + return + } + return p.recvQueryRecovery() +} + +func (p *AuroraAdminClient) sendQueryRecovery(query *TaskQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("queryRecovery", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminQueryRecoveryArgs{ + Query: query, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvQueryRecovery() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "queryRecovery" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "queryRecovery failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "queryRecovery failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error314 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error315 error + error315, err = error314.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error315 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "queryRecovery failed: invalid message type") + return + } + result := AuroraAdminQueryRecoveryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Deletes tasks from a staged recovery. +// +// Parameters: +// - Query +func (p *AuroraAdminClient) DeleteRecoveryTasks(query *TaskQuery) (r *Response, err error) { + if err = p.sendDeleteRecoveryTasks(query); err != nil { + return + } + return p.recvDeleteRecoveryTasks() +} + +func (p *AuroraAdminClient) sendDeleteRecoveryTasks(query *TaskQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminDeleteRecoveryTasksArgs{ + Query: query, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvDeleteRecoveryTasks() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "deleteRecoveryTasks" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "deleteRecoveryTasks failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "deleteRecoveryTasks failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error316 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error317 error + error317, err = error316.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error317 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "deleteRecoveryTasks failed: invalid message type") + return + } + result := AuroraAdminDeleteRecoveryTasksResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Commits a staged recovery, completely replacing the previous storage state. +func (p *AuroraAdminClient) CommitRecovery() (r *Response, err error) { + if err = p.sendCommitRecovery(); err != nil { + return + } + return p.recvCommitRecovery() +} + +func (p *AuroraAdminClient) sendCommitRecovery() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("commitRecovery", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminCommitRecoveryArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvCommitRecovery() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "commitRecovery" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "commitRecovery failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "commitRecovery failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error318 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error319 error + error319, err = error318.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error319 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "commitRecovery failed: invalid message type") + return + } + result := AuroraAdminCommitRecoveryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Unloads (aborts) a staged recovery. +func (p *AuroraAdminClient) UnloadRecovery() (r *Response, err error) { + if err = p.sendUnloadRecovery(); err != nil { + return + } + return p.recvUnloadRecovery() +} + +func (p *AuroraAdminClient) sendUnloadRecovery() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("unloadRecovery", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminUnloadRecoveryArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvUnloadRecovery() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "unloadRecovery" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "unloadRecovery failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "unloadRecovery failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error320 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error321 error + error321, err = error320.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error321 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "unloadRecovery failed: invalid message type") + return + } + result := AuroraAdminUnloadRecoveryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Put the given hosts into maintenance mode. +// +// Parameters: +// - Hosts +func (p *AuroraAdminClient) StartMaintenance(hosts *Hosts) (r *Response, err error) { + if err = p.sendStartMaintenance(hosts); err != nil { + return + } + return p.recvStartMaintenance() +} + +func (p *AuroraAdminClient) sendStartMaintenance(hosts *Hosts) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("startMaintenance", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminStartMaintenanceArgs{ + Hosts: hosts, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvStartMaintenance() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "startMaintenance" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "startMaintenance failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "startMaintenance failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error322 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error323 error + error323, err = error322.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error323 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "startMaintenance failed: invalid message type") + return + } + result := AuroraAdminStartMaintenanceResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Ask scheduler to begin moving tasks scheduled on given hosts. +// +// Parameters: +// - Hosts +func (p *AuroraAdminClient) DrainHosts(hosts *Hosts) (r *Response, err error) { + if err = p.sendDrainHosts(hosts); err != nil { + return + } + return p.recvDrainHosts() +} + +func (p *AuroraAdminClient) sendDrainHosts(hosts *Hosts) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("drainHosts", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminDrainHostsArgs{ + Hosts: hosts, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvDrainHosts() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "drainHosts" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "drainHosts failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "drainHosts failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error324 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error325 error + error325, err = error324.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error325 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "drainHosts failed: invalid message type") + return + } + result := AuroraAdminDrainHostsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Retrieve the current maintenance states for a group of hosts. +// +// Parameters: +// - Hosts +func (p *AuroraAdminClient) MaintenanceStatus(hosts *Hosts) (r *Response, err error) { + if err = p.sendMaintenanceStatus(hosts); err != nil { + return + } + return p.recvMaintenanceStatus() +} + +func (p *AuroraAdminClient) sendMaintenanceStatus(hosts *Hosts) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("maintenanceStatus", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminMaintenanceStatusArgs{ + Hosts: hosts, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvMaintenanceStatus() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "maintenanceStatus" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "maintenanceStatus failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "maintenanceStatus failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error326 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error327 error + error327, err = error326.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error327 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "maintenanceStatus failed: invalid message type") + return + } + result := AuroraAdminMaintenanceStatusResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Set the given hosts back into serving mode. +// +// Parameters: +// - Hosts +func (p *AuroraAdminClient) EndMaintenance(hosts *Hosts) (r *Response, err error) { + if err = p.sendEndMaintenance(hosts); err != nil { + return + } + return p.recvEndMaintenance() +} + +func (p *AuroraAdminClient) sendEndMaintenance(hosts *Hosts) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("endMaintenance", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminEndMaintenanceArgs{ + Hosts: hosts, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvEndMaintenance() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "endMaintenance" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "endMaintenance failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "endMaintenance failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error328 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error329 error + error329, err = error328.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error329 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "endMaintenance failed: invalid message type") + return + } + result := AuroraAdminEndMaintenanceResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Start a storage snapshot and block until it completes. +func (p *AuroraAdminClient) Snapshot() (r *Response, err error) { + if err = p.sendSnapshot(); err != nil { + return + } + return p.recvSnapshot() +} + +func (p *AuroraAdminClient) sendSnapshot() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("snapshot", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminSnapshotArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvSnapshot() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "snapshot" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "snapshot failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "snapshot failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error330 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error331 error + error331, err = error330.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error331 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "snapshot failed: invalid message type") + return + } + result := AuroraAdminSnapshotResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Forcibly rewrites the stored definition of user configurations. This is intended to be used +// in a controlled setting, primarily to migrate pieces of configurations that are opaque to the +// scheduler (e.g. executorConfig). +// The scheduler may do some validation of the rewritten configurations, but it is important +// that the caller take care to provide valid input and alter only necessary fields. +// +// Parameters: +// - Request +func (p *AuroraAdminClient) RewriteConfigs(request *RewriteConfigsRequest) (r *Response, err error) { + if err = p.sendRewriteConfigs(request); err != nil { + return + } + return p.recvRewriteConfigs() +} + +func (p *AuroraAdminClient) sendRewriteConfigs(request *RewriteConfigsRequest) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("rewriteConfigs", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraAdminRewriteConfigsArgs{ + Request: request, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraAdminClient) recvRewriteConfigs() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "rewriteConfigs" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "rewriteConfigs failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "rewriteConfigs failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error332 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error333 error + error333, err = error332.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error333 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "rewriteConfigs failed: invalid message type") + return + } + result := AuroraAdminRewriteConfigsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +type AuroraAdminProcessor struct { + *AuroraSchedulerManagerProcessor +} + +func NewAuroraAdminProcessor(handler AuroraAdmin) *AuroraAdminProcessor { + self334 := &AuroraAdminProcessor{NewAuroraSchedulerManagerProcessor(handler)} + self334.AddToProcessorMap("setQuota", &auroraAdminProcessorSetQuota{handler: handler}) + self334.AddToProcessorMap("forceTaskState", &auroraAdminProcessorForceTaskState{handler: handler}) + self334.AddToProcessorMap("performBackup", &auroraAdminProcessorPerformBackup{handler: handler}) + self334.AddToProcessorMap("listBackups", &auroraAdminProcessorListBackups{handler: handler}) + self334.AddToProcessorMap("stageRecovery", &auroraAdminProcessorStageRecovery{handler: handler}) + self334.AddToProcessorMap("queryRecovery", &auroraAdminProcessorQueryRecovery{handler: handler}) + self334.AddToProcessorMap("deleteRecoveryTasks", &auroraAdminProcessorDeleteRecoveryTasks{handler: handler}) + self334.AddToProcessorMap("commitRecovery", &auroraAdminProcessorCommitRecovery{handler: handler}) + self334.AddToProcessorMap("unloadRecovery", &auroraAdminProcessorUnloadRecovery{handler: handler}) + self334.AddToProcessorMap("startMaintenance", &auroraAdminProcessorStartMaintenance{handler: handler}) + self334.AddToProcessorMap("drainHosts", &auroraAdminProcessorDrainHosts{handler: handler}) + self334.AddToProcessorMap("maintenanceStatus", &auroraAdminProcessorMaintenanceStatus{handler: handler}) + self334.AddToProcessorMap("endMaintenance", &auroraAdminProcessorEndMaintenance{handler: handler}) + self334.AddToProcessorMap("snapshot", &auroraAdminProcessorSnapshot{handler: handler}) + self334.AddToProcessorMap("rewriteConfigs", &auroraAdminProcessorRewriteConfigs{handler: handler}) + return self334 +} + +type auroraAdminProcessorSetQuota struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorSetQuota) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := AuroraAdminSetQuotaArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("setQuota", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminSetQuotaResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.SetQuota(args.OwnerRole, args.Quota); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setQuota: "+err2.Error()) + oprot.WriteMessageBegin("setQuota", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorForceTaskState struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorForceTaskState) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminForceTaskStateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.ForceTaskState(args.TaskId, args.Status); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing forceTaskState: "+err2.Error()) + oprot.WriteMessageBegin("forceTaskState", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorPerformBackup struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorPerformBackup) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminPerformBackupResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.PerformBackup(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing performBackup: "+err2.Error()) + oprot.WriteMessageBegin("performBackup", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorListBackups struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorListBackups) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminListBackupsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.ListBackups(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing listBackups: "+err2.Error()) + oprot.WriteMessageBegin("listBackups", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorStageRecovery struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorStageRecovery) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminStageRecoveryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.StageRecovery(args.BackupId); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing stageRecovery: "+err2.Error()) + oprot.WriteMessageBegin("stageRecovery", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorQueryRecovery struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorQueryRecovery) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminQueryRecoveryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.QueryRecovery(args.Query); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing queryRecovery: "+err2.Error()) + oprot.WriteMessageBegin("queryRecovery", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorDeleteRecoveryTasks struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorDeleteRecoveryTasks) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminDeleteRecoveryTasksResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.DeleteRecoveryTasks(args.Query); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteRecoveryTasks: "+err2.Error()) + oprot.WriteMessageBegin("deleteRecoveryTasks", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorCommitRecovery struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorCommitRecovery) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminCommitRecoveryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.CommitRecovery(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing commitRecovery: "+err2.Error()) + oprot.WriteMessageBegin("commitRecovery", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorUnloadRecovery struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorUnloadRecovery) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminUnloadRecoveryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.UnloadRecovery(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing unloadRecovery: "+err2.Error()) + oprot.WriteMessageBegin("unloadRecovery", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorStartMaintenance struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorStartMaintenance) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminStartMaintenanceResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.StartMaintenance(args.Hosts); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startMaintenance: "+err2.Error()) + oprot.WriteMessageBegin("startMaintenance", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorDrainHosts struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorDrainHosts) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminDrainHostsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.DrainHosts(args.Hosts); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing drainHosts: "+err2.Error()) + oprot.WriteMessageBegin("drainHosts", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorMaintenanceStatus struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorMaintenanceStatus) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminMaintenanceStatusResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.MaintenanceStatus(args.Hosts); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing maintenanceStatus: "+err2.Error()) + oprot.WriteMessageBegin("maintenanceStatus", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorEndMaintenance struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorEndMaintenance) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminEndMaintenanceResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.EndMaintenance(args.Hosts); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing endMaintenance: "+err2.Error()) + oprot.WriteMessageBegin("endMaintenance", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorSnapshot struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorSnapshot) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminSnapshotResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.Snapshot(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing snapshot: "+err2.Error()) + oprot.WriteMessageBegin("snapshot", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraAdminProcessorRewriteConfigs struct { + handler AuroraAdmin +} + +func (p *auroraAdminProcessorRewriteConfigs) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := AuroraAdminRewriteConfigsArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("rewriteConfigs", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraAdminRewriteConfigsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.RewriteConfigs(args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing rewriteConfigs: "+err2.Error()) + oprot.WriteMessageBegin("rewriteConfigs", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("rewriteConfigs", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +// HELPER FUNCTIONS AND STRUCTURES + +// Attributes: +// - OwnerRole +// - Quota +type AuroraAdminSetQuotaArgs struct { + OwnerRole string `thrift:"ownerRole,1" json:"ownerRole"` + Quota *ResourceAggregate `thrift:"quota,2" json:"quota"` +} + +func NewAuroraAdminSetQuotaArgs() *AuroraAdminSetQuotaArgs { + return &AuroraAdminSetQuotaArgs{} +} + +func (p *AuroraAdminSetQuotaArgs) GetOwnerRole() string { + return p.OwnerRole +} + +var AuroraAdminSetQuotaArgs_Quota_DEFAULT *ResourceAggregate + +func (p *AuroraAdminSetQuotaArgs) GetQuota() *ResourceAggregate { + if !p.IsSetQuota() { + return AuroraAdminSetQuotaArgs_Quota_DEFAULT + } + return p.Quota +} +func (p *AuroraAdminSetQuotaArgs) IsSetQuota() bool { + return p.Quota != nil +} + +func (p *AuroraAdminSetQuotaArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.OwnerRole = v + } + return nil +} + +func (p *AuroraAdminSetQuotaArgs) readField2(iprot thrift.TProtocol) error { + p.Quota = &ResourceAggregate{} + if err := p.Quota.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) + } + if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:quota: ", p), err) + } + if err := p.Quota.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:quota: ", p), err) + } + return err +} + +func (p *AuroraAdminSetQuotaArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminSetQuotaArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminSetQuotaResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminSetQuotaResult() *AuroraAdminSetQuotaResult { + return &AuroraAdminSetQuotaResult{} +} + +var AuroraAdminSetQuotaResult_Success_DEFAULT *Response + +func (p *AuroraAdminSetQuotaResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminSetQuotaResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminSetQuotaResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminSetQuotaResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminSetQuotaResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminSetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminSetQuotaResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminSetQuotaResult(%+v)", *p) +} + +// Attributes: +// - TaskId +// - Status +type AuroraAdminForceTaskStateArgs struct { + TaskId string `thrift:"taskId,1" json:"taskId"` + Status ScheduleStatus `thrift:"status,2" json:"status"` +} + +func NewAuroraAdminForceTaskStateArgs() *AuroraAdminForceTaskStateArgs { + return &AuroraAdminForceTaskStateArgs{} +} + +func (p *AuroraAdminForceTaskStateArgs) GetTaskId() string { + return p.TaskId +} + +func (p *AuroraAdminForceTaskStateArgs) GetStatus() ScheduleStatus { + return p.Status +} +func (p *AuroraAdminForceTaskStateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.TaskId = v + } + return nil +} + +func (p *AuroraAdminForceTaskStateArgs) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + temp := ScheduleStatus(v) + p.Status = temp + } + return nil +} + +func (p *AuroraAdminForceTaskStateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("forceTaskState_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) + } + if err := oprot.WriteString(string(p.TaskId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err) + } + return err +} + +func (p *AuroraAdminForceTaskStateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminForceTaskStateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminForceTaskStateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminForceTaskStateResult() *AuroraAdminForceTaskStateResult { + return &AuroraAdminForceTaskStateResult{} +} + +var AuroraAdminForceTaskStateResult_Success_DEFAULT *Response + +func (p *AuroraAdminForceTaskStateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminForceTaskStateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminForceTaskStateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminForceTaskStateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminForceTaskStateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminForceTaskStateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminForceTaskStateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminForceTaskStateResult(%+v)", *p) +} + +type AuroraAdminPerformBackupArgs struct { +} + +func NewAuroraAdminPerformBackupArgs() *AuroraAdminPerformBackupArgs { + return &AuroraAdminPerformBackupArgs{} +} + +func (p *AuroraAdminPerformBackupArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminPerformBackupArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminPerformBackupArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminPerformBackupResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminPerformBackupResult() *AuroraAdminPerformBackupResult { + return &AuroraAdminPerformBackupResult{} +} + +var AuroraAdminPerformBackupResult_Success_DEFAULT *Response + +func (p *AuroraAdminPerformBackupResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminPerformBackupResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminPerformBackupResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminPerformBackupResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminPerformBackupResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminPerformBackupResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminPerformBackupResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminPerformBackupResult(%+v)", *p) +} + +type AuroraAdminListBackupsArgs struct { +} + +func NewAuroraAdminListBackupsArgs() *AuroraAdminListBackupsArgs { + return &AuroraAdminListBackupsArgs{} +} + +func (p *AuroraAdminListBackupsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminListBackupsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminListBackupsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminListBackupsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminListBackupsResult() *AuroraAdminListBackupsResult { + return &AuroraAdminListBackupsResult{} +} + +var AuroraAdminListBackupsResult_Success_DEFAULT *Response + +func (p *AuroraAdminListBackupsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminListBackupsResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminListBackupsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminListBackupsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminListBackupsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminListBackupsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminListBackupsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminListBackupsResult(%+v)", *p) +} + +// Attributes: +// - BackupId +type AuroraAdminStageRecoveryArgs struct { + BackupId string `thrift:"backupId,1" json:"backupId"` +} + +func NewAuroraAdminStageRecoveryArgs() *AuroraAdminStageRecoveryArgs { + return &AuroraAdminStageRecoveryArgs{} +} + +func (p *AuroraAdminStageRecoveryArgs) GetBackupId() string { + return p.BackupId +} +func (p *AuroraAdminStageRecoveryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.BackupId = v + } + return nil +} + +func (p *AuroraAdminStageRecoveryArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("stageRecovery_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:backupId: ", p), err) + } + if err := oprot.WriteString(string(p.BackupId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.backupId (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:backupId: ", p), err) + } + return err +} + +func (p *AuroraAdminStageRecoveryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminStageRecoveryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminStageRecoveryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminStageRecoveryResult() *AuroraAdminStageRecoveryResult { + return &AuroraAdminStageRecoveryResult{} +} + +var AuroraAdminStageRecoveryResult_Success_DEFAULT *Response + +func (p *AuroraAdminStageRecoveryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminStageRecoveryResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminStageRecoveryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminStageRecoveryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminStageRecoveryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminStageRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminStageRecoveryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminStageRecoveryResult(%+v)", *p) +} + +// Attributes: +// - Query +type AuroraAdminQueryRecoveryArgs struct { + Query *TaskQuery `thrift:"query,1" json:"query"` +} + +func NewAuroraAdminQueryRecoveryArgs() *AuroraAdminQueryRecoveryArgs { + return &AuroraAdminQueryRecoveryArgs{} +} + +var AuroraAdminQueryRecoveryArgs_Query_DEFAULT *TaskQuery + +func (p *AuroraAdminQueryRecoveryArgs) GetQuery() *TaskQuery { + if !p.IsSetQuery() { + return AuroraAdminQueryRecoveryArgs_Query_DEFAULT + } + return p.Query +} +func (p *AuroraAdminQueryRecoveryArgs) IsSetQuery() bool { + return p.Query != nil +} + +func (p *AuroraAdminQueryRecoveryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminQueryRecoveryArgs) readField1(iprot thrift.TProtocol) error { + p.Query = &TaskQuery{} + if err := p.Query.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) + } + if err := p.Query.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) + } + return err +} + +func (p *AuroraAdminQueryRecoveryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminQueryRecoveryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminQueryRecoveryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminQueryRecoveryResult() *AuroraAdminQueryRecoveryResult { + return &AuroraAdminQueryRecoveryResult{} +} + +var AuroraAdminQueryRecoveryResult_Success_DEFAULT *Response + +func (p *AuroraAdminQueryRecoveryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminQueryRecoveryResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminQueryRecoveryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminQueryRecoveryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminQueryRecoveryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminQueryRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminQueryRecoveryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminQueryRecoveryResult(%+v)", *p) +} + +// Attributes: +// - Query +type AuroraAdminDeleteRecoveryTasksArgs struct { + Query *TaskQuery `thrift:"query,1" json:"query"` +} + +func NewAuroraAdminDeleteRecoveryTasksArgs() *AuroraAdminDeleteRecoveryTasksArgs { + return &AuroraAdminDeleteRecoveryTasksArgs{} +} + +var AuroraAdminDeleteRecoveryTasksArgs_Query_DEFAULT *TaskQuery + +func (p *AuroraAdminDeleteRecoveryTasksArgs) GetQuery() *TaskQuery { + if !p.IsSetQuery() { + return AuroraAdminDeleteRecoveryTasksArgs_Query_DEFAULT + } + return p.Query +} +func (p *AuroraAdminDeleteRecoveryTasksArgs) IsSetQuery() bool { + return p.Query != nil +} + +func (p *AuroraAdminDeleteRecoveryTasksArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminDeleteRecoveryTasksArgs) readField1(iprot thrift.TProtocol) error { + p.Query = &TaskQuery{} + if err := p.Query.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) + } + if err := p.Query.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) + } + return err +} + +func (p *AuroraAdminDeleteRecoveryTasksArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminDeleteRecoveryTasksArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminDeleteRecoveryTasksResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminDeleteRecoveryTasksResult() *AuroraAdminDeleteRecoveryTasksResult { + return &AuroraAdminDeleteRecoveryTasksResult{} +} + +var AuroraAdminDeleteRecoveryTasksResult_Success_DEFAULT *Response + +func (p *AuroraAdminDeleteRecoveryTasksResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminDeleteRecoveryTasksResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminDeleteRecoveryTasksResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminDeleteRecoveryTasksResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminDeleteRecoveryTasksResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminDeleteRecoveryTasksResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminDeleteRecoveryTasksResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminDeleteRecoveryTasksResult(%+v)", *p) +} + +type AuroraAdminCommitRecoveryArgs struct { +} + +func NewAuroraAdminCommitRecoveryArgs() *AuroraAdminCommitRecoveryArgs { + return &AuroraAdminCommitRecoveryArgs{} +} + +func (p *AuroraAdminCommitRecoveryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminCommitRecoveryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminCommitRecoveryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminCommitRecoveryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminCommitRecoveryResult() *AuroraAdminCommitRecoveryResult { + return &AuroraAdminCommitRecoveryResult{} +} + +var AuroraAdminCommitRecoveryResult_Success_DEFAULT *Response + +func (p *AuroraAdminCommitRecoveryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminCommitRecoveryResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminCommitRecoveryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminCommitRecoveryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminCommitRecoveryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminCommitRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminCommitRecoveryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminCommitRecoveryResult(%+v)", *p) +} + +type AuroraAdminUnloadRecoveryArgs struct { +} + +func NewAuroraAdminUnloadRecoveryArgs() *AuroraAdminUnloadRecoveryArgs { + return &AuroraAdminUnloadRecoveryArgs{} +} + +func (p *AuroraAdminUnloadRecoveryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminUnloadRecoveryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminUnloadRecoveryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminUnloadRecoveryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminUnloadRecoveryResult() *AuroraAdminUnloadRecoveryResult { + return &AuroraAdminUnloadRecoveryResult{} +} + +var AuroraAdminUnloadRecoveryResult_Success_DEFAULT *Response + +func (p *AuroraAdminUnloadRecoveryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminUnloadRecoveryResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminUnloadRecoveryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminUnloadRecoveryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminUnloadRecoveryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminUnloadRecoveryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminUnloadRecoveryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminUnloadRecoveryResult(%+v)", *p) +} + +// Attributes: +// - Hosts +type AuroraAdminStartMaintenanceArgs struct { + Hosts *Hosts `thrift:"hosts,1" json:"hosts"` +} + +func NewAuroraAdminStartMaintenanceArgs() *AuroraAdminStartMaintenanceArgs { + return &AuroraAdminStartMaintenanceArgs{} +} + +var AuroraAdminStartMaintenanceArgs_Hosts_DEFAULT *Hosts + +func (p *AuroraAdminStartMaintenanceArgs) GetHosts() *Hosts { + if !p.IsSetHosts() { + return AuroraAdminStartMaintenanceArgs_Hosts_DEFAULT + } + return p.Hosts +} +func (p *AuroraAdminStartMaintenanceArgs) IsSetHosts() bool { + return p.Hosts != nil +} + +func (p *AuroraAdminStartMaintenanceArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminStartMaintenanceArgs) readField1(iprot thrift.TProtocol) error { + p.Hosts = &Hosts{} + if err := p.Hosts.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) + } + if err := p.Hosts.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) + } + return err +} + +func (p *AuroraAdminStartMaintenanceArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminStartMaintenanceArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminStartMaintenanceResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminStartMaintenanceResult() *AuroraAdminStartMaintenanceResult { + return &AuroraAdminStartMaintenanceResult{} +} + +var AuroraAdminStartMaintenanceResult_Success_DEFAULT *Response + +func (p *AuroraAdminStartMaintenanceResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminStartMaintenanceResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminStartMaintenanceResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminStartMaintenanceResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminStartMaintenanceResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminStartMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminStartMaintenanceResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminStartMaintenanceResult(%+v)", *p) +} + +// Attributes: +// - Hosts +type AuroraAdminDrainHostsArgs struct { + Hosts *Hosts `thrift:"hosts,1" json:"hosts"` +} + +func NewAuroraAdminDrainHostsArgs() *AuroraAdminDrainHostsArgs { + return &AuroraAdminDrainHostsArgs{} +} + +var AuroraAdminDrainHostsArgs_Hosts_DEFAULT *Hosts + +func (p *AuroraAdminDrainHostsArgs) GetHosts() *Hosts { + if !p.IsSetHosts() { + return AuroraAdminDrainHostsArgs_Hosts_DEFAULT + } + return p.Hosts +} +func (p *AuroraAdminDrainHostsArgs) IsSetHosts() bool { + return p.Hosts != nil +} + +func (p *AuroraAdminDrainHostsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminDrainHostsArgs) readField1(iprot thrift.TProtocol) error { + p.Hosts = &Hosts{} + if err := p.Hosts.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) + } + if err := p.Hosts.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) + } + return err +} + +func (p *AuroraAdminDrainHostsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminDrainHostsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminDrainHostsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminDrainHostsResult() *AuroraAdminDrainHostsResult { + return &AuroraAdminDrainHostsResult{} +} + +var AuroraAdminDrainHostsResult_Success_DEFAULT *Response + +func (p *AuroraAdminDrainHostsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminDrainHostsResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminDrainHostsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminDrainHostsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminDrainHostsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminDrainHostsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminDrainHostsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminDrainHostsResult(%+v)", *p) +} + +// Attributes: +// - Hosts +type AuroraAdminMaintenanceStatusArgs struct { + Hosts *Hosts `thrift:"hosts,1" json:"hosts"` +} + +func NewAuroraAdminMaintenanceStatusArgs() *AuroraAdminMaintenanceStatusArgs { + return &AuroraAdminMaintenanceStatusArgs{} +} + +var AuroraAdminMaintenanceStatusArgs_Hosts_DEFAULT *Hosts + +func (p *AuroraAdminMaintenanceStatusArgs) GetHosts() *Hosts { + if !p.IsSetHosts() { + return AuroraAdminMaintenanceStatusArgs_Hosts_DEFAULT + } + return p.Hosts +} +func (p *AuroraAdminMaintenanceStatusArgs) IsSetHosts() bool { + return p.Hosts != nil +} + +func (p *AuroraAdminMaintenanceStatusArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminMaintenanceStatusArgs) readField1(iprot thrift.TProtocol) error { + p.Hosts = &Hosts{} + if err := p.Hosts.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) + } + if err := p.Hosts.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) + } + return err +} + +func (p *AuroraAdminMaintenanceStatusArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminMaintenanceStatusArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminMaintenanceStatusResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminMaintenanceStatusResult() *AuroraAdminMaintenanceStatusResult { + return &AuroraAdminMaintenanceStatusResult{} +} + +var AuroraAdminMaintenanceStatusResult_Success_DEFAULT *Response + +func (p *AuroraAdminMaintenanceStatusResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminMaintenanceStatusResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminMaintenanceStatusResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminMaintenanceStatusResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminMaintenanceStatusResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminMaintenanceStatusResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminMaintenanceStatusResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminMaintenanceStatusResult(%+v)", *p) +} + +// Attributes: +// - Hosts +type AuroraAdminEndMaintenanceArgs struct { + Hosts *Hosts `thrift:"hosts,1" json:"hosts"` +} + +func NewAuroraAdminEndMaintenanceArgs() *AuroraAdminEndMaintenanceArgs { + return &AuroraAdminEndMaintenanceArgs{} +} + +var AuroraAdminEndMaintenanceArgs_Hosts_DEFAULT *Hosts + +func (p *AuroraAdminEndMaintenanceArgs) GetHosts() *Hosts { + if !p.IsSetHosts() { + return AuroraAdminEndMaintenanceArgs_Hosts_DEFAULT + } + return p.Hosts +} +func (p *AuroraAdminEndMaintenanceArgs) IsSetHosts() bool { + return p.Hosts != nil +} + +func (p *AuroraAdminEndMaintenanceArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminEndMaintenanceArgs) readField1(iprot thrift.TProtocol) error { + p.Hosts = &Hosts{} + if err := p.Hosts.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:hosts: ", p), err) + } + if err := p.Hosts.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hosts), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hosts: ", p), err) + } + return err +} + +func (p *AuroraAdminEndMaintenanceArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminEndMaintenanceArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminEndMaintenanceResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminEndMaintenanceResult() *AuroraAdminEndMaintenanceResult { + return &AuroraAdminEndMaintenanceResult{} +} + +var AuroraAdminEndMaintenanceResult_Success_DEFAULT *Response + +func (p *AuroraAdminEndMaintenanceResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminEndMaintenanceResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminEndMaintenanceResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminEndMaintenanceResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminEndMaintenanceResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminEndMaintenanceResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminEndMaintenanceResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminEndMaintenanceResult(%+v)", *p) +} + +type AuroraAdminSnapshotArgs struct { +} + +func NewAuroraAdminSnapshotArgs() *AuroraAdminSnapshotArgs { + return &AuroraAdminSnapshotArgs{} +} + +func (p *AuroraAdminSnapshotArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminSnapshotArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminSnapshotArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminSnapshotResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminSnapshotResult() *AuroraAdminSnapshotResult { + return &AuroraAdminSnapshotResult{} +} + +var AuroraAdminSnapshotResult_Success_DEFAULT *Response + +func (p *AuroraAdminSnapshotResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminSnapshotResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminSnapshotResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminSnapshotResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminSnapshotResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminSnapshotResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminSnapshotResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminSnapshotResult(%+v)", *p) +} + +// Attributes: +// - Request +type AuroraAdminRewriteConfigsArgs struct { + Request *RewriteConfigsRequest `thrift:"request,1" json:"request"` +} + +func NewAuroraAdminRewriteConfigsArgs() *AuroraAdminRewriteConfigsArgs { + return &AuroraAdminRewriteConfigsArgs{} +} + +var AuroraAdminRewriteConfigsArgs_Request_DEFAULT *RewriteConfigsRequest + +func (p *AuroraAdminRewriteConfigsArgs) GetRequest() *RewriteConfigsRequest { + if !p.IsSetRequest() { + return AuroraAdminRewriteConfigsArgs_Request_DEFAULT + } + return p.Request +} +func (p *AuroraAdminRewriteConfigsArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *AuroraAdminRewriteConfigsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsArgs) readField1(iprot thrift.TProtocol) error { + p.Request = &RewriteConfigsRequest{} + if err := p.Request.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Request), err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("rewriteConfigs_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Request), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:request: ", p), err) + } + return err +} + +func (p *AuroraAdminRewriteConfigsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminRewriteConfigsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraAdminRewriteConfigsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraAdminRewriteConfigsResult() *AuroraAdminRewriteConfigsResult { + return &AuroraAdminRewriteConfigsResult{} +} + +var AuroraAdminRewriteConfigsResult_Success_DEFAULT *Response + +func (p *AuroraAdminRewriteConfigsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraAdminRewriteConfigsResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraAdminRewriteConfigsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraAdminRewriteConfigsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("rewriteConfigs_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraAdminRewriteConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraAdminRewriteConfigsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraAdminRewriteConfigsResult(%+v)", *p) +} diff --git a/vendor/gen-go/apache/aurora/auroraschedulermanager.go b/vendor/gen-go/apache/aurora/auroraschedulermanager.go new file mode 100644 index 0000000..e50c795 --- /dev/null +++ b/vendor/gen-go/apache/aurora/auroraschedulermanager.go @@ -0,0 +1,4706 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package aurora + +import ( + "bytes" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = thrift.ZERO +var _ = fmt.Printf +var _ = bytes.Equal + +type AuroraSchedulerManager interface { + ReadOnlyScheduler + + // Creates a new job. The request will be denied if a job with the provided name already exists + // in the cluster. + // + // Parameters: + // - Description + CreateJob(description *JobConfiguration) (r *Response, err error) + // Enters a job into the cron schedule, without actually starting the job. + // If the job is already present in the schedule, this will update the schedule entry with the new + // configuration. + // + // Parameters: + // - Description + ScheduleCronJob(description *JobConfiguration) (r *Response, err error) + // Removes a job from the cron schedule. The request will be denied if the job was not previously + // scheduled with scheduleCronJob. + // + // Parameters: + // - Job + DescheduleCronJob(job *JobKey) (r *Response, err error) + // Starts a cron job immediately. The request will be denied if the specified job does not + // exist for the role account, or the job is not a cron job. + // + // Parameters: + // - Job + StartCronJob(job *JobKey) (r *Response, err error) + // Restarts a batch of shards. + // + // Parameters: + // - Job + // - ShardIds + RestartShards(job *JobKey, shardIds map[int32]bool) (r *Response, err error) + // Initiates a kill on tasks. + // + // Parameters: + // - Job + // - Instances + KillTasks(job *JobKey, instances map[int32]bool) (r *Response, err error) + // Adds new instances with the TaskConfig of the existing instance pointed by the key. + // + // Parameters: + // - Key + // - Count + AddInstances(key *InstanceKey, count int32) (r *Response, err error) + // Replaces the template (configuration) for the existing cron job. + // The cron job template (configuration) must exist for the call to succeed. + // + // Parameters: + // - Config + ReplaceCronTemplate(config *JobConfiguration) (r *Response, err error) + // Starts update of the existing service job. + // + // Parameters: + // - Request: A description of how to change the job. + // - Message: A user-specified message to include with the induced job update state change. + StartJobUpdate(request *JobUpdateRequest, message string) (r *Response, err error) + // Pauses the specified job update. Can be resumed by resumeUpdate call. + // + // Parameters: + // - Key: The update to pause. + // - Message: A user-specified message to include with the induced job update state change. + PauseJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) + // Resumes progress of a previously paused job update. + // + // Parameters: + // - Key: The update to resume. + // - Message: A user-specified message to include with the induced job update state change. + ResumeJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) + // Permanently aborts the job update. Does not remove the update history. + // + // Parameters: + // - Key: The update to abort. + // - Message: A user-specified message to include with the induced job update state change. + AbortJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) + // Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in + // JobUpdateSettings. Unblocks progress if the update was previously blocked. + // Responds with ResponseCode.INVALID_REQUEST in case an unknown update key is specified. + // + // Parameters: + // - Key + PulseJobUpdate(key *JobUpdateKey) (r *Response, err error) +} + +type AuroraSchedulerManagerClient struct { + *ReadOnlySchedulerClient +} + +func NewAuroraSchedulerManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AuroraSchedulerManagerClient { + return &AuroraSchedulerManagerClient{ReadOnlySchedulerClient: NewReadOnlySchedulerClientFactory(t, f)} +} + +func NewAuroraSchedulerManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AuroraSchedulerManagerClient { + return &AuroraSchedulerManagerClient{ReadOnlySchedulerClient: NewReadOnlySchedulerClientProtocol(t, iprot, oprot)} +} + +// Creates a new job. The request will be denied if a job with the provided name already exists +// in the cluster. +// +// Parameters: +// - Description +func (p *AuroraSchedulerManagerClient) CreateJob(description *JobConfiguration) (r *Response, err error) { + if err = p.sendCreateJob(description); err != nil { + return + } + return p.recvCreateJob() +} + +func (p *AuroraSchedulerManagerClient) sendCreateJob(description *JobConfiguration) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("createJob", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerCreateJobArgs{ + Description: description, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvCreateJob() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "createJob" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "createJob failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "createJob failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error129 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error130 error + error130, err = error129.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error130 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "createJob failed: invalid message type") + return + } + result := AuroraSchedulerManagerCreateJobResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Enters a job into the cron schedule, without actually starting the job. +// If the job is already present in the schedule, this will update the schedule entry with the new +// configuration. +// +// Parameters: +// - Description +func (p *AuroraSchedulerManagerClient) ScheduleCronJob(description *JobConfiguration) (r *Response, err error) { + if err = p.sendScheduleCronJob(description); err != nil { + return + } + return p.recvScheduleCronJob() +} + +func (p *AuroraSchedulerManagerClient) sendScheduleCronJob(description *JobConfiguration) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("scheduleCronJob", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerScheduleCronJobArgs{ + Description: description, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvScheduleCronJob() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "scheduleCronJob" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "scheduleCronJob failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "scheduleCronJob failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error131 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error132 error + error132, err = error131.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error132 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "scheduleCronJob failed: invalid message type") + return + } + result := AuroraSchedulerManagerScheduleCronJobResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Removes a job from the cron schedule. The request will be denied if the job was not previously +// scheduled with scheduleCronJob. +// +// Parameters: +// - Job +func (p *AuroraSchedulerManagerClient) DescheduleCronJob(job *JobKey) (r *Response, err error) { + if err = p.sendDescheduleCronJob(job); err != nil { + return + } + return p.recvDescheduleCronJob() +} + +func (p *AuroraSchedulerManagerClient) sendDescheduleCronJob(job *JobKey) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("descheduleCronJob", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerDescheduleCronJobArgs{ + Job: job, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvDescheduleCronJob() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "descheduleCronJob" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "descheduleCronJob failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "descheduleCronJob failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error133 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error134 error + error134, err = error133.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error134 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "descheduleCronJob failed: invalid message type") + return + } + result := AuroraSchedulerManagerDescheduleCronJobResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Starts a cron job immediately. The request will be denied if the specified job does not +// exist for the role account, or the job is not a cron job. +// +// Parameters: +// - Job +func (p *AuroraSchedulerManagerClient) StartCronJob(job *JobKey) (r *Response, err error) { + if err = p.sendStartCronJob(job); err != nil { + return + } + return p.recvStartCronJob() +} + +func (p *AuroraSchedulerManagerClient) sendStartCronJob(job *JobKey) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("startCronJob", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerStartCronJobArgs{ + Job: job, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvStartCronJob() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "startCronJob" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "startCronJob failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "startCronJob failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error135 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error136 error + error136, err = error135.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error136 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "startCronJob failed: invalid message type") + return + } + result := AuroraSchedulerManagerStartCronJobResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Restarts a batch of shards. +// +// Parameters: +// - Job +// - ShardIds +func (p *AuroraSchedulerManagerClient) RestartShards(job *JobKey, shardIds map[int32]bool) (r *Response, err error) { + if err = p.sendRestartShards(job, shardIds); err != nil { + return + } + return p.recvRestartShards() +} + +func (p *AuroraSchedulerManagerClient) sendRestartShards(job *JobKey, shardIds map[int32]bool) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("restartShards", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerRestartShardsArgs{ + Job: job, + ShardIds: shardIds, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvRestartShards() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "restartShards" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "restartShards failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "restartShards failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error137 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error138 error + error138, err = error137.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error138 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "restartShards failed: invalid message type") + return + } + result := AuroraSchedulerManagerRestartShardsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Initiates a kill on tasks. +// +// Parameters: +// - Job +// - Instances +func (p *AuroraSchedulerManagerClient) KillTasks(job *JobKey, instances map[int32]bool) (r *Response, err error) { + if err = p.sendKillTasks(job, instances); err != nil { + return + } + return p.recvKillTasks() +} + +func (p *AuroraSchedulerManagerClient) sendKillTasks(job *JobKey, instances map[int32]bool) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("killTasks", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerKillTasksArgs{ + Job: job, + Instances: instances, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvKillTasks() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "killTasks" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "killTasks failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "killTasks failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error139 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error140 error + error140, err = error139.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error140 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "killTasks failed: invalid message type") + return + } + result := AuroraSchedulerManagerKillTasksResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Adds new instances with the TaskConfig of the existing instance pointed by the key. +// +// Parameters: +// - Key +// - Count +func (p *AuroraSchedulerManagerClient) AddInstances(key *InstanceKey, count int32) (r *Response, err error) { + if err = p.sendAddInstances(key, count); err != nil { + return + } + return p.recvAddInstances() +} + +func (p *AuroraSchedulerManagerClient) sendAddInstances(key *InstanceKey, count int32) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("addInstances", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerAddInstancesArgs{ + Key: key, + Count: count, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvAddInstances() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "addInstances" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "addInstances failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "addInstances failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error141 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error142 error + error142, err = error141.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error142 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "addInstances failed: invalid message type") + return + } + result := AuroraSchedulerManagerAddInstancesResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Replaces the template (configuration) for the existing cron job. +// The cron job template (configuration) must exist for the call to succeed. +// +// Parameters: +// - Config +func (p *AuroraSchedulerManagerClient) ReplaceCronTemplate(config *JobConfiguration) (r *Response, err error) { + if err = p.sendReplaceCronTemplate(config); err != nil { + return + } + return p.recvReplaceCronTemplate() +} + +func (p *AuroraSchedulerManagerClient) sendReplaceCronTemplate(config *JobConfiguration) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("replaceCronTemplate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerReplaceCronTemplateArgs{ + Config: config, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvReplaceCronTemplate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "replaceCronTemplate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "replaceCronTemplate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "replaceCronTemplate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error143 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error144 error + error144, err = error143.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error144 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "replaceCronTemplate failed: invalid message type") + return + } + result := AuroraSchedulerManagerReplaceCronTemplateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Starts update of the existing service job. +// +// Parameters: +// - 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(request *JobUpdateRequest, message string) (r *Response, err error) { + if err = p.sendStartJobUpdate(request, message); err != nil { + return + } + return p.recvStartJobUpdate() +} + +func (p *AuroraSchedulerManagerClient) sendStartJobUpdate(request *JobUpdateRequest, message string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("startJobUpdate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerStartJobUpdateArgs{ + Request: request, + Message: message, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvStartJobUpdate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "startJobUpdate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "startJobUpdate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "startJobUpdate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error145 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error146 error + error146, err = error145.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error146 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "startJobUpdate failed: invalid message type") + return + } + result := AuroraSchedulerManagerStartJobUpdateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Pauses the specified job update. Can be resumed by resumeUpdate call. +// +// Parameters: +// - Key: The update to pause. +// - Message: A user-specified message to include with the induced job update state change. +func (p *AuroraSchedulerManagerClient) PauseJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) { + if err = p.sendPauseJobUpdate(key, message); err != nil { + return + } + return p.recvPauseJobUpdate() +} + +func (p *AuroraSchedulerManagerClient) sendPauseJobUpdate(key *JobUpdateKey, message string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("pauseJobUpdate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerPauseJobUpdateArgs{ + Key: key, + Message: message, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvPauseJobUpdate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "pauseJobUpdate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "pauseJobUpdate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "pauseJobUpdate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error147 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error148 error + error148, err = error147.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error148 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "pauseJobUpdate failed: invalid message type") + return + } + result := AuroraSchedulerManagerPauseJobUpdateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Resumes progress of a previously paused job update. +// +// Parameters: +// - Key: The update to resume. +// - Message: A user-specified message to include with the induced job update state change. +func (p *AuroraSchedulerManagerClient) ResumeJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) { + if err = p.sendResumeJobUpdate(key, message); err != nil { + return + } + return p.recvResumeJobUpdate() +} + +func (p *AuroraSchedulerManagerClient) sendResumeJobUpdate(key *JobUpdateKey, message string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("resumeJobUpdate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerResumeJobUpdateArgs{ + Key: key, + Message: message, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvResumeJobUpdate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "resumeJobUpdate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "resumeJobUpdate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "resumeJobUpdate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error149 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error150 error + error150, err = error149.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error150 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "resumeJobUpdate failed: invalid message type") + return + } + result := AuroraSchedulerManagerResumeJobUpdateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Permanently aborts the job update. Does not remove the update history. +// +// Parameters: +// - Key: The update to abort. +// - Message: A user-specified message to include with the induced job update state change. +func (p *AuroraSchedulerManagerClient) AbortJobUpdate(key *JobUpdateKey, message string) (r *Response, err error) { + if err = p.sendAbortJobUpdate(key, message); err != nil { + return + } + return p.recvAbortJobUpdate() +} + +func (p *AuroraSchedulerManagerClient) sendAbortJobUpdate(key *JobUpdateKey, message string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("abortJobUpdate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerAbortJobUpdateArgs{ + Key: key, + Message: message, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvAbortJobUpdate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "abortJobUpdate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "abortJobUpdate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "abortJobUpdate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error151 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error152 error + error152, err = error151.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error152 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "abortJobUpdate failed: invalid message type") + return + } + result := AuroraSchedulerManagerAbortJobUpdateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Allows progress of the job update in case blockIfNoPulsesAfterMs is specified in +// JobUpdateSettings. Unblocks progress if the update was previously blocked. +// Responds with ResponseCode.INVALID_REQUEST in case an unknown update key is specified. +// +// Parameters: +// - Key +func (p *AuroraSchedulerManagerClient) PulseJobUpdate(key *JobUpdateKey) (r *Response, err error) { + if err = p.sendPulseJobUpdate(key); err != nil { + return + } + return p.recvPulseJobUpdate() +} + +func (p *AuroraSchedulerManagerClient) sendPulseJobUpdate(key *JobUpdateKey) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("pulseJobUpdate", thrift.CALL, p.SeqId); err != nil { + return + } + args := AuroraSchedulerManagerPulseJobUpdateArgs{ + Key: key, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *AuroraSchedulerManagerClient) recvPulseJobUpdate() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "pulseJobUpdate" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "pulseJobUpdate failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "pulseJobUpdate failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error153 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error154 error + error154, err = error153.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error154 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "pulseJobUpdate failed: invalid message type") + return + } + result := AuroraSchedulerManagerPulseJobUpdateResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +type AuroraSchedulerManagerProcessor struct { + *ReadOnlySchedulerProcessor +} + +func NewAuroraSchedulerManagerProcessor(handler AuroraSchedulerManager) *AuroraSchedulerManagerProcessor { + self155 := &AuroraSchedulerManagerProcessor{NewReadOnlySchedulerProcessor(handler)} + self155.AddToProcessorMap("createJob", &auroraSchedulerManagerProcessorCreateJob{handler: handler}) + self155.AddToProcessorMap("scheduleCronJob", &auroraSchedulerManagerProcessorScheduleCronJob{handler: handler}) + self155.AddToProcessorMap("descheduleCronJob", &auroraSchedulerManagerProcessorDescheduleCronJob{handler: handler}) + self155.AddToProcessorMap("startCronJob", &auroraSchedulerManagerProcessorStartCronJob{handler: handler}) + self155.AddToProcessorMap("restartShards", &auroraSchedulerManagerProcessorRestartShards{handler: handler}) + self155.AddToProcessorMap("killTasks", &auroraSchedulerManagerProcessorKillTasks{handler: handler}) + self155.AddToProcessorMap("addInstances", &auroraSchedulerManagerProcessorAddInstances{handler: handler}) + self155.AddToProcessorMap("replaceCronTemplate", &auroraSchedulerManagerProcessorReplaceCronTemplate{handler: handler}) + self155.AddToProcessorMap("startJobUpdate", &auroraSchedulerManagerProcessorStartJobUpdate{handler: handler}) + self155.AddToProcessorMap("pauseJobUpdate", &auroraSchedulerManagerProcessorPauseJobUpdate{handler: handler}) + self155.AddToProcessorMap("resumeJobUpdate", &auroraSchedulerManagerProcessorResumeJobUpdate{handler: handler}) + self155.AddToProcessorMap("abortJobUpdate", &auroraSchedulerManagerProcessorAbortJobUpdate{handler: handler}) + self155.AddToProcessorMap("pulseJobUpdate", &auroraSchedulerManagerProcessorPulseJobUpdate{handler: handler}) + return self155 +} + +type auroraSchedulerManagerProcessorCreateJob struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorCreateJob) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerCreateJobResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.CreateJob(args.Description); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createJob: "+err2.Error()) + oprot.WriteMessageBegin("createJob", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorScheduleCronJob struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorScheduleCronJob) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerScheduleCronJobResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.ScheduleCronJob(args.Description); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing scheduleCronJob: "+err2.Error()) + oprot.WriteMessageBegin("scheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorDescheduleCronJob struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorDescheduleCronJob) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerDescheduleCronJobResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.DescheduleCronJob(args.Job); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing descheduleCronJob: "+err2.Error()) + oprot.WriteMessageBegin("descheduleCronJob", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorStartCronJob struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorStartCronJob) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerStartCronJobResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.StartCronJob(args.Job); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startCronJob: "+err2.Error()) + oprot.WriteMessageBegin("startCronJob", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorRestartShards struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorRestartShards) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerRestartShardsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.RestartShards(args.Job, args.ShardIds); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing restartShards: "+err2.Error()) + oprot.WriteMessageBegin("restartShards", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorKillTasks struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorKillTasks) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerKillTasksResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.KillTasks(args.Job, args.Instances); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing killTasks: "+err2.Error()) + oprot.WriteMessageBegin("killTasks", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorAddInstances struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorAddInstances) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerAddInstancesResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.AddInstances(args.Key, args.Count); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing addInstances: "+err2.Error()) + oprot.WriteMessageBegin("addInstances", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorReplaceCronTemplate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorReplaceCronTemplate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerReplaceCronTemplateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.ReplaceCronTemplate(args.Config); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing replaceCronTemplate: "+err2.Error()) + oprot.WriteMessageBegin("replaceCronTemplate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorStartJobUpdate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorStartJobUpdate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerStartJobUpdateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.StartJobUpdate(args.Request, args.Message); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startJobUpdate: "+err2.Error()) + oprot.WriteMessageBegin("startJobUpdate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorPauseJobUpdate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorPauseJobUpdate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerPauseJobUpdateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.PauseJobUpdate(args.Key, args.Message); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pauseJobUpdate: "+err2.Error()) + oprot.WriteMessageBegin("pauseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorResumeJobUpdate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorResumeJobUpdate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerResumeJobUpdateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.ResumeJobUpdate(args.Key, args.Message); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing resumeJobUpdate: "+err2.Error()) + oprot.WriteMessageBegin("resumeJobUpdate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorAbortJobUpdate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorAbortJobUpdate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerAbortJobUpdateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.AbortJobUpdate(args.Key, args.Message); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing abortJobUpdate: "+err2.Error()) + oprot.WriteMessageBegin("abortJobUpdate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type auroraSchedulerManagerProcessorPulseJobUpdate struct { + handler AuroraSchedulerManager +} + +func (p *auroraSchedulerManagerProcessorPulseJobUpdate) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := AuroraSchedulerManagerPulseJobUpdateResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.PulseJobUpdate(args.Key); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing pulseJobUpdate: "+err2.Error()) + oprot.WriteMessageBegin("pulseJobUpdate", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +// HELPER FUNCTIONS AND STRUCTURES + +// Attributes: +// - Description +type AuroraSchedulerManagerCreateJobArgs struct { + Description *JobConfiguration `thrift:"description,1" json:"description"` +} + +func NewAuroraSchedulerManagerCreateJobArgs() *AuroraSchedulerManagerCreateJobArgs { + return &AuroraSchedulerManagerCreateJobArgs{} +} + +var AuroraSchedulerManagerCreateJobArgs_Description_DEFAULT *JobConfiguration + +func (p *AuroraSchedulerManagerCreateJobArgs) GetDescription() *JobConfiguration { + if !p.IsSetDescription() { + return AuroraSchedulerManagerCreateJobArgs_Description_DEFAULT + } + return p.Description +} +func (p *AuroraSchedulerManagerCreateJobArgs) IsSetDescription() bool { + return p.Description != nil +} + +func (p *AuroraSchedulerManagerCreateJobArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerCreateJobArgs) readField1(iprot thrift.TProtocol) error { + p.Description = &JobConfiguration{} + if err := p.Description.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) + } + if err := p.Description.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerCreateJobArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerCreateJobArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerCreateJobResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerCreateJobResult() *AuroraSchedulerManagerCreateJobResult { + return &AuroraSchedulerManagerCreateJobResult{} +} + +var AuroraSchedulerManagerCreateJobResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerCreateJobResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerCreateJobResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerCreateJobResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerCreateJobResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerCreateJobResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerCreateJobResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerCreateJobResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerCreateJobResult(%+v)", *p) +} + +// Attributes: +// - Description +type AuroraSchedulerManagerScheduleCronJobArgs struct { + Description *JobConfiguration `thrift:"description,1" json:"description"` +} + +func NewAuroraSchedulerManagerScheduleCronJobArgs() *AuroraSchedulerManagerScheduleCronJobArgs { + return &AuroraSchedulerManagerScheduleCronJobArgs{} +} + +var AuroraSchedulerManagerScheduleCronJobArgs_Description_DEFAULT *JobConfiguration + +func (p *AuroraSchedulerManagerScheduleCronJobArgs) GetDescription() *JobConfiguration { + if !p.IsSetDescription() { + return AuroraSchedulerManagerScheduleCronJobArgs_Description_DEFAULT + } + return p.Description +} +func (p *AuroraSchedulerManagerScheduleCronJobArgs) IsSetDescription() bool { + return p.Description != nil +} + +func (p *AuroraSchedulerManagerScheduleCronJobArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerScheduleCronJobArgs) readField1(iprot thrift.TProtocol) error { + p.Description = &JobConfiguration{} + if err := p.Description.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) + } + if err := p.Description.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerScheduleCronJobArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerScheduleCronJobArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerScheduleCronJobResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerScheduleCronJobResult() *AuroraSchedulerManagerScheduleCronJobResult { + return &AuroraSchedulerManagerScheduleCronJobResult{} +} + +var AuroraSchedulerManagerScheduleCronJobResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerScheduleCronJobResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerScheduleCronJobResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerScheduleCronJobResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerScheduleCronJobResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerScheduleCronJobResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerScheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerScheduleCronJobResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerScheduleCronJobResult(%+v)", *p) +} + +// Attributes: +// - Job +type AuroraSchedulerManagerDescheduleCronJobArgs struct { + // unused fields # 1 to 3 + Job *JobKey `thrift:"job,4" json:"job"` +} + +func NewAuroraSchedulerManagerDescheduleCronJobArgs() *AuroraSchedulerManagerDescheduleCronJobArgs { + return &AuroraSchedulerManagerDescheduleCronJobArgs{} +} + +var AuroraSchedulerManagerDescheduleCronJobArgs_Job_DEFAULT *JobKey + +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) GetJob() *JobKey { + if !p.IsSetJob() { + return AuroraSchedulerManagerDescheduleCronJobArgs_Job_DEFAULT + } + return p.Job +} +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) IsSetJob() bool { + return p.Job != nil +} + +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) readField4(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField4(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerDescheduleCronJobArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerDescheduleCronJobArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerDescheduleCronJobResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerDescheduleCronJobResult() *AuroraSchedulerManagerDescheduleCronJobResult { + return &AuroraSchedulerManagerDescheduleCronJobResult{} +} + +var AuroraSchedulerManagerDescheduleCronJobResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerDescheduleCronJobResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerDescheduleCronJobResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerDescheduleCronJobResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerDescheduleCronJobResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerDescheduleCronJobResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerDescheduleCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerDescheduleCronJobResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerDescheduleCronJobResult(%+v)", *p) +} + +// Attributes: +// - Job +type AuroraSchedulerManagerStartCronJobArgs struct { + // unused fields # 1 to 3 + Job *JobKey `thrift:"job,4" json:"job"` +} + +func NewAuroraSchedulerManagerStartCronJobArgs() *AuroraSchedulerManagerStartCronJobArgs { + return &AuroraSchedulerManagerStartCronJobArgs{} +} + +var AuroraSchedulerManagerStartCronJobArgs_Job_DEFAULT *JobKey + +func (p *AuroraSchedulerManagerStartCronJobArgs) GetJob() *JobKey { + if !p.IsSetJob() { + return AuroraSchedulerManagerStartCronJobArgs_Job_DEFAULT + } + return p.Job +} +func (p *AuroraSchedulerManagerStartCronJobArgs) IsSetJob() bool { + return p.Job != nil +} + +func (p *AuroraSchedulerManagerStartCronJobArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartCronJobArgs) readField4(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField4(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerStartCronJobArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerStartCronJobArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerStartCronJobResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerStartCronJobResult() *AuroraSchedulerManagerStartCronJobResult { + return &AuroraSchedulerManagerStartCronJobResult{} +} + +var AuroraSchedulerManagerStartCronJobResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerStartCronJobResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerStartCronJobResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerStartCronJobResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerStartCronJobResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartCronJobResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartCronJobResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerStartCronJobResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerStartCronJobResult(%+v)", *p) +} + +// Attributes: +// - Job +// - ShardIds +type AuroraSchedulerManagerRestartShardsArgs struct { + // unused fields # 1 to 2 + ShardIds map[int32]bool `thrift:"shardIds,3" json:"shardIds"` + // unused field # 4 + Job *JobKey `thrift:"job,5" json:"job"` +} + +func NewAuroraSchedulerManagerRestartShardsArgs() *AuroraSchedulerManagerRestartShardsArgs { + return &AuroraSchedulerManagerRestartShardsArgs{} +} + +var AuroraSchedulerManagerRestartShardsArgs_Job_DEFAULT *JobKey + +func (p *AuroraSchedulerManagerRestartShardsArgs) GetJob() *JobKey { + if !p.IsSetJob() { + return AuroraSchedulerManagerRestartShardsArgs_Job_DEFAULT + } + return p.Job +} + +func (p *AuroraSchedulerManagerRestartShardsArgs) GetShardIds() map[int32]bool { + return p.ShardIds +} +func (p *AuroraSchedulerManagerRestartShardsArgs) IsSetJob() bool { + return p.Job != nil +} + +func (p *AuroraSchedulerManagerRestartShardsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerRestartShardsArgs) readField5(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[int32]bool, size) + p.ShardIds = tSet + for i := 0; i < size; i++ { + var _elem156 int32 + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem156 = v + } + p.ShardIds[_elem156] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := p.writeField5(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.ShardIds { + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:shardIds: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerRestartShardsArgs) writeField5(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:job: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerRestartShardsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerRestartShardsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerRestartShardsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerRestartShardsResult() *AuroraSchedulerManagerRestartShardsResult { + return &AuroraSchedulerManagerRestartShardsResult{} +} + +var AuroraSchedulerManagerRestartShardsResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerRestartShardsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerRestartShardsResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerRestartShardsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerRestartShardsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerRestartShardsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerRestartShardsResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("restartShards_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerRestartShardsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerRestartShardsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerRestartShardsResult(%+v)", *p) +} + +// Attributes: +// - Job +// - Instances +type AuroraSchedulerManagerKillTasksArgs struct { + // unused fields # 1 to 3 + Job *JobKey `thrift:"job,4" json:"job"` + Instances map[int32]bool `thrift:"instances,5" json:"instances"` +} + +func NewAuroraSchedulerManagerKillTasksArgs() *AuroraSchedulerManagerKillTasksArgs { + return &AuroraSchedulerManagerKillTasksArgs{} +} + +var AuroraSchedulerManagerKillTasksArgs_Job_DEFAULT *JobKey + +func (p *AuroraSchedulerManagerKillTasksArgs) GetJob() *JobKey { + if !p.IsSetJob() { + return AuroraSchedulerManagerKillTasksArgs_Job_DEFAULT + } + return p.Job +} + +func (p *AuroraSchedulerManagerKillTasksArgs) GetInstances() map[int32]bool { + return p.Instances +} +func (p *AuroraSchedulerManagerKillTasksArgs) IsSetJob() bool { + return p.Job != nil +} + +func (p *AuroraSchedulerManagerKillTasksArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksArgs) readField4(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Job), err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksArgs) readField5(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[int32]bool, size) + p.Instances = tSet + for i := 0; i < size; i++ { + var _elem157 int32 + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem157 = v + } + p.Instances[_elem157] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("killTasks_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField4(oprot); err != nil { + return err + } + if err := p.writeField5(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksArgs) writeField4(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:job: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerKillTasksArgs) writeField5(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("instances", thrift.SET, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:instances: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.I32, len(p.Instances)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Instances { + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:instances: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerKillTasksArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerKillTasksArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerKillTasksResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerKillTasksResult() *AuroraSchedulerManagerKillTasksResult { + return &AuroraSchedulerManagerKillTasksResult{} +} + +var AuroraSchedulerManagerKillTasksResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerKillTasksResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerKillTasksResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerKillTasksResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerKillTasksResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("killTasks_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerKillTasksResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerKillTasksResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerKillTasksResult(%+v)", *p) +} + +// Attributes: +// - Key +// - Count +type AuroraSchedulerManagerAddInstancesArgs struct { + // unused fields # 1 to 2 + Key *InstanceKey `thrift:"key,3" json:"key"` + Count int32 `thrift:"count,4" json:"count"` +} + +func NewAuroraSchedulerManagerAddInstancesArgs() *AuroraSchedulerManagerAddInstancesArgs { + return &AuroraSchedulerManagerAddInstancesArgs{} +} + +var AuroraSchedulerManagerAddInstancesArgs_Key_DEFAULT *InstanceKey + +func (p *AuroraSchedulerManagerAddInstancesArgs) GetKey() *InstanceKey { + if !p.IsSetKey() { + return AuroraSchedulerManagerAddInstancesArgs_Key_DEFAULT + } + return p.Key +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) GetCount() int32 { + return p.Count +} +func (p *AuroraSchedulerManagerAddInstancesArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) readField3(iprot thrift.TProtocol) error { + p.Key = &InstanceKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.Count = v + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("addInstances_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := p.writeField4(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:key: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) writeField4(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("count", thrift.I32, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:count: ", p), err) + } + if err := oprot.WriteI32(int32(p.Count)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.count (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:count: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerAddInstancesArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerAddInstancesArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerAddInstancesResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerAddInstancesResult() *AuroraSchedulerManagerAddInstancesResult { + return &AuroraSchedulerManagerAddInstancesResult{} +} + +var AuroraSchedulerManagerAddInstancesResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerAddInstancesResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerAddInstancesResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerAddInstancesResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerAddInstancesResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("addInstances_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerAddInstancesResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerAddInstancesResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerAddInstancesResult(%+v)", *p) +} + +// Attributes: +// - Config +type AuroraSchedulerManagerReplaceCronTemplateArgs struct { + Config *JobConfiguration `thrift:"config,1" json:"config"` +} + +func NewAuroraSchedulerManagerReplaceCronTemplateArgs() *AuroraSchedulerManagerReplaceCronTemplateArgs { + return &AuroraSchedulerManagerReplaceCronTemplateArgs{} +} + +var AuroraSchedulerManagerReplaceCronTemplateArgs_Config_DEFAULT *JobConfiguration + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) GetConfig() *JobConfiguration { + if !p.IsSetConfig() { + return AuroraSchedulerManagerReplaceCronTemplateArgs_Config_DEFAULT + } + return p.Config +} +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) IsSetConfig() bool { + return p.Config != nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) readField1(iprot thrift.TProtocol) error { + p.Config = &JobConfiguration{} + if err := p.Config.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Config), err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("replaceCronTemplate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Config), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:config: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerReplaceCronTemplateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerReplaceCronTemplateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerReplaceCronTemplateResult() *AuroraSchedulerManagerReplaceCronTemplateResult { + return &AuroraSchedulerManagerReplaceCronTemplateResult{} +} + +var AuroraSchedulerManagerReplaceCronTemplateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerReplaceCronTemplateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("replaceCronTemplate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerReplaceCronTemplateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerReplaceCronTemplateResult(%+v)", *p) +} + +// Attributes: +// - Request: A description of how to change the job. +// - Message: A user-specified message to include with the induced job update state change. +type AuroraSchedulerManagerStartJobUpdateArgs struct { + Request *JobUpdateRequest `thrift:"request,1" json:"request"` + // unused field # 2 + Message string `thrift:"message,3" json:"message"` +} + +func NewAuroraSchedulerManagerStartJobUpdateArgs() *AuroraSchedulerManagerStartJobUpdateArgs { + return &AuroraSchedulerManagerStartJobUpdateArgs{} +} + +var AuroraSchedulerManagerStartJobUpdateArgs_Request_DEFAULT *JobUpdateRequest + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) GetRequest() *JobUpdateRequest { + if !p.IsSetRequest() { + return AuroraSchedulerManagerStartJobUpdateArgs_Request_DEFAULT + } + return p.Request +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) GetMessage() string { + return p.Message +} +func (p *AuroraSchedulerManagerStartJobUpdateArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) readField1(iprot thrift.TProtocol) error { + p.Request = &JobUpdateRequest{} + if err := p.Request.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Request), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("startJobUpdate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Request), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:request: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerStartJobUpdateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerStartJobUpdateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerStartJobUpdateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerStartJobUpdateResult() *AuroraSchedulerManagerStartJobUpdateResult { + return &AuroraSchedulerManagerStartJobUpdateResult{} +} + +var AuroraSchedulerManagerStartJobUpdateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerStartJobUpdateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerStartJobUpdateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerStartJobUpdateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("startJobUpdate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerStartJobUpdateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerStartJobUpdateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerStartJobUpdateResult(%+v)", *p) +} + +// Attributes: +// - Key: The update to pause. +// - Message: A user-specified message to include with the induced job update state change. +type AuroraSchedulerManagerPauseJobUpdateArgs struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` + // unused field # 2 + Message string `thrift:"message,3" json:"message"` +} + +func NewAuroraSchedulerManagerPauseJobUpdateArgs() *AuroraSchedulerManagerPauseJobUpdateArgs { + return &AuroraSchedulerManagerPauseJobUpdateArgs{} +} + +var AuroraSchedulerManagerPauseJobUpdateArgs_Key_DEFAULT *JobUpdateKey + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return AuroraSchedulerManagerPauseJobUpdateArgs_Key_DEFAULT + } + return p.Key +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) GetMessage() string { + return p.Message +} +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("pauseJobUpdate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerPauseJobUpdateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerPauseJobUpdateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerPauseJobUpdateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerPauseJobUpdateResult() *AuroraSchedulerManagerPauseJobUpdateResult { + return &AuroraSchedulerManagerPauseJobUpdateResult{} +} + +var AuroraSchedulerManagerPauseJobUpdateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerPauseJobUpdateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerPauseJobUpdateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("pauseJobUpdate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerPauseJobUpdateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerPauseJobUpdateResult(%+v)", *p) +} + +// Attributes: +// - Key: The update to resume. +// - Message: A user-specified message to include with the induced job update state change. +type AuroraSchedulerManagerResumeJobUpdateArgs struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` + // unused field # 2 + Message string `thrift:"message,3" json:"message"` +} + +func NewAuroraSchedulerManagerResumeJobUpdateArgs() *AuroraSchedulerManagerResumeJobUpdateArgs { + return &AuroraSchedulerManagerResumeJobUpdateArgs{} +} + +var AuroraSchedulerManagerResumeJobUpdateArgs_Key_DEFAULT *JobUpdateKey + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return AuroraSchedulerManagerResumeJobUpdateArgs_Key_DEFAULT + } + return p.Key +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) GetMessage() string { + return p.Message +} +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("resumeJobUpdate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerResumeJobUpdateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerResumeJobUpdateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerResumeJobUpdateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerResumeJobUpdateResult() *AuroraSchedulerManagerResumeJobUpdateResult { + return &AuroraSchedulerManagerResumeJobUpdateResult{} +} + +var AuroraSchedulerManagerResumeJobUpdateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerResumeJobUpdateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerResumeJobUpdateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("resumeJobUpdate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerResumeJobUpdateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerResumeJobUpdateResult(%+v)", *p) +} + +// Attributes: +// - Key: The update to abort. +// - Message: A user-specified message to include with the induced job update state change. +type AuroraSchedulerManagerAbortJobUpdateArgs struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` + // unused field # 2 + Message string `thrift:"message,3" json:"message"` +} + +func NewAuroraSchedulerManagerAbortJobUpdateArgs() *AuroraSchedulerManagerAbortJobUpdateArgs { + return &AuroraSchedulerManagerAbortJobUpdateArgs{} +} + +var AuroraSchedulerManagerAbortJobUpdateArgs_Key_DEFAULT *JobUpdateKey + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return AuroraSchedulerManagerAbortJobUpdateArgs_Key_DEFAULT + } + return p.Key +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) GetMessage() string { + return p.Message +} +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("abortJobUpdate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:message: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerAbortJobUpdateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerAbortJobUpdateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerAbortJobUpdateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerAbortJobUpdateResult() *AuroraSchedulerManagerAbortJobUpdateResult { + return &AuroraSchedulerManagerAbortJobUpdateResult{} +} + +var AuroraSchedulerManagerAbortJobUpdateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerAbortJobUpdateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerAbortJobUpdateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("abortJobUpdate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerAbortJobUpdateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerAbortJobUpdateResult(%+v)", *p) +} + +// Attributes: +// - Key +type AuroraSchedulerManagerPulseJobUpdateArgs struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` +} + +func NewAuroraSchedulerManagerPulseJobUpdateArgs() *AuroraSchedulerManagerPulseJobUpdateArgs { + return &AuroraSchedulerManagerPulseJobUpdateArgs{} +} + +var AuroraSchedulerManagerPulseJobUpdateArgs_Key_DEFAULT *JobUpdateKey + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return AuroraSchedulerManagerPulseJobUpdateArgs_Key_DEFAULT + } + return p.Key +} +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("pulseJobUpdate_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *AuroraSchedulerManagerPulseJobUpdateArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerPulseJobUpdateArgs(%+v)", *p) +} + +// Attributes: +// - Success +type AuroraSchedulerManagerPulseJobUpdateResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewAuroraSchedulerManagerPulseJobUpdateResult() *AuroraSchedulerManagerPulseJobUpdateResult { + return &AuroraSchedulerManagerPulseJobUpdateResult{} +} + +var AuroraSchedulerManagerPulseJobUpdateResult_Success_DEFAULT *Response + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return AuroraSchedulerManagerPulseJobUpdateResult_Success_DEFAULT + } + return p.Success +} +func (p *AuroraSchedulerManagerPulseJobUpdateResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("pulseJobUpdate_result"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *AuroraSchedulerManagerPulseJobUpdateResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AuroraSchedulerManagerPulseJobUpdateResult(%+v)", *p) +} diff --git a/vendor/gen-go/apache/aurora/constants.go b/vendor/gen-go/apache/aurora/constants.go new file mode 100644 index 0000000..c288612 --- /dev/null +++ b/vendor/gen-go/apache/aurora/constants.go @@ -0,0 +1,79 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package aurora + +import ( + "bytes" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = thrift.ZERO +var _ = fmt.Printf +var _ = bytes.Equal + +const AURORA_EXECUTOR_NAME = "AuroraExecutor" + +var ACTIVE_STATES map[ScheduleStatus]bool +var SLAVE_ASSIGNED_STATES map[ScheduleStatus]bool +var LIVE_STATES map[ScheduleStatus]bool +var TERMINAL_STATES map[ScheduleStatus]bool + +const GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$" +const GOOD_IDENTIFIER_PATTERN_JVM = "^[\\w\\-\\.]+$" +const GOOD_IDENTIFIER_PATTERN_PYTHON = "^[\\w\\-\\.]+$" + +var ACTIVE_JOB_UPDATE_STATES map[JobUpdateStatus]bool + +const BYPASS_LEADER_REDIRECT_HEADER_NAME = "Bypass-Leader-Redirect" + +func init() { + ACTIVE_STATES = map[ScheduleStatus]bool{ + 9: true, + 17: true, + 6: true, + 0: true, + 13: true, + 12: true, + 2: true, + 1: true, + 16: true, + } + + SLAVE_ASSIGNED_STATES = map[ScheduleStatus]bool{ + 9: true, + 17: true, + 6: true, + 13: true, + 12: true, + 2: true, + 1: true, + } + + LIVE_STATES = map[ScheduleStatus]bool{ + 6: true, + 13: true, + 12: true, + 17: true, + 2: true, + } + + TERMINAL_STATES = map[ScheduleStatus]bool{ + 4: true, + 3: true, + 5: true, + 7: true, + } + + ACTIVE_JOB_UPDATE_STATES = map[JobUpdateStatus]bool{ + 0: true, + 1: true, + 2: true, + 3: true, + 9: true, + 10: true, + } + +} diff --git a/vendor/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go b/vendor/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go new file mode 100755 index 0000000..dd451a2 --- /dev/null +++ b/vendor/gen-go/apache/aurora/read_only_scheduler-remote/read_only_scheduler-remote.go @@ -0,0 +1,382 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package main + +import ( + "apache/aurora" + "flag" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" + "math" + "net" + "net/url" + "os" + "strconv" + "strings" +) + +func Usage() { + fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") + flag.PrintDefaults() + fmt.Fprintln(os.Stderr, "\nFunctions:") + fmt.Fprintln(os.Stderr, " Response getRoleSummary()") + fmt.Fprintln(os.Stderr, " Response getJobSummary(string role)") + fmt.Fprintln(os.Stderr, " Response getTasksStatus(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getTasksWithoutConfigs(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getPendingReason(TaskQuery query)") + fmt.Fprintln(os.Stderr, " Response getConfigSummary(JobKey job)") + fmt.Fprintln(os.Stderr, " Response getJobs(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response getQuota(string ownerRole)") + fmt.Fprintln(os.Stderr, " Response populateJobConfig(JobConfiguration description)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDetails(JobUpdateKey key)") + fmt.Fprintln(os.Stderr, " Response getJobUpdateDiff(JobUpdateRequest request)") + fmt.Fprintln(os.Stderr, " Response getTierConfigs()") + fmt.Fprintln(os.Stderr) + os.Exit(0) +} + +func main() { + flag.Usage = Usage + var host string + var port int + var protocol string + var urlString string + var framed bool + var useHttp bool + var parsedUrl url.URL + var trans thrift.TTransport + _ = strconv.Atoi + _ = math.Abs + flag.Usage = Usage + flag.StringVar(&host, "h", "localhost", "Specify host and port") + flag.IntVar(&port, "p", 9090, "Specify port") + flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") + flag.StringVar(&urlString, "u", "", "Specify the url") + flag.BoolVar(&framed, "framed", false, "Use framed transport") + flag.BoolVar(&useHttp, "http", false, "Use http") + flag.Parse() + + if len(urlString) > 0 { + parsedUrl, err := url.Parse(urlString) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + host = parsedUrl.Host + useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" + } else if useHttp { + _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) + if err != nil { + fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) + flag.Usage() + } + } + + cmd := flag.Arg(0) + var err error + if useHttp { + trans, err = thrift.NewTHttpClient(parsedUrl.String()) + } else { + portStr := fmt.Sprint(port) + if strings.Contains(host, ":") { + host, portStr, err = net.SplitHostPort(host) + if err != nil { + fmt.Fprintln(os.Stderr, "error with host:", err) + os.Exit(1) + } + } + trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) + if err != nil { + fmt.Fprintln(os.Stderr, "error resolving address:", err) + os.Exit(1) + } + if framed { + trans = thrift.NewTFramedTransport(trans) + } + } + if err != nil { + fmt.Fprintln(os.Stderr, "Error creating transport", err) + os.Exit(1) + } + defer trans.Close() + var protocolFactory thrift.TProtocolFactory + switch protocol { + case "compact": + protocolFactory = thrift.NewTCompactProtocolFactory() + break + case "simplejson": + protocolFactory = thrift.NewTSimpleJSONProtocolFactory() + break + case "json": + protocolFactory = thrift.NewTJSONProtocolFactory() + break + case "binary", "": + protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() + break + default: + fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) + Usage() + os.Exit(1) + } + client := aurora.NewReadOnlySchedulerClientFactory(trans, protocolFactory) + if err := trans.Open(); err != nil { + fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) + os.Exit(1) + } + + switch cmd { + case "getRoleSummary": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args") + flag.Usage() + } + fmt.Print(client.GetRoleSummary()) + fmt.Print("\n") + break + case "getJobSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobSummary(value0)) + fmt.Print("\n") + break + case "getTasksStatus": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args") + flag.Usage() + } + arg79 := flag.Arg(1) + mbTrans80 := thrift.NewTMemoryBufferLen(len(arg79)) + defer mbTrans80.Close() + _, err81 := mbTrans80.WriteString(arg79) + if err81 != nil { + Usage() + return + } + factory82 := thrift.NewTSimpleJSONProtocolFactory() + jsProt83 := factory82.GetProtocol(mbTrans80) + argvalue0 := aurora.NewTaskQuery() + err84 := argvalue0.Read(jsProt83) + if err84 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksStatus(value0)) + fmt.Print("\n") + break + case "getTasksWithoutConfigs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args") + flag.Usage() + } + arg85 := flag.Arg(1) + mbTrans86 := thrift.NewTMemoryBufferLen(len(arg85)) + defer mbTrans86.Close() + _, err87 := mbTrans86.WriteString(arg85) + if err87 != nil { + Usage() + return + } + factory88 := thrift.NewTSimpleJSONProtocolFactory() + jsProt89 := factory88.GetProtocol(mbTrans86) + argvalue0 := aurora.NewTaskQuery() + err90 := argvalue0.Read(jsProt89) + if err90 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetTasksWithoutConfigs(value0)) + fmt.Print("\n") + break + case "getPendingReason": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args") + flag.Usage() + } + arg91 := flag.Arg(1) + mbTrans92 := thrift.NewTMemoryBufferLen(len(arg91)) + defer mbTrans92.Close() + _, err93 := mbTrans92.WriteString(arg91) + if err93 != nil { + Usage() + return + } + factory94 := thrift.NewTSimpleJSONProtocolFactory() + jsProt95 := factory94.GetProtocol(mbTrans92) + argvalue0 := aurora.NewTaskQuery() + err96 := argvalue0.Read(jsProt95) + if err96 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetPendingReason(value0)) + fmt.Print("\n") + break + case "getConfigSummary": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args") + flag.Usage() + } + arg97 := flag.Arg(1) + mbTrans98 := thrift.NewTMemoryBufferLen(len(arg97)) + defer mbTrans98.Close() + _, err99 := mbTrans98.WriteString(arg97) + if err99 != nil { + Usage() + return + } + factory100 := thrift.NewTSimpleJSONProtocolFactory() + jsProt101 := factory100.GetProtocol(mbTrans98) + argvalue0 := aurora.NewJobKey() + err102 := argvalue0.Read(jsProt101) + if err102 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetConfigSummary(value0)) + fmt.Print("\n") + break + case "getJobs": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobs requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetJobs(value0)) + fmt.Print("\n") + break + case "getQuota": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetQuota requires 1 args") + flag.Usage() + } + argvalue0 := flag.Arg(1) + value0 := argvalue0 + fmt.Print(client.GetQuota(value0)) + fmt.Print("\n") + break + case "populateJobConfig": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args") + flag.Usage() + } + arg105 := flag.Arg(1) + mbTrans106 := thrift.NewTMemoryBufferLen(len(arg105)) + defer mbTrans106.Close() + _, err107 := mbTrans106.WriteString(arg105) + if err107 != nil { + Usage() + return + } + factory108 := thrift.NewTSimpleJSONProtocolFactory() + jsProt109 := factory108.GetProtocol(mbTrans106) + argvalue0 := aurora.NewJobConfiguration() + err110 := argvalue0.Read(jsProt109) + if err110 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.PopulateJobConfig(value0)) + fmt.Print("\n") + break + case "getJobUpdateSummaries": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args") + flag.Usage() + } + arg111 := flag.Arg(1) + mbTrans112 := thrift.NewTMemoryBufferLen(len(arg111)) + defer mbTrans112.Close() + _, err113 := mbTrans112.WriteString(arg111) + if err113 != nil { + Usage() + return + } + factory114 := thrift.NewTSimpleJSONProtocolFactory() + jsProt115 := factory114.GetProtocol(mbTrans112) + argvalue0 := aurora.NewJobUpdateQuery() + err116 := argvalue0.Read(jsProt115) + if err116 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateSummaries(value0)) + fmt.Print("\n") + break + case "getJobUpdateDetails": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args") + flag.Usage() + } + arg117 := flag.Arg(1) + mbTrans118 := thrift.NewTMemoryBufferLen(len(arg117)) + defer mbTrans118.Close() + _, err119 := mbTrans118.WriteString(arg117) + if err119 != nil { + Usage() + return + } + factory120 := thrift.NewTSimpleJSONProtocolFactory() + jsProt121 := factory120.GetProtocol(mbTrans118) + argvalue0 := aurora.NewJobUpdateKey() + err122 := argvalue0.Read(jsProt121) + if err122 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDetails(value0)) + fmt.Print("\n") + break + case "getJobUpdateDiff": + if flag.NArg()-1 != 1 { + fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args") + flag.Usage() + } + arg123 := flag.Arg(1) + mbTrans124 := thrift.NewTMemoryBufferLen(len(arg123)) + defer mbTrans124.Close() + _, err125 := mbTrans124.WriteString(arg123) + if err125 != nil { + Usage() + return + } + factory126 := thrift.NewTSimpleJSONProtocolFactory() + jsProt127 := factory126.GetProtocol(mbTrans124) + argvalue0 := aurora.NewJobUpdateRequest() + err128 := argvalue0.Read(jsProt127) + if err128 != nil { + Usage() + return + } + value0 := argvalue0 + fmt.Print(client.GetJobUpdateDiff(value0)) + fmt.Print("\n") + break + case "getTierConfigs": + if flag.NArg()-1 != 0 { + fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args") + flag.Usage() + } + fmt.Print(client.GetTierConfigs()) + fmt.Print("\n") + break + case "": + Usage() + break + default: + fmt.Fprintln(os.Stderr, "Invalid function ", cmd) + } +} diff --git a/vendor/gen-go/apache/aurora/readonlyscheduler.go b/vendor/gen-go/apache/aurora/readonlyscheduler.go new file mode 100644 index 0000000..910a991 --- /dev/null +++ b/vendor/gen-go/apache/aurora/readonlyscheduler.go @@ -0,0 +1,4292 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package aurora + +import ( + "bytes" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = thrift.ZERO +var _ = fmt.Printf +var _ = bytes.Equal + +type ReadOnlyScheduler interface { + // Returns a summary of the jobs grouped by role. + GetRoleSummary() (r *Response, err error) + // Returns a summary of jobs, optionally only those owned by a specific role. + // + // Parameters: + // - Role + GetJobSummary(role string) (r *Response, err error) + // Fetches the status of tasks. + // + // Parameters: + // - Query + GetTasksStatus(query *TaskQuery) (r *Response, err error) + // Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set. + // This is an interim solution until we have a better way to query TaskConfigs (AURORA-541). + // + // Parameters: + // - Query + GetTasksWithoutConfigs(query *TaskQuery) (r *Response, err error) + // Returns user-friendly reasons (if available) for tasks retained in PENDING state. + // + // Parameters: + // - Query + GetPendingReason(query *TaskQuery) (r *Response, err error) + // Fetches the configuration summary of active tasks for the specified job. + // + // Parameters: + // - Job + GetConfigSummary(job *JobKey) (r *Response, err error) + // Fetches the status of jobs. + // ownerRole is optional, in which case all jobs are returned. + // + // Parameters: + // - OwnerRole + GetJobs(ownerRole string) (r *Response, err error) + // Fetches the quota allocated for a user. + // + // Parameters: + // - OwnerRole + GetQuota(ownerRole string) (r *Response, err error) + // Populates fields in a job configuration as though it were about to be run. + // This can be used to diff a configuration running tasks. + // + // Parameters: + // - Description + PopulateJobConfig(description *JobConfiguration) (r *Response, err error) + // Gets job update summaries. + // + // Parameters: + // - JobUpdateQuery + GetJobUpdateSummaries(jobUpdateQuery *JobUpdateQuery) (r *Response, err error) + // Gets job update details. + // + // Parameters: + // - Key + GetJobUpdateDetails(key *JobUpdateKey) (r *Response, err error) + // Gets the diff between client (desired) and server (current) job states. + // + // Parameters: + // - Request + GetJobUpdateDiff(request *JobUpdateRequest) (r *Response, err error) + // Gets tier configurations. + GetTierConfigs() (r *Response, err error) +} + +type ReadOnlySchedulerClient struct { + Transport thrift.TTransport + ProtocolFactory thrift.TProtocolFactory + InputProtocol thrift.TProtocol + OutputProtocol thrift.TProtocol + SeqId int32 +} + +func NewReadOnlySchedulerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ReadOnlySchedulerClient { + return &ReadOnlySchedulerClient{Transport: t, + ProtocolFactory: f, + InputProtocol: f.GetProtocol(t), + OutputProtocol: f.GetProtocol(t), + SeqId: 0, + } +} + +func NewReadOnlySchedulerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ReadOnlySchedulerClient { + return &ReadOnlySchedulerClient{Transport: t, + ProtocolFactory: nil, + InputProtocol: iprot, + OutputProtocol: oprot, + SeqId: 0, + } +} + +// Returns a summary of the jobs grouped by role. +func (p *ReadOnlySchedulerClient) GetRoleSummary() (r *Response, err error) { + if err = p.sendGetRoleSummary(); err != nil { + return + } + return p.recvGetRoleSummary() +} + +func (p *ReadOnlySchedulerClient) sendGetRoleSummary() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getRoleSummary", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetRoleSummaryArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetRoleSummary() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getRoleSummary" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getRoleSummary failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getRoleSummary failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error50 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error51 error + error51, err = error50.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error51 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getRoleSummary failed: invalid message type") + return + } + result := ReadOnlySchedulerGetRoleSummaryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Returns a summary of jobs, optionally only those owned by a specific role. +// +// Parameters: +// - Role +func (p *ReadOnlySchedulerClient) GetJobSummary(role string) (r *Response, err error) { + if err = p.sendGetJobSummary(role); err != nil { + return + } + return p.recvGetJobSummary() +} + +func (p *ReadOnlySchedulerClient) sendGetJobSummary(role string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getJobSummary", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetJobSummaryArgs{ + Role: role, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetJobSummary() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getJobSummary" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getJobSummary failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getJobSummary failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error52 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error53 error + error53, err = error52.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error53 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getJobSummary failed: invalid message type") + return + } + result := ReadOnlySchedulerGetJobSummaryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Fetches the status of tasks. +// +// Parameters: +// - Query +func (p *ReadOnlySchedulerClient) GetTasksStatus(query *TaskQuery) (r *Response, err error) { + if err = p.sendGetTasksStatus(query); err != nil { + return + } + return p.recvGetTasksStatus() +} + +func (p *ReadOnlySchedulerClient) sendGetTasksStatus(query *TaskQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getTasksStatus", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetTasksStatusArgs{ + Query: query, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetTasksStatus() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getTasksStatus" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getTasksStatus failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTasksStatus failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error54 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error55 error + error55, err = error54.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error55 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getTasksStatus failed: invalid message type") + return + } + result := ReadOnlySchedulerGetTasksStatusResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Same as getTaskStatus but without the TaskConfig.ExecutorConfig data set. +// This is an interim solution until we have a better way to query TaskConfigs (AURORA-541). +// +// Parameters: +// - Query +func (p *ReadOnlySchedulerClient) GetTasksWithoutConfigs(query *TaskQuery) (r *Response, err error) { + if err = p.sendGetTasksWithoutConfigs(query); err != nil { + return + } + return p.recvGetTasksWithoutConfigs() +} + +func (p *ReadOnlySchedulerClient) sendGetTasksWithoutConfigs(query *TaskQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetTasksWithoutConfigsArgs{ + Query: query, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetTasksWithoutConfigs() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getTasksWithoutConfigs" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getTasksWithoutConfigs failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTasksWithoutConfigs failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error56 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error57 error + error57, err = error56.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error57 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getTasksWithoutConfigs failed: invalid message type") + return + } + result := ReadOnlySchedulerGetTasksWithoutConfigsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Returns user-friendly reasons (if available) for tasks retained in PENDING state. +// +// Parameters: +// - Query +func (p *ReadOnlySchedulerClient) GetPendingReason(query *TaskQuery) (r *Response, err error) { + if err = p.sendGetPendingReason(query); err != nil { + return + } + return p.recvGetPendingReason() +} + +func (p *ReadOnlySchedulerClient) sendGetPendingReason(query *TaskQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getPendingReason", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetPendingReasonArgs{ + Query: query, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetPendingReason() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getPendingReason" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getPendingReason failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getPendingReason failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error58 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error59 error + error59, err = error58.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error59 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getPendingReason failed: invalid message type") + return + } + result := ReadOnlySchedulerGetPendingReasonResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Fetches the configuration summary of active tasks for the specified job. +// +// Parameters: +// - Job +func (p *ReadOnlySchedulerClient) GetConfigSummary(job *JobKey) (r *Response, err error) { + if err = p.sendGetConfigSummary(job); err != nil { + return + } + return p.recvGetConfigSummary() +} + +func (p *ReadOnlySchedulerClient) sendGetConfigSummary(job *JobKey) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getConfigSummary", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetConfigSummaryArgs{ + Job: job, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetConfigSummary() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getConfigSummary" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getConfigSummary failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getConfigSummary failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error60 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error61 error + error61, err = error60.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error61 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getConfigSummary failed: invalid message type") + return + } + result := ReadOnlySchedulerGetConfigSummaryResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Fetches the status of jobs. +// ownerRole is optional, in which case all jobs are returned. +// +// Parameters: +// - OwnerRole +func (p *ReadOnlySchedulerClient) GetJobs(ownerRole string) (r *Response, err error) { + if err = p.sendGetJobs(ownerRole); err != nil { + return + } + return p.recvGetJobs() +} + +func (p *ReadOnlySchedulerClient) sendGetJobs(ownerRole string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getJobs", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetJobsArgs{ + OwnerRole: ownerRole, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetJobs() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getJobs" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getJobs failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getJobs failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error62 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error63 error + error63, err = error62.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error63 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getJobs failed: invalid message type") + return + } + result := ReadOnlySchedulerGetJobsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Fetches the quota allocated for a user. +// +// Parameters: +// - OwnerRole +func (p *ReadOnlySchedulerClient) GetQuota(ownerRole string) (r *Response, err error) { + if err = p.sendGetQuota(ownerRole); err != nil { + return + } + return p.recvGetQuota() +} + +func (p *ReadOnlySchedulerClient) sendGetQuota(ownerRole string) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getQuota", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetQuotaArgs{ + OwnerRole: ownerRole, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetQuota() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getQuota" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getQuota failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getQuota failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error64 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error65 error + error65, err = error64.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error65 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getQuota failed: invalid message type") + return + } + result := ReadOnlySchedulerGetQuotaResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Populates fields in a job configuration as though it were about to be run. +// This can be used to diff a configuration running tasks. +// +// Parameters: +// - Description +func (p *ReadOnlySchedulerClient) PopulateJobConfig(description *JobConfiguration) (r *Response, err error) { + if err = p.sendPopulateJobConfig(description); err != nil { + return + } + return p.recvPopulateJobConfig() +} + +func (p *ReadOnlySchedulerClient) sendPopulateJobConfig(description *JobConfiguration) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("populateJobConfig", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerPopulateJobConfigArgs{ + Description: description, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvPopulateJobConfig() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "populateJobConfig" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "populateJobConfig failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "populateJobConfig failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error66 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error67 error + error67, err = error66.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error67 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "populateJobConfig failed: invalid message type") + return + } + result := ReadOnlySchedulerPopulateJobConfigResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Gets job update summaries. +// +// Parameters: +// - JobUpdateQuery +func (p *ReadOnlySchedulerClient) GetJobUpdateSummaries(jobUpdateQuery *JobUpdateQuery) (r *Response, err error) { + if err = p.sendGetJobUpdateSummaries(jobUpdateQuery); err != nil { + return + } + return p.recvGetJobUpdateSummaries() +} + +func (p *ReadOnlySchedulerClient) sendGetJobUpdateSummaries(jobUpdateQuery *JobUpdateQuery) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetJobUpdateSummariesArgs{ + JobUpdateQuery: jobUpdateQuery, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetJobUpdateSummaries() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getJobUpdateSummaries" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getJobUpdateSummaries failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getJobUpdateSummaries failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error68 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error69 error + error69, err = error68.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error69 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getJobUpdateSummaries failed: invalid message type") + return + } + result := ReadOnlySchedulerGetJobUpdateSummariesResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Gets job update details. +// +// Parameters: +// - Key +func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(key *JobUpdateKey) (r *Response, err error) { + if err = p.sendGetJobUpdateDetails(key); err != nil { + return + } + return p.recvGetJobUpdateDetails() +} + +func (p *ReadOnlySchedulerClient) sendGetJobUpdateDetails(key *JobUpdateKey) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getJobUpdateDetails", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetJobUpdateDetailsArgs{ + Key: key, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetJobUpdateDetails() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getJobUpdateDetails" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getJobUpdateDetails failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getJobUpdateDetails failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error70 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error71 error + error71, err = error70.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error71 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getJobUpdateDetails failed: invalid message type") + return + } + result := ReadOnlySchedulerGetJobUpdateDetailsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Gets the diff between client (desired) and server (current) job states. +// +// Parameters: +// - Request +func (p *ReadOnlySchedulerClient) GetJobUpdateDiff(request *JobUpdateRequest) (r *Response, err error) { + if err = p.sendGetJobUpdateDiff(request); err != nil { + return + } + return p.recvGetJobUpdateDiff() +} + +func (p *ReadOnlySchedulerClient) sendGetJobUpdateDiff(request *JobUpdateRequest) (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getJobUpdateDiff", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetJobUpdateDiffArgs{ + Request: request, + } + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetJobUpdateDiff() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getJobUpdateDiff" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getJobUpdateDiff failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getJobUpdateDiff failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error72 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error73 error + error73, err = error72.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error73 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getJobUpdateDiff failed: invalid message type") + return + } + result := ReadOnlySchedulerGetJobUpdateDiffResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +// Gets tier configurations. +func (p *ReadOnlySchedulerClient) GetTierConfigs() (r *Response, err error) { + if err = p.sendGetTierConfigs(); err != nil { + return + } + return p.recvGetTierConfigs() +} + +func (p *ReadOnlySchedulerClient) sendGetTierConfigs() (err error) { + oprot := p.OutputProtocol + if oprot == nil { + oprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.OutputProtocol = oprot + } + p.SeqId++ + if err = oprot.WriteMessageBegin("getTierConfigs", thrift.CALL, p.SeqId); err != nil { + return + } + args := ReadOnlySchedulerGetTierConfigsArgs{} + if err = args.Write(oprot); err != nil { + return + } + if err = oprot.WriteMessageEnd(); err != nil { + return + } + return oprot.Flush() +} + +func (p *ReadOnlySchedulerClient) recvGetTierConfigs() (value *Response, err error) { + iprot := p.InputProtocol + if iprot == nil { + iprot = p.ProtocolFactory.GetProtocol(p.Transport) + p.InputProtocol = iprot + } + method, mTypeId, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return + } + if method != "getTierConfigs" { + err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "getTierConfigs failed: wrong method name") + return + } + if p.SeqId != seqId { + err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTierConfigs failed: out of sequence response") + return + } + if mTypeId == thrift.EXCEPTION { + error74 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") + var error75 error + error75, err = error74.Read(iprot) + if err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + err = error75 + return + } + if mTypeId != thrift.REPLY { + err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "getTierConfigs failed: invalid message type") + return + } + result := ReadOnlySchedulerGetTierConfigsResult{} + if err = result.Read(iprot); err != nil { + return + } + if err = iprot.ReadMessageEnd(); err != nil { + return + } + value = result.GetSuccess() + return +} + +type ReadOnlySchedulerProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler ReadOnlyScheduler +} + +func (p *ReadOnlySchedulerProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *ReadOnlySchedulerProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *ReadOnlySchedulerProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewReadOnlySchedulerProcessor(handler ReadOnlyScheduler) *ReadOnlySchedulerProcessor { + + self76 := &ReadOnlySchedulerProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self76.processorMap["getRoleSummary"] = &readOnlySchedulerProcessorGetRoleSummary{handler: handler} + self76.processorMap["getJobSummary"] = &readOnlySchedulerProcessorGetJobSummary{handler: handler} + self76.processorMap["getTasksStatus"] = &readOnlySchedulerProcessorGetTasksStatus{handler: handler} + self76.processorMap["getTasksWithoutConfigs"] = &readOnlySchedulerProcessorGetTasksWithoutConfigs{handler: handler} + self76.processorMap["getPendingReason"] = &readOnlySchedulerProcessorGetPendingReason{handler: handler} + self76.processorMap["getConfigSummary"] = &readOnlySchedulerProcessorGetConfigSummary{handler: handler} + self76.processorMap["getJobs"] = &readOnlySchedulerProcessorGetJobs{handler: handler} + self76.processorMap["getQuota"] = &readOnlySchedulerProcessorGetQuota{handler: handler} + self76.processorMap["populateJobConfig"] = &readOnlySchedulerProcessorPopulateJobConfig{handler: handler} + self76.processorMap["getJobUpdateSummaries"] = &readOnlySchedulerProcessorGetJobUpdateSummaries{handler: handler} + self76.processorMap["getJobUpdateDetails"] = &readOnlySchedulerProcessorGetJobUpdateDetails{handler: handler} + self76.processorMap["getJobUpdateDiff"] = &readOnlySchedulerProcessorGetJobUpdateDiff{handler: handler} + self76.processorMap["getTierConfigs"] = &readOnlySchedulerProcessorGetTierConfigs{handler: handler} + return self76 +} + +func (p *ReadOnlySchedulerProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x77 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x77.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return false, x77 + +} + +type readOnlySchedulerProcessorGetRoleSummary struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetRoleSummary) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetRoleSummaryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetRoleSummary(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getRoleSummary: "+err2.Error()) + oprot.WriteMessageBegin("getRoleSummary", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetJobSummary struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetJobSummary) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetJobSummaryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetJobSummary(args.Role); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobSummary: "+err2.Error()) + oprot.WriteMessageBegin("getJobSummary", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetTasksStatus struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetTasksStatus) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetTasksStatusResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetTasksStatus(args.Query); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksStatus: "+err2.Error()) + oprot.WriteMessageBegin("getTasksStatus", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetTasksWithoutConfigs struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetTasksWithoutConfigs) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetTasksWithoutConfigsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetTasksWithoutConfigs(args.Query); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTasksWithoutConfigs: "+err2.Error()) + oprot.WriteMessageBegin("getTasksWithoutConfigs", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetPendingReason struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetPendingReason) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetPendingReasonResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetPendingReason(args.Query); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPendingReason: "+err2.Error()) + oprot.WriteMessageBegin("getPendingReason", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetConfigSummary struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetConfigSummary) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetConfigSummaryResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetConfigSummary(args.Job); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getConfigSummary: "+err2.Error()) + oprot.WriteMessageBegin("getConfigSummary", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetJobs struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetJobs) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetJobsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetJobs(args.OwnerRole); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobs: "+err2.Error()) + oprot.WriteMessageBegin("getJobs", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetQuota struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetQuota) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetQuotaResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetQuota(args.OwnerRole); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getQuota: "+err2.Error()) + oprot.WriteMessageBegin("getQuota", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorPopulateJobConfig struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorPopulateJobConfig) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerPopulateJobConfigResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.PopulateJobConfig(args.Description); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing populateJobConfig: "+err2.Error()) + oprot.WriteMessageBegin("populateJobConfig", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetJobUpdateSummaries struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetJobUpdateSummaries) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetJobUpdateSummariesResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetJobUpdateSummaries(args.JobUpdateQuery); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateSummaries: "+err2.Error()) + oprot.WriteMessageBegin("getJobUpdateSummaries", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetJobUpdateDetails struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetJobUpdateDetails) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetJobUpdateDetailsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetJobUpdateDetails(args.Key); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDetails: "+err2.Error()) + oprot.WriteMessageBegin("getJobUpdateDetails", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetJobUpdateDiff struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetJobUpdateDiff) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetJobUpdateDiffResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetJobUpdateDiff(args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getJobUpdateDiff: "+err2.Error()) + oprot.WriteMessageBegin("getJobUpdateDiff", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type readOnlySchedulerProcessorGetTierConfigs struct { + handler ReadOnlyScheduler +} + +func (p *readOnlySchedulerProcessorGetTierConfigs) Process(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() + oprot.Flush() + return false, err + } + + iprot.ReadMessageEnd() + result := ReadOnlySchedulerGetTierConfigsResult{} + var retval *Response + var err2 error + if retval, err2 = p.handler.GetTierConfigs(); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTierConfigs: "+err2.Error()) + oprot.WriteMessageBegin("getTierConfigs", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush() + return true, 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 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +// HELPER FUNCTIONS AND STRUCTURES + +type ReadOnlySchedulerGetRoleSummaryArgs struct { +} + +func NewReadOnlySchedulerGetRoleSummaryArgs() *ReadOnlySchedulerGetRoleSummaryArgs { + return &ReadOnlySchedulerGetRoleSummaryArgs{} +} + +func (p *ReadOnlySchedulerGetRoleSummaryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetRoleSummaryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetRoleSummaryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetRoleSummaryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetRoleSummaryResult() *ReadOnlySchedulerGetRoleSummaryResult { + return &ReadOnlySchedulerGetRoleSummaryResult{} +} + +var ReadOnlySchedulerGetRoleSummaryResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetRoleSummaryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetRoleSummaryResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetRoleSummaryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetRoleSummaryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetRoleSummaryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetRoleSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetRoleSummaryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetRoleSummaryResult(%+v)", *p) +} + +// Attributes: +// - Role +type ReadOnlySchedulerGetJobSummaryArgs struct { + Role string `thrift:"role,1" json:"role"` +} + +func NewReadOnlySchedulerGetJobSummaryArgs() *ReadOnlySchedulerGetJobSummaryArgs { + return &ReadOnlySchedulerGetJobSummaryArgs{} +} + +func (p *ReadOnlySchedulerGetJobSummaryArgs) GetRole() string { + return p.Role +} +func (p *ReadOnlySchedulerGetJobSummaryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *ReadOnlySchedulerGetJobSummaryArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("getJobSummary_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) + } + if err := oprot.WriteString(string(p.Role)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:role: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetJobSummaryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobSummaryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetJobSummaryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetJobSummaryResult() *ReadOnlySchedulerGetJobSummaryResult { + return &ReadOnlySchedulerGetJobSummaryResult{} +} + +var ReadOnlySchedulerGetJobSummaryResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetJobSummaryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetJobSummaryResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetJobSummaryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetJobSummaryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobSummaryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetJobSummaryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobSummaryResult(%+v)", *p) +} + +// Attributes: +// - Query +type ReadOnlySchedulerGetTasksStatusArgs struct { + Query *TaskQuery `thrift:"query,1" json:"query"` +} + +func NewReadOnlySchedulerGetTasksStatusArgs() *ReadOnlySchedulerGetTasksStatusArgs { + return &ReadOnlySchedulerGetTasksStatusArgs{} +} + +var ReadOnlySchedulerGetTasksStatusArgs_Query_DEFAULT *TaskQuery + +func (p *ReadOnlySchedulerGetTasksStatusArgs) GetQuery() *TaskQuery { + if !p.IsSetQuery() { + return ReadOnlySchedulerGetTasksStatusArgs_Query_DEFAULT + } + return p.Query +} +func (p *ReadOnlySchedulerGetTasksStatusArgs) IsSetQuery() bool { + return p.Query != nil +} + +func (p *ReadOnlySchedulerGetTasksStatusArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksStatusArgs) readField1(iprot thrift.TProtocol) error { + p.Query = &TaskQuery{} + if err := p.Query.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) + } + if err := p.Query.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetTasksStatusArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTasksStatusArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetTasksStatusResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetTasksStatusResult() *ReadOnlySchedulerGetTasksStatusResult { + return &ReadOnlySchedulerGetTasksStatusResult{} +} + +var ReadOnlySchedulerGetTasksStatusResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetTasksStatusResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetTasksStatusResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetTasksStatusResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetTasksStatusResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksStatusResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksStatusResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetTasksStatusResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTasksStatusResult(%+v)", *p) +} + +// Attributes: +// - Query +type ReadOnlySchedulerGetTasksWithoutConfigsArgs struct { + Query *TaskQuery `thrift:"query,1" json:"query"` +} + +func NewReadOnlySchedulerGetTasksWithoutConfigsArgs() *ReadOnlySchedulerGetTasksWithoutConfigsArgs { + return &ReadOnlySchedulerGetTasksWithoutConfigsArgs{} +} + +var ReadOnlySchedulerGetTasksWithoutConfigsArgs_Query_DEFAULT *TaskQuery + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) GetQuery() *TaskQuery { + if !p.IsSetQuery() { + return ReadOnlySchedulerGetTasksWithoutConfigsArgs_Query_DEFAULT + } + return p.Query +} +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) IsSetQuery() bool { + return p.Query != nil +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) readField1(iprot thrift.TProtocol) error { + p.Query = &TaskQuery{} + if err := p.Query.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) + } + if err := p.Query.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTasksWithoutConfigsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetTasksWithoutConfigsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetTasksWithoutConfigsResult() *ReadOnlySchedulerGetTasksWithoutConfigsResult { + return &ReadOnlySchedulerGetTasksWithoutConfigsResult{} +} + +var ReadOnlySchedulerGetTasksWithoutConfigsResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetTasksWithoutConfigsResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetTasksWithoutConfigsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTasksWithoutConfigsResult(%+v)", *p) +} + +// Attributes: +// - Query +type ReadOnlySchedulerGetPendingReasonArgs struct { + Query *TaskQuery `thrift:"query,1" json:"query"` +} + +func NewReadOnlySchedulerGetPendingReasonArgs() *ReadOnlySchedulerGetPendingReasonArgs { + return &ReadOnlySchedulerGetPendingReasonArgs{} +} + +var ReadOnlySchedulerGetPendingReasonArgs_Query_DEFAULT *TaskQuery + +func (p *ReadOnlySchedulerGetPendingReasonArgs) GetQuery() *TaskQuery { + if !p.IsSetQuery() { + return ReadOnlySchedulerGetPendingReasonArgs_Query_DEFAULT + } + return p.Query +} +func (p *ReadOnlySchedulerGetPendingReasonArgs) IsSetQuery() bool { + return p.Query != nil +} + +func (p *ReadOnlySchedulerGetPendingReasonArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetPendingReasonArgs) readField1(iprot thrift.TProtocol) error { + p.Query = &TaskQuery{} + if err := p.Query.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) + } + if err := p.Query.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetPendingReasonArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetPendingReasonArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetPendingReasonResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetPendingReasonResult() *ReadOnlySchedulerGetPendingReasonResult { + return &ReadOnlySchedulerGetPendingReasonResult{} +} + +var ReadOnlySchedulerGetPendingReasonResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetPendingReasonResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetPendingReasonResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetPendingReasonResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetPendingReasonResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetPendingReasonResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetPendingReasonResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetPendingReasonResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetPendingReasonResult(%+v)", *p) +} + +// Attributes: +// - Job +type ReadOnlySchedulerGetConfigSummaryArgs struct { + Job *JobKey `thrift:"job,1" json:"job"` +} + +func NewReadOnlySchedulerGetConfigSummaryArgs() *ReadOnlySchedulerGetConfigSummaryArgs { + return &ReadOnlySchedulerGetConfigSummaryArgs{} +} + +var ReadOnlySchedulerGetConfigSummaryArgs_Job_DEFAULT *JobKey + +func (p *ReadOnlySchedulerGetConfigSummaryArgs) GetJob() *JobKey { + if !p.IsSetJob() { + return ReadOnlySchedulerGetConfigSummaryArgs_Job_DEFAULT + } + return p.Job +} +func (p *ReadOnlySchedulerGetConfigSummaryArgs) IsSetJob() bool { + return p.Job != nil +} + +func (p *ReadOnlySchedulerGetConfigSummaryArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetConfigSummaryArgs) readField1(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetConfigSummaryArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetConfigSummaryArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetConfigSummaryResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetConfigSummaryResult() *ReadOnlySchedulerGetConfigSummaryResult { + return &ReadOnlySchedulerGetConfigSummaryResult{} +} + +var ReadOnlySchedulerGetConfigSummaryResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetConfigSummaryResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetConfigSummaryResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetConfigSummaryResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetConfigSummaryResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetConfigSummaryResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetConfigSummaryResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetConfigSummaryResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetConfigSummaryResult(%+v)", *p) +} + +// Attributes: +// - OwnerRole +type ReadOnlySchedulerGetJobsArgs struct { + OwnerRole string `thrift:"ownerRole,1" json:"ownerRole"` +} + +func NewReadOnlySchedulerGetJobsArgs() *ReadOnlySchedulerGetJobsArgs { + return &ReadOnlySchedulerGetJobsArgs{} +} + +func (p *ReadOnlySchedulerGetJobsArgs) GetOwnerRole() string { + return p.OwnerRole +} +func (p *ReadOnlySchedulerGetJobsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.OwnerRole = v + } + return nil +} + +func (p *ReadOnlySchedulerGetJobsArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("getJobs_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) + } + if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetJobsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetJobsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetJobsResult() *ReadOnlySchedulerGetJobsResult { + return &ReadOnlySchedulerGetJobsResult{} +} + +var ReadOnlySchedulerGetJobsResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetJobsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetJobsResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetJobsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetJobsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetJobsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobsResult(%+v)", *p) +} + +// Attributes: +// - OwnerRole +type ReadOnlySchedulerGetQuotaArgs struct { + OwnerRole string `thrift:"ownerRole,1" json:"ownerRole"` +} + +func NewReadOnlySchedulerGetQuotaArgs() *ReadOnlySchedulerGetQuotaArgs { + return &ReadOnlySchedulerGetQuotaArgs{} +} + +func (p *ReadOnlySchedulerGetQuotaArgs) GetOwnerRole() string { + return p.OwnerRole +} +func (p *ReadOnlySchedulerGetQuotaArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.OwnerRole = v + } + return nil +} + +func (p *ReadOnlySchedulerGetQuotaArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("getQuota_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ownerRole: ", p), err) + } + if err := oprot.WriteString(string(p.OwnerRole)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.ownerRole (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ownerRole: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetQuotaArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetQuotaArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetQuotaResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetQuotaResult() *ReadOnlySchedulerGetQuotaResult { + return &ReadOnlySchedulerGetQuotaResult{} +} + +var ReadOnlySchedulerGetQuotaResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetQuotaResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetQuotaResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetQuotaResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetQuotaResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetQuotaResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetQuotaResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetQuotaResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetQuotaResult(%+v)", *p) +} + +// Attributes: +// - Description +type ReadOnlySchedulerPopulateJobConfigArgs struct { + Description *JobConfiguration `thrift:"description,1" json:"description"` +} + +func NewReadOnlySchedulerPopulateJobConfigArgs() *ReadOnlySchedulerPopulateJobConfigArgs { + return &ReadOnlySchedulerPopulateJobConfigArgs{} +} + +var ReadOnlySchedulerPopulateJobConfigArgs_Description_DEFAULT *JobConfiguration + +func (p *ReadOnlySchedulerPopulateJobConfigArgs) GetDescription() *JobConfiguration { + if !p.IsSetDescription() { + return ReadOnlySchedulerPopulateJobConfigArgs_Description_DEFAULT + } + return p.Description +} +func (p *ReadOnlySchedulerPopulateJobConfigArgs) IsSetDescription() bool { + return p.Description != nil +} + +func (p *ReadOnlySchedulerPopulateJobConfigArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerPopulateJobConfigArgs) readField1(iprot thrift.TProtocol) error { + p.Description = &JobConfiguration{} + if err := p.Description.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:description: ", p), err) + } + if err := p.Description.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Description), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:description: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerPopulateJobConfigArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerPopulateJobConfigArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerPopulateJobConfigResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerPopulateJobConfigResult() *ReadOnlySchedulerPopulateJobConfigResult { + return &ReadOnlySchedulerPopulateJobConfigResult{} +} + +var ReadOnlySchedulerPopulateJobConfigResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerPopulateJobConfigResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerPopulateJobConfigResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerPopulateJobConfigResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerPopulateJobConfigResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerPopulateJobConfigResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerPopulateJobConfigResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerPopulateJobConfigResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerPopulateJobConfigResult(%+v)", *p) +} + +// Attributes: +// - JobUpdateQuery +type ReadOnlySchedulerGetJobUpdateSummariesArgs struct { + JobUpdateQuery *JobUpdateQuery `thrift:"jobUpdateQuery,1" json:"jobUpdateQuery"` +} + +func NewReadOnlySchedulerGetJobUpdateSummariesArgs() *ReadOnlySchedulerGetJobUpdateSummariesArgs { + return &ReadOnlySchedulerGetJobUpdateSummariesArgs{} +} + +var ReadOnlySchedulerGetJobUpdateSummariesArgs_JobUpdateQuery_DEFAULT *JobUpdateQuery + +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) GetJobUpdateQuery() *JobUpdateQuery { + if !p.IsSetJobUpdateQuery() { + return ReadOnlySchedulerGetJobUpdateSummariesArgs_JobUpdateQuery_DEFAULT + } + return p.JobUpdateQuery +} +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) IsSetJobUpdateQuery() bool { + return p.JobUpdateQuery != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) readField1(iprot thrift.TProtocol) error { + p.JobUpdateQuery = &JobUpdateQuery{} + if err := p.JobUpdateQuery.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobUpdateQuery: ", p), err) + } + if err := p.JobUpdateQuery.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobUpdateQuery), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobUpdateQuery: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateSummariesArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetJobUpdateSummariesResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetJobUpdateSummariesResult() *ReadOnlySchedulerGetJobUpdateSummariesResult { + return &ReadOnlySchedulerGetJobUpdateSummariesResult{} +} + +var ReadOnlySchedulerGetJobUpdateSummariesResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetJobUpdateSummariesResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateSummariesResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateSummariesResult(%+v)", *p) +} + +// Attributes: +// - Key +type ReadOnlySchedulerGetJobUpdateDetailsArgs struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` +} + +func NewReadOnlySchedulerGetJobUpdateDetailsArgs() *ReadOnlySchedulerGetJobUpdateDetailsArgs { + return &ReadOnlySchedulerGetJobUpdateDetailsArgs{} +} + +var ReadOnlySchedulerGetJobUpdateDetailsArgs_Key_DEFAULT *JobUpdateKey + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return ReadOnlySchedulerGetJobUpdateDetailsArgs_Key_DEFAULT + } + return p.Key +} +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) IsSetKey() bool { + return p.Key != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("getJobUpdateDetails_args"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateDetailsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetJobUpdateDetailsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetJobUpdateDetailsResult() *ReadOnlySchedulerGetJobUpdateDetailsResult { + return &ReadOnlySchedulerGetJobUpdateDetailsResult{} +} + +var ReadOnlySchedulerGetJobUpdateDetailsResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetJobUpdateDetailsResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateDetailsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateDetailsResult(%+v)", *p) +} + +// Attributes: +// - Request +type ReadOnlySchedulerGetJobUpdateDiffArgs struct { + Request *JobUpdateRequest `thrift:"request,1" json:"request"` +} + +func NewReadOnlySchedulerGetJobUpdateDiffArgs() *ReadOnlySchedulerGetJobUpdateDiffArgs { + return &ReadOnlySchedulerGetJobUpdateDiffArgs{} +} + +var ReadOnlySchedulerGetJobUpdateDiffArgs_Request_DEFAULT *JobUpdateRequest + +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) GetRequest() *JobUpdateRequest { + if !p.IsSetRequest() { + return ReadOnlySchedulerGetJobUpdateDiffArgs_Request_DEFAULT + } + return p.Request +} +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) readField1(iprot thrift.TProtocol) error { + p.Request = &JobUpdateRequest{} + if err := p.Request.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:request: ", p), err) + } + if err := p.Request.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Request), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:request: ", p), err) + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateDiffArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetJobUpdateDiffResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetJobUpdateDiffResult() *ReadOnlySchedulerGetJobUpdateDiffResult { + return &ReadOnlySchedulerGetJobUpdateDiffResult{} +} + +var ReadOnlySchedulerGetJobUpdateDiffResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetJobUpdateDiffResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetJobUpdateDiffResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetJobUpdateDiffResult(%+v)", *p) +} + +type ReadOnlySchedulerGetTierConfigsArgs struct { +} + +func NewReadOnlySchedulerGetTierConfigsArgs() *ReadOnlySchedulerGetTierConfigsArgs { + return &ReadOnlySchedulerGetTierConfigsArgs{} +} + +func (p *ReadOnlySchedulerGetTierConfigsArgs) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 { + return err + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTierConfigsArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTierConfigsArgs(%+v)", *p) +} + +// Attributes: +// - Success +type ReadOnlySchedulerGetTierConfigsResult struct { + Success *Response `thrift:"success,0" json:"success,omitempty"` +} + +func NewReadOnlySchedulerGetTierConfigsResult() *ReadOnlySchedulerGetTierConfigsResult { + return &ReadOnlySchedulerGetTierConfigsResult{} +} + +var ReadOnlySchedulerGetTierConfigsResult_Success_DEFAULT *Response + +func (p *ReadOnlySchedulerGetTierConfigsResult) GetSuccess() *Response { + if !p.IsSetSuccess() { + return ReadOnlySchedulerGetTierConfigsResult_Success_DEFAULT + } + return p.Success +} +func (p *ReadOnlySchedulerGetTierConfigsResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *ReadOnlySchedulerGetTierConfigsResult) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if err := p.readField0(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTierConfigsResult) readField0(iprot thrift.TProtocol) error { + p.Success = &Response{} + if err := p.Success.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField0(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ReadOnlySchedulerGetTierConfigsResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) + } + } + return err +} + +func (p *ReadOnlySchedulerGetTierConfigsResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ReadOnlySchedulerGetTierConfigsResult(%+v)", *p) +} diff --git a/vendor/gen-go/apache/aurora/ttypes.go b/vendor/gen-go/apache/aurora/ttypes.go new file mode 100644 index 0000000..3a4fb9b --- /dev/null +++ b/vendor/gen-go/apache/aurora/ttypes.go @@ -0,0 +1,15610 @@ +// Autogenerated by Thrift Compiler (0.9.3) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +package aurora + +import ( + "bytes" + "fmt" + "git.apache.org/thrift.git/lib/go/thrift" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = thrift.ZERO +var _ = fmt.Printf +var _ = bytes.Equal + +var GoUnusedProtection__ int + +type ResponseCode int64 + +const ( + ResponseCode_INVALID_REQUEST ResponseCode = 0 + ResponseCode_OK ResponseCode = 1 + ResponseCode_ERROR ResponseCode = 2 + ResponseCode_WARNING ResponseCode = 3 + ResponseCode_AUTH_FAILED ResponseCode = 4 + ResponseCode_LOCK_ERROR ResponseCode = 5 + ResponseCode_ERROR_TRANSIENT ResponseCode = 6 +) + +func (p ResponseCode) String() string { + switch p { + case ResponseCode_INVALID_REQUEST: + return "INVALID_REQUEST" + case ResponseCode_OK: + return "OK" + case ResponseCode_ERROR: + return "ERROR" + case ResponseCode_WARNING: + return "WARNING" + case ResponseCode_AUTH_FAILED: + return "AUTH_FAILED" + case ResponseCode_LOCK_ERROR: + return "LOCK_ERROR" + case ResponseCode_ERROR_TRANSIENT: + return "ERROR_TRANSIENT" + } + return "" +} + +func ResponseCodeFromString(s string) (ResponseCode, error) { + switch s { + case "INVALID_REQUEST": + return ResponseCode_INVALID_REQUEST, nil + case "OK": + return ResponseCode_OK, nil + case "ERROR": + return ResponseCode_ERROR, nil + case "WARNING": + return ResponseCode_WARNING, nil + case "AUTH_FAILED": + return ResponseCode_AUTH_FAILED, nil + case "LOCK_ERROR": + return ResponseCode_LOCK_ERROR, nil + case "ERROR_TRANSIENT": + return ResponseCode_ERROR_TRANSIENT, nil + } + return ResponseCode(0), fmt.Errorf("not a valid ResponseCode string") +} + +func ResponseCodePtr(v ResponseCode) *ResponseCode { return &v } + +func (p ResponseCode) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *ResponseCode) UnmarshalText(text []byte) error { + q, err := ResponseCodeFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +type MaintenanceMode int64 + +const ( + MaintenanceMode_NONE MaintenanceMode = 1 + MaintenanceMode_SCHEDULED MaintenanceMode = 2 + MaintenanceMode_DRAINING MaintenanceMode = 3 + MaintenanceMode_DRAINED MaintenanceMode = 4 +) + +func (p MaintenanceMode) String() string { + switch p { + case MaintenanceMode_NONE: + return "NONE" + case MaintenanceMode_SCHEDULED: + return "SCHEDULED" + case MaintenanceMode_DRAINING: + return "DRAINING" + case MaintenanceMode_DRAINED: + return "DRAINED" + } + return "" +} + +func MaintenanceModeFromString(s string) (MaintenanceMode, error) { + switch s { + case "NONE": + return MaintenanceMode_NONE, nil + case "SCHEDULED": + return MaintenanceMode_SCHEDULED, nil + case "DRAINING": + return MaintenanceMode_DRAINING, nil + case "DRAINED": + return MaintenanceMode_DRAINED, nil + } + return MaintenanceMode(0), fmt.Errorf("not a valid MaintenanceMode string") +} + +func MaintenanceModePtr(v MaintenanceMode) *MaintenanceMode { return &v } + +func (p MaintenanceMode) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *MaintenanceMode) UnmarshalText(text []byte) error { + q, err := MaintenanceModeFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//The mode for a volume mount +type Mode int64 + +const ( + Mode_RW Mode = 1 + Mode_RO Mode = 2 +) + +func (p Mode) String() string { + switch p { + case Mode_RW: + return "RW" + case Mode_RO: + return "RO" + } + return "" +} + +func ModeFromString(s string) (Mode, error) { + switch s { + case "RW": + return Mode_RW, nil + case "RO": + return Mode_RO, nil + } + return Mode(0), fmt.Errorf("not a valid Mode string") +} + +func ModePtr(v Mode) *Mode { return &v } + +func (p Mode) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *Mode) UnmarshalText(text []byte) error { + q, err := ModeFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//Defines the policy for launching a new cron job when one is already running. +type CronCollisionPolicy int64 + +const ( + CronCollisionPolicy_KILL_EXISTING CronCollisionPolicy = 0 + CronCollisionPolicy_CANCEL_NEW CronCollisionPolicy = 1 + CronCollisionPolicy_RUN_OVERLAP CronCollisionPolicy = 2 +) + +func (p CronCollisionPolicy) String() string { + switch p { + case CronCollisionPolicy_KILL_EXISTING: + return "KILL_EXISTING" + case CronCollisionPolicy_CANCEL_NEW: + return "CANCEL_NEW" + case CronCollisionPolicy_RUN_OVERLAP: + return "RUN_OVERLAP" + } + return "" +} + +func CronCollisionPolicyFromString(s string) (CronCollisionPolicy, error) { + switch s { + case "KILL_EXISTING": + return CronCollisionPolicy_KILL_EXISTING, nil + case "CANCEL_NEW": + return CronCollisionPolicy_CANCEL_NEW, nil + case "RUN_OVERLAP": + return CronCollisionPolicy_RUN_OVERLAP, nil + } + return CronCollisionPolicy(0), fmt.Errorf("not a valid CronCollisionPolicy string") +} + +func CronCollisionPolicyPtr(v CronCollisionPolicy) *CronCollisionPolicy { return &v } + +func (p CronCollisionPolicy) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *CronCollisionPolicy) UnmarshalText(text []byte) error { + q, err := CronCollisionPolicyFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//States that a task may be in. +type ScheduleStatus int64 + +const ( + ScheduleStatus_INIT ScheduleStatus = 11 + ScheduleStatus_THROTTLED ScheduleStatus = 16 + ScheduleStatus_PENDING ScheduleStatus = 0 + ScheduleStatus_ASSIGNED ScheduleStatus = 9 + ScheduleStatus_STARTING ScheduleStatus = 1 + ScheduleStatus_RUNNING ScheduleStatus = 2 + ScheduleStatus_FINISHED ScheduleStatus = 3 + ScheduleStatus_PREEMPTING ScheduleStatus = 13 + ScheduleStatus_RESTARTING ScheduleStatus = 12 + ScheduleStatus_DRAINING ScheduleStatus = 17 + ScheduleStatus_FAILED ScheduleStatus = 4 + ScheduleStatus_KILLED ScheduleStatus = 5 + ScheduleStatus_KILLING ScheduleStatus = 6 + ScheduleStatus_LOST ScheduleStatus = 7 +) + +func (p ScheduleStatus) String() string { + switch p { + case ScheduleStatus_INIT: + return "INIT" + case ScheduleStatus_THROTTLED: + return "THROTTLED" + case ScheduleStatus_PENDING: + return "PENDING" + case ScheduleStatus_ASSIGNED: + return "ASSIGNED" + case ScheduleStatus_STARTING: + return "STARTING" + case ScheduleStatus_RUNNING: + return "RUNNING" + case ScheduleStatus_FINISHED: + return "FINISHED" + case ScheduleStatus_PREEMPTING: + return "PREEMPTING" + case ScheduleStatus_RESTARTING: + return "RESTARTING" + case ScheduleStatus_DRAINING: + return "DRAINING" + case ScheduleStatus_FAILED: + return "FAILED" + case ScheduleStatus_KILLED: + return "KILLED" + case ScheduleStatus_KILLING: + return "KILLING" + case ScheduleStatus_LOST: + return "LOST" + } + return "" +} + +func ScheduleStatusFromString(s string) (ScheduleStatus, error) { + switch s { + case "INIT": + return ScheduleStatus_INIT, nil + case "THROTTLED": + return ScheduleStatus_THROTTLED, nil + case "PENDING": + return ScheduleStatus_PENDING, nil + case "ASSIGNED": + return ScheduleStatus_ASSIGNED, nil + case "STARTING": + return ScheduleStatus_STARTING, nil + case "RUNNING": + return ScheduleStatus_RUNNING, nil + case "FINISHED": + return ScheduleStatus_FINISHED, nil + case "PREEMPTING": + return ScheduleStatus_PREEMPTING, nil + case "RESTARTING": + return ScheduleStatus_RESTARTING, nil + case "DRAINING": + return ScheduleStatus_DRAINING, nil + case "FAILED": + return ScheduleStatus_FAILED, nil + case "KILLED": + return ScheduleStatus_KILLED, nil + case "KILLING": + return ScheduleStatus_KILLING, nil + case "LOST": + return ScheduleStatus_LOST, nil + } + return ScheduleStatus(0), fmt.Errorf("not a valid ScheduleStatus string") +} + +func ScheduleStatusPtr(v ScheduleStatus) *ScheduleStatus { return &v } + +func (p ScheduleStatus) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *ScheduleStatus) UnmarshalText(text []byte) error { + q, err := ScheduleStatusFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//States that a job update may be in. +type JobUpdateStatus int64 + +const ( + JobUpdateStatus_ROLLING_FORWARD JobUpdateStatus = 0 + JobUpdateStatus_ROLLING_BACK JobUpdateStatus = 1 + JobUpdateStatus_ROLL_FORWARD_PAUSED JobUpdateStatus = 2 + JobUpdateStatus_ROLL_BACK_PAUSED JobUpdateStatus = 3 + JobUpdateStatus_ROLLED_FORWARD JobUpdateStatus = 4 + JobUpdateStatus_ROLLED_BACK JobUpdateStatus = 5 + JobUpdateStatus_ABORTED JobUpdateStatus = 6 + JobUpdateStatus_ERROR JobUpdateStatus = 7 + JobUpdateStatus_FAILED JobUpdateStatus = 8 + JobUpdateStatus_ROLL_FORWARD_AWAITING_PULSE JobUpdateStatus = 9 + JobUpdateStatus_ROLL_BACK_AWAITING_PULSE JobUpdateStatus = 10 +) + +func (p JobUpdateStatus) String() string { + switch p { + case JobUpdateStatus_ROLLING_FORWARD: + return "ROLLING_FORWARD" + case JobUpdateStatus_ROLLING_BACK: + return "ROLLING_BACK" + case JobUpdateStatus_ROLL_FORWARD_PAUSED: + return "ROLL_FORWARD_PAUSED" + case JobUpdateStatus_ROLL_BACK_PAUSED: + return "ROLL_BACK_PAUSED" + case JobUpdateStatus_ROLLED_FORWARD: + return "ROLLED_FORWARD" + case JobUpdateStatus_ROLLED_BACK: + return "ROLLED_BACK" + case JobUpdateStatus_ABORTED: + return "ABORTED" + case JobUpdateStatus_ERROR: + return "ERROR" + case JobUpdateStatus_FAILED: + return "FAILED" + case JobUpdateStatus_ROLL_FORWARD_AWAITING_PULSE: + return "ROLL_FORWARD_AWAITING_PULSE" + case JobUpdateStatus_ROLL_BACK_AWAITING_PULSE: + return "ROLL_BACK_AWAITING_PULSE" + } + return "" +} + +func JobUpdateStatusFromString(s string) (JobUpdateStatus, error) { + switch s { + case "ROLLING_FORWARD": + return JobUpdateStatus_ROLLING_FORWARD, nil + case "ROLLING_BACK": + return JobUpdateStatus_ROLLING_BACK, nil + case "ROLL_FORWARD_PAUSED": + return JobUpdateStatus_ROLL_FORWARD_PAUSED, nil + case "ROLL_BACK_PAUSED": + return JobUpdateStatus_ROLL_BACK_PAUSED, nil + case "ROLLED_FORWARD": + return JobUpdateStatus_ROLLED_FORWARD, nil + case "ROLLED_BACK": + return JobUpdateStatus_ROLLED_BACK, nil + case "ABORTED": + return JobUpdateStatus_ABORTED, nil + case "ERROR": + return JobUpdateStatus_ERROR, nil + case "FAILED": + return JobUpdateStatus_FAILED, nil + case "ROLL_FORWARD_AWAITING_PULSE": + return JobUpdateStatus_ROLL_FORWARD_AWAITING_PULSE, nil + case "ROLL_BACK_AWAITING_PULSE": + return JobUpdateStatus_ROLL_BACK_AWAITING_PULSE, nil + } + return JobUpdateStatus(0), fmt.Errorf("not a valid JobUpdateStatus string") +} + +func JobUpdateStatusPtr(v JobUpdateStatus) *JobUpdateStatus { return &v } + +func (p JobUpdateStatus) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *JobUpdateStatus) UnmarshalText(text []byte) error { + q, err := JobUpdateStatusFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//Job update actions that can be applied to job instances. +type JobUpdateAction int64 + +const ( + JobUpdateAction_INSTANCE_UPDATED JobUpdateAction = 1 + JobUpdateAction_INSTANCE_ROLLED_BACK JobUpdateAction = 2 + JobUpdateAction_INSTANCE_UPDATING JobUpdateAction = 3 + JobUpdateAction_INSTANCE_ROLLING_BACK JobUpdateAction = 4 + JobUpdateAction_INSTANCE_UPDATE_FAILED JobUpdateAction = 5 + JobUpdateAction_INSTANCE_ROLLBACK_FAILED JobUpdateAction = 6 +) + +func (p JobUpdateAction) String() string { + switch p { + case JobUpdateAction_INSTANCE_UPDATED: + return "INSTANCE_UPDATED" + case JobUpdateAction_INSTANCE_ROLLED_BACK: + return "INSTANCE_ROLLED_BACK" + case JobUpdateAction_INSTANCE_UPDATING: + return "INSTANCE_UPDATING" + case JobUpdateAction_INSTANCE_ROLLING_BACK: + return "INSTANCE_ROLLING_BACK" + case JobUpdateAction_INSTANCE_UPDATE_FAILED: + return "INSTANCE_UPDATE_FAILED" + case JobUpdateAction_INSTANCE_ROLLBACK_FAILED: + return "INSTANCE_ROLLBACK_FAILED" + } + return "" +} + +func JobUpdateActionFromString(s string) (JobUpdateAction, error) { + switch s { + case "INSTANCE_UPDATED": + return JobUpdateAction_INSTANCE_UPDATED, nil + case "INSTANCE_ROLLED_BACK": + return JobUpdateAction_INSTANCE_ROLLED_BACK, nil + case "INSTANCE_UPDATING": + return JobUpdateAction_INSTANCE_UPDATING, nil + case "INSTANCE_ROLLING_BACK": + return JobUpdateAction_INSTANCE_ROLLING_BACK, nil + case "INSTANCE_UPDATE_FAILED": + return JobUpdateAction_INSTANCE_UPDATE_FAILED, nil + case "INSTANCE_ROLLBACK_FAILED": + return JobUpdateAction_INSTANCE_ROLLBACK_FAILED, nil + } + return JobUpdateAction(0), fmt.Errorf("not a valid JobUpdateAction string") +} + +func JobUpdateActionPtr(v JobUpdateAction) *JobUpdateAction { return &v } + +func (p JobUpdateAction) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *JobUpdateAction) UnmarshalText(text []byte) error { + q, err := JobUpdateActionFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +//Status of the coordinated update. Intended as a response to pulseJobUpdate RPC. +type JobUpdatePulseStatus int64 + +const ( + JobUpdatePulseStatus_OK JobUpdatePulseStatus = 1 + JobUpdatePulseStatus_FINISHED JobUpdatePulseStatus = 2 +) + +func (p JobUpdatePulseStatus) String() string { + switch p { + case JobUpdatePulseStatus_OK: + return "OK" + case JobUpdatePulseStatus_FINISHED: + return "FINISHED" + } + return "" +} + +func JobUpdatePulseStatusFromString(s string) (JobUpdatePulseStatus, error) { + switch s { + case "OK": + return JobUpdatePulseStatus_OK, nil + case "FINISHED": + return JobUpdatePulseStatus_FINISHED, nil + } + return JobUpdatePulseStatus(0), fmt.Errorf("not a valid JobUpdatePulseStatus string") +} + +func JobUpdatePulseStatusPtr(v JobUpdatePulseStatus) *JobUpdatePulseStatus { return &v } + +func (p JobUpdatePulseStatus) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *JobUpdatePulseStatus) UnmarshalText(text []byte) error { + q, err := JobUpdatePulseStatusFromString(string(text)) + if err != nil { + return err + } + *p = q + return nil +} + +// Attributes: +// - User +type Identity struct { + // unused field # 1 + User string `thrift:"user,2" json:"user"` +} + +func NewIdentity() *Identity { + return &Identity{} +} + +func (p *Identity) GetUser() string { + return p.User +} +func (p *Identity) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.User = v + } + return nil +} + +func (p *Identity) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Identity"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:user: ", p), err) + } + if err := oprot.WriteString(string(p.User)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.user (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:user: ", p), err) + } + return err +} + +func (p *Identity) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Identity(%+v)", *p) +} + +// A single host attribute. +// +// Attributes: +// - Name +// - Values +type Attribute struct { + Name string `thrift:"name,1" json:"name"` + Values map[string]bool `thrift:"values,2" json:"values"` +} + +func NewAttribute() *Attribute { + return &Attribute{} +} + +func (p *Attribute) GetName() string { + return p.Name +} + +func (p *Attribute) GetValues() map[string]bool { + return p.Values +} +func (p *Attribute) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *Attribute) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.Values = tSet + for i := 0; i < size; i++ { + var _elem0 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem0 = v + } + p.Values[_elem0] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Values { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:values: ", p), err) + } + return err +} + +func (p *Attribute) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Attribute(%+v)", *p) +} + +// The attributes assigned to a host. +// +// Attributes: +// - Host +// - Attributes +// - Mode +// - SlaveId +type HostAttributes struct { + Host string `thrift:"host,1" json:"host"` + Attributes map[*Attribute]bool `thrift:"attributes,2" json:"attributes"` + Mode *MaintenanceMode `thrift:"mode,3" json:"mode,omitempty"` + SlaveId *string `thrift:"slaveId,4" json:"slaveId,omitempty"` +} + +func NewHostAttributes() *HostAttributes { + return &HostAttributes{} +} + +func (p *HostAttributes) GetHost() string { + return p.Host +} + +func (p *HostAttributes) GetAttributes() map[*Attribute]bool { + return p.Attributes +} + +var HostAttributes_Mode_DEFAULT MaintenanceMode + +func (p *HostAttributes) GetMode() MaintenanceMode { + if !p.IsSetMode() { + return HostAttributes_Mode_DEFAULT + } + return *p.Mode +} + +var HostAttributes_SlaveId_DEFAULT string + +func (p *HostAttributes) GetSlaveId() string { + if !p.IsSetSlaveId() { + return HostAttributes_SlaveId_DEFAULT + } + return *p.SlaveId +} +func (p *HostAttributes) IsSetMode() bool { + return p.Mode != nil +} + +func (p *HostAttributes) IsSetSlaveId() bool { + return p.SlaveId != nil +} + +func (p *HostAttributes) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Host = v + } + return nil +} + +func (p *HostAttributes) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Attribute]bool, 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) + } + p.Attributes[_elem1] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError("error reading field 3: ", err) + } else { + temp := MaintenanceMode(v) + p.Mode = &temp + } + return nil +} + +func (p *HostAttributes) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.SlaveId = &v + } + return nil +} + +func (p *HostAttributes) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("HostAttributes"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) + } + if err := oprot.WriteString(string(p.Host)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Attributes { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:attributes: ", p), err) + } + return err +} + +func (p *HostAttributes) writeField3(oprot thrift.TProtocol) (err error) { + if p.IsSetMode() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.mode (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:mode: ", p), err) + } + } + return err +} + +func (p *HostAttributes) writeField4(oprot thrift.TProtocol) (err error) { + if p.IsSetSlaveId() { + if err := oprot.WriteFieldBegin("slaveId", thrift.STRING, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:slaveId: ", p), err) + } + if err := oprot.WriteString(string(*p.SlaveId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.slaveId (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:slaveId: ", p), err) + } + } + return err +} + +func (p *HostAttributes) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("HostAttributes(%+v)", *p) +} + +// A constraint that specifies an explicit set of values, at least one of which must be present +// on a host for a task to be scheduled there. +// +// Attributes: +// - Negated: If true, treat this as a 'not' - to avoid specific values. +// - Values +type ValueConstraint struct { + Negated bool `thrift:"negated,1" json:"negated"` + Values map[string]bool `thrift:"values,2" json:"values"` +} + +func NewValueConstraint() *ValueConstraint { + return &ValueConstraint{} +} + +func (p *ValueConstraint) GetNegated() bool { + return p.Negated +} + +func (p *ValueConstraint) GetValues() map[string]bool { + return p.Values +} +func (p *ValueConstraint) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Negated = v + } + return nil +} + +func (p *ValueConstraint) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.Values = tSet + for i := 0; i < size; i++ { + var _elem2 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem2 = v + } + p.Values[_elem2] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:negated: ", p), err) + } + if err := oprot.WriteBool(bool(p.Negated)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.negated (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Values { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:values: ", p), err) + } + return err +} + +func (p *ValueConstraint) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ValueConstraint(%+v)", *p) +} + +// A constraint the specifies the maximum number of active tasks on a host with a matching +// attribute that may be scheduled simultaneously. +// +// Attributes: +// - Limit +type LimitConstraint struct { + Limit int32 `thrift:"limit,1" json:"limit"` +} + +func NewLimitConstraint() *LimitConstraint { + return &LimitConstraint{} +} + +func (p *LimitConstraint) GetLimit() int32 { + return p.Limit +} +func (p *LimitConstraint) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Limit = v + } + return nil +} + +func (p *LimitConstraint) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("LimitConstraint"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:limit: ", p), err) + } + if err := oprot.WriteI32(int32(p.Limit)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.limit (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:limit: ", p), err) + } + return err +} + +func (p *LimitConstraint) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LimitConstraint(%+v)", *p) +} + +// Types of constraints that may be applied to a task. +// +// Attributes: +// - Value +// - Limit +type TaskConstraint struct { + Value *ValueConstraint `thrift:"value,1" json:"value,omitempty"` + Limit *LimitConstraint `thrift:"limit,2" json:"limit,omitempty"` +} + +func NewTaskConstraint() *TaskConstraint { + return &TaskConstraint{} +} + +var TaskConstraint_Value_DEFAULT *ValueConstraint + +func (p *TaskConstraint) GetValue() *ValueConstraint { + if !p.IsSetValue() { + return TaskConstraint_Value_DEFAULT + } + return p.Value +} + +var TaskConstraint_Limit_DEFAULT *LimitConstraint + +func (p *TaskConstraint) GetLimit() *LimitConstraint { + if !p.IsSetLimit() { + return TaskConstraint_Limit_DEFAULT + } + return p.Limit +} +func (p *TaskConstraint) CountSetFieldsTaskConstraint() int { + count := 0 + if p.IsSetValue() { + count++ + } + if p.IsSetLimit() { + count++ + } + return count + +} + +func (p *TaskConstraint) IsSetValue() bool { + return p.Value != nil +} + +func (p *TaskConstraint) IsSetLimit() bool { + return p.Limit != nil +} + +func (p *TaskConstraint) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *TaskConstraint) readField1(iprot thrift.TProtocol) error { + p.Value = &ValueConstraint{} + if err := p.Value.Read(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 { + p.Limit = &LimitConstraint{} + if err := p.Limit.Read(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 { + 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *TaskConstraint) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetValue() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Value), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetLimit() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Limit), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:limit: ", p), err) + } + } + return err +} + +func (p *TaskConstraint) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TaskConstraint(%+v)", *p) +} + +// A constraint that defines whether a task may be scheduled on a host. +// +// Attributes: +// - Name: Mesos slave attribute that the constraint is matched against. +// - Constraint +type Constraint struct { + Name string `thrift:"name,1" json:"name"` + Constraint *TaskConstraint `thrift:"constraint,2" json:"constraint"` +} + +func NewConstraint() *Constraint { + return &Constraint{} +} + +func (p *Constraint) GetName() string { + return p.Name +} + +var Constraint_Constraint_DEFAULT *TaskConstraint + +func (p *Constraint) GetConstraint() *TaskConstraint { + if !p.IsSetConstraint() { + return Constraint_Constraint_DEFAULT + } + return p.Constraint +} +func (p *Constraint) IsSetConstraint() bool { + return p.Constraint != nil +} + +func (p *Constraint) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *Constraint) readField2(iprot thrift.TProtocol) error { + p.Constraint = &TaskConstraint{} + if err := p.Constraint.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:constraint: ", p), err) + } + if err := p.Constraint.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Constraint), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:constraint: ", p), err) + } + return err +} + +func (p *Constraint) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Constraint(%+v)", *p) +} + +// Attributes: +// - Role +// - Name +// - Version +type Package struct { + Role string `thrift:"role,1" json:"role"` + Name string `thrift:"name,2" json:"name"` + Version int32 `thrift:"version,3" json:"version"` +} + +func NewPackage() *Package { + return &Package{} +} + +func (p *Package) GetRole() string { + return p.Role +} + +func (p *Package) GetName() string { + return p.Name +} + +func (p *Package) GetVersion() int32 { + return p.Version +} +func (p *Package) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *Package) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *Package) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Version = v + } + return nil +} + +func (p *Package) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Package"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) + } + if err := oprot.WriteString(string(p.Role)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:version: ", p), err) + } + if err := oprot.WriteI32(int32(p.Version)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.version (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:version: ", p), err) + } + return err +} + +func (p *Package) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Package(%+v)", *p) +} + +// Arbitrary key-value metadata to be included into TaskConfig. +// +// Attributes: +// - Key +// - Value +type Metadata struct { + Key string `thrift:"key,1" json:"key"` + Value string `thrift:"value,2" json:"value"` +} + +func NewMetadata() *Metadata { + return &Metadata{} +} + +func (p *Metadata) GetKey() string { + return p.Key +} + +func (p *Metadata) GetValue() string { + return p.Value +} +func (p *Metadata) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Key = v + } + return nil +} + +func (p *Metadata) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Value = v + } + return nil +} + +func (p *Metadata) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Metadata"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) + } + if err := oprot.WriteString(string(p.Key)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) + } + if err := oprot.WriteString(string(p.Value)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) + } + return err +} + +func (p *Metadata) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Metadata(%+v)", *p) +} + +// A unique identifier for a Job. +// +// Attributes: +// - Role: User role (Unix service account), for example "mesos" +// - Environment: Environment, for example "devel" +// - Name: Name, for example "labrat" +type JobKey struct { + Role string `thrift:"role,1" json:"role"` + Environment string `thrift:"environment,2" json:"environment"` + Name string `thrift:"name,3" json:"name"` +} + +func NewJobKey() *JobKey { + return &JobKey{} +} + +func (p *JobKey) GetRole() string { + return p.Role +} + +func (p *JobKey) GetEnvironment() string { + return p.Environment +} + +func (p *JobKey) GetName() string { + return p.Name +} +func (p *JobKey) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *JobKey) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Environment = v + } + return nil +} + +func (p *JobKey) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *JobKey) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobKey"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) + } + if err := oprot.WriteString(string(p.Role)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:environment: ", p), err) + } + if err := oprot.WriteString(string(p.Environment)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.environment (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) + } + return err +} + +func (p *JobKey) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobKey(%+v)", *p) +} + +// A unique lock key. +// +// Attributes: +// - Job +type LockKey struct { + Job *JobKey `thrift:"job,1" json:"job,omitempty"` +} + +func NewLockKey() *LockKey { + return &LockKey{} +} + +var LockKey_Job_DEFAULT *JobKey + +func (p *LockKey) GetJob() *JobKey { + if !p.IsSetJob() { + return LockKey_Job_DEFAULT + } + return p.Job +} +func (p *LockKey) CountSetFieldsLockKey() int { + count := 0 + if p.IsSetJob() { + count++ + } + return count + +} + +func (p *LockKey) IsSetJob() bool { + return p.Job != nil +} + +func (p *LockKey) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *LockKey) readField1(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *LockKey) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetJob() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:job: ", p), err) + } + } + return err +} + +func (p *LockKey) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LockKey(%+v)", *p) +} + +// A generic lock struct to facilitate context specific resource/operation serialization. +// +// Attributes: +// - Key: ID of the lock - unique per storage +// - Token: UUID - facilitating soft lock authorization +// - User: Lock creator +// - TimestampMs: Lock creation timestamp in milliseconds +// - Message: Optional message to record with the lock +type Lock struct { + Key *LockKey `thrift:"key,1" json:"key"` + Token string `thrift:"token,2" json:"token"` + User string `thrift:"user,3" json:"user"` + TimestampMs int64 `thrift:"timestampMs,4" json:"timestampMs"` + Message *string `thrift:"message,5" json:"message,omitempty"` +} + +func NewLock() *Lock { + return &Lock{} +} + +var Lock_Key_DEFAULT *LockKey + +func (p *Lock) GetKey() *LockKey { + if !p.IsSetKey() { + return Lock_Key_DEFAULT + } + return p.Key +} + +func (p *Lock) GetToken() string { + return p.Token +} + +func (p *Lock) GetUser() string { + return p.User +} + +func (p *Lock) GetTimestampMs() int64 { + return p.TimestampMs +} + +var Lock_Message_DEFAULT string + +func (p *Lock) GetMessage() string { + if !p.IsSetMessage() { + return Lock_Message_DEFAULT + } + return *p.Message +} +func (p *Lock) IsSetKey() bool { + return p.Key != nil +} + +func (p *Lock) IsSetMessage() bool { + return p.Message != nil +} + +func (p *Lock) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *Lock) readField1(iprot thrift.TProtocol) error { + p.Key = &LockKey{} + if err := p.Key.Read(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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Token = v + } + return nil +} + +func (p *Lock) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.User = v + } + return nil +} + +func (p *Lock) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.TimestampMs = v + } + return nil +} + +func (p *Lock) readField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 5: ", err) + } else { + p.Message = &v + } + return nil +} + +func (p *Lock) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Lock"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:token: ", p), err) + } + if err := oprot.WriteString(string(p.Token)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.token (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) + } + if err := oprot.WriteString(string(p.User)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:timestampMs: ", p), err) + } + if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestampMs (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetMessage() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:message: ", p), err) + } + } + return err +} + +func (p *Lock) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Lock(%+v)", *p) +} + +// A unique identifier for the active task within a job. +// +// Attributes: +// - JobKey: Key identifying the job. +// - InstanceId: Unique instance ID for the active task in a job. +type InstanceKey struct { + JobKey *JobKey `thrift:"jobKey,1" json:"jobKey"` + InstanceId int32 `thrift:"instanceId,2" json:"instanceId"` +} + +func NewInstanceKey() *InstanceKey { + return &InstanceKey{} +} + +var InstanceKey_JobKey_DEFAULT *JobKey + +func (p *InstanceKey) GetJobKey() *JobKey { + if !p.IsSetJobKey() { + return InstanceKey_JobKey_DEFAULT + } + return p.JobKey +} + +func (p *InstanceKey) GetInstanceId() int32 { + return p.InstanceId +} +func (p *InstanceKey) IsSetJobKey() bool { + return p.JobKey != nil +} + +func (p *InstanceKey) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *InstanceKey) readField1(iprot thrift.TProtocol) error { + p.JobKey = &JobKey{} + if err := p.JobKey.Read(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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.InstanceId = v + } + return nil +} + +func (p *InstanceKey) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("InstanceKey"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobKey: ", p), err) + } + if err := p.JobKey.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceId: ", p), err) + } + if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.instanceId (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceId: ", p), err) + } + return err +} + +func (p *InstanceKey) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("InstanceKey(%+v)", *p) +} + +// URI which mirrors CommandInfo.URI in the Mesos Protobuf +// +// Attributes: +// - Value: Where to get the resource from +// - Extract: Extract compressed archive after downloading +// - Cache: Cache value using Mesos Fetcher caching mechanism * +type MesosFetcherURI struct { + Value string `thrift:"value,1" json:"value"` + Extract *bool `thrift:"extract,2" json:"extract,omitempty"` + Cache *bool `thrift:"cache,3" json:"cache,omitempty"` +} + +func NewMesosFetcherURI() *MesosFetcherURI { + return &MesosFetcherURI{} +} + +func (p *MesosFetcherURI) GetValue() string { + return p.Value +} + +var MesosFetcherURI_Extract_DEFAULT bool + +func (p *MesosFetcherURI) GetExtract() bool { + if !p.IsSetExtract() { + return MesosFetcherURI_Extract_DEFAULT + } + return *p.Extract +} + +var MesosFetcherURI_Cache_DEFAULT bool + +func (p *MesosFetcherURI) GetCache() bool { + if !p.IsSetCache() { + return MesosFetcherURI_Cache_DEFAULT + } + return *p.Cache +} +func (p *MesosFetcherURI) IsSetExtract() bool { + return p.Extract != nil +} + +func (p *MesosFetcherURI) IsSetCache() bool { + return p.Cache != nil +} + +func (p *MesosFetcherURI) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Value = v + } + return nil +} + +func (p *MesosFetcherURI) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Extract = &v + } + return nil +} + +func (p *MesosFetcherURI) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Cache = &v + } + return nil +} + +func (p *MesosFetcherURI) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("MesosFetcherURI"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:value: ", p), err) + } + if err := oprot.WriteString(string(p.Value)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.value (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetExtract() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.extract (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetCache() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.cache (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cache: ", p), err) + } + } + return err +} + +func (p *MesosFetcherURI) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("MesosFetcherURI(%+v)", *p) +} + +// Attributes: +// - Name: Name identifying the Executor. +// - Data: Executor configuration data. +type ExecutorConfig struct { + Name string `thrift:"name,1" json:"name"` + Data string `thrift:"data,2" json:"data"` +} + +func NewExecutorConfig() *ExecutorConfig { + return &ExecutorConfig{} +} + +func (p *ExecutorConfig) GetName() string { + return p.Name +} + +func (p *ExecutorConfig) GetData() string { + return p.Data +} +func (p *ExecutorConfig) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *ExecutorConfig) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Data = v + } + return nil +} + +func (p *ExecutorConfig) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("ExecutorConfig"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:data: ", p), err) + } + if err := oprot.WriteString(string(p.Data)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.data (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:data: ", p), err) + } + return err +} + +func (p *ExecutorConfig) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ExecutorConfig(%+v)", *p) +} + +// A volume mount point within a container +// +// Attributes: +// - ContainerPath: The path inside the container where the mount will be created. +// - HostPath: The path on the host that will serve as the source for the mount. +// - Mode: The access mode +type Volume struct { + ContainerPath string `thrift:"containerPath,1" json:"containerPath"` + HostPath string `thrift:"hostPath,2" json:"hostPath"` + Mode Mode `thrift:"mode,3" json:"mode"` +} + +func NewVolume() *Volume { + return &Volume{} +} + +func (p *Volume) GetContainerPath() string { + return p.ContainerPath +} + +func (p *Volume) GetHostPath() string { + return p.HostPath +} + +func (p *Volume) GetMode() Mode { + return p.Mode +} +func (p *Volume) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.ContainerPath = v + } + return nil +} + +func (p *Volume) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.HostPath = v + } + return nil +} + +func (p *Volume) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + temp := Mode(v) + p.Mode = temp + } + return nil +} + +func (p *Volume) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Volume"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:containerPath: ", p), err) + } + if err := oprot.WriteString(string(p.ContainerPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.containerPath (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hostPath: ", p), err) + } + if err := oprot.WriteString(string(p.HostPath)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.hostPath (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:mode: ", p), err) + } + if err := oprot.WriteI32(int32(p.Mode)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.mode (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:mode: ", p), err) + } + return err +} + +func (p *Volume) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Volume(%+v)", *p) +} + +// Describes an image for use with the Mesos unified containerizer in the Docker format +// +// Attributes: +// - Name: The name of the image to run +// - Tag: The Docker tag identifying the image +type DockerImage struct { + Name string `thrift:"name,1" json:"name"` + Tag string `thrift:"tag,2" json:"tag"` +} + +func NewDockerImage() *DockerImage { + return &DockerImage{} +} + +func (p *DockerImage) GetName() string { + return p.Name +} + +func (p *DockerImage) GetTag() string { + return p.Tag +} +func (p *DockerImage) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *DockerImage) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Tag = v + } + return nil +} + +func (p *DockerImage) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("DockerImage"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tag: ", p), err) + } + if err := oprot.WriteString(string(p.Tag)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.tag (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tag: ", p), err) + } + return err +} + +func (p *DockerImage) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("DockerImage(%+v)", *p) +} + +// Describes an image for use with the Mesos unified containerizer in the AppC format +// +// Attributes: +// - Name: The name of the image to run +// - ImageId: The appc image id identifying the image +type AppcImage struct { + Name string `thrift:"name,1" json:"name"` + ImageId string `thrift:"imageId,2" json:"imageId"` +} + +func NewAppcImage() *AppcImage { + return &AppcImage{} +} + +func (p *AppcImage) GetName() string { + return p.Name +} + +func (p *AppcImage) GetImageId() string { + return p.ImageId +} +func (p *AppcImage) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *AppcImage) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.ImageId = v + } + return nil +} + +func (p *AppcImage) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("AppcImage"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:imageId: ", p), err) + } + if err := oprot.WriteString(string(p.ImageId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.imageId (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:imageId: ", p), err) + } + return err +} + +func (p *AppcImage) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AppcImage(%+v)", *p) +} + +// Describes an image to be used with the Mesos unified containerizer +// +// Attributes: +// - Docker +// - Appc +type Image struct { + Docker *DockerImage `thrift:"docker,1" json:"docker,omitempty"` + Appc *AppcImage `thrift:"appc,2" json:"appc,omitempty"` +} + +func NewImage() *Image { + return &Image{} +} + +var Image_Docker_DEFAULT *DockerImage + +func (p *Image) GetDocker() *DockerImage { + if !p.IsSetDocker() { + return Image_Docker_DEFAULT + } + return p.Docker +} + +var Image_Appc_DEFAULT *AppcImage + +func (p *Image) GetAppc() *AppcImage { + if !p.IsSetAppc() { + return Image_Appc_DEFAULT + } + return p.Appc +} +func (p *Image) CountSetFieldsImage() int { + count := 0 + if p.IsSetDocker() { + count++ + } + if p.IsSetAppc() { + count++ + } + return count + +} + +func (p *Image) IsSetDocker() bool { + return p.Docker != nil +} + +func (p *Image) IsSetAppc() bool { + return p.Appc != nil +} + +func (p *Image) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *Image) readField1(iprot thrift.TProtocol) error { + p.Docker = &DockerImage{} + if err := p.Docker.Read(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 { + p.Appc = &AppcImage{} + if err := p.Appc.Read(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 { + 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *Image) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetDocker() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetAppc() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Appc), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:appc: ", p), err) + } + } + return err +} + +func (p *Image) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Image(%+v)", *p) +} + +// Describes a mesos container, this is the default +// +// Attributes: +// - Image: the optional filesystem image to use when launching this task. +type MesosContainer struct { + Image *Image `thrift:"image,1" json:"image,omitempty"` +} + +func NewMesosContainer() *MesosContainer { + return &MesosContainer{} +} + +var MesosContainer_Image_DEFAULT *Image + +func (p *MesosContainer) GetImage() *Image { + if !p.IsSetImage() { + return MesosContainer_Image_DEFAULT + } + return p.Image +} +func (p *MesosContainer) IsSetImage() bool { + return p.Image != nil +} + +func (p *MesosContainer) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *MesosContainer) readField1(iprot thrift.TProtocol) error { + p.Image = &Image{} + if err := p.Image.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Image), err) + } + return nil +} + +func (p *MesosContainer) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("MesosContainer"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *MesosContainer) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetImage() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Image), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:image: ", p), err) + } + } + return err +} + +func (p *MesosContainer) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("MesosContainer(%+v)", *p) +} + +// Describes a parameter passed to docker cli +// +// Attributes: +// - Name: a parameter to pass to docker. (e.g. volume) +// - Value: the value to pass to a parameter (e.g. /src/webapp:/opt/webapp) +type DockerParameter struct { + Name string `thrift:"name,1" json:"name"` + Value string `thrift:"value,2" json:"value"` +} + +func NewDockerParameter() *DockerParameter { + return &DockerParameter{} +} + +func (p *DockerParameter) GetName() string { + return p.Name +} + +func (p *DockerParameter) GetValue() string { + return p.Value +} +func (p *DockerParameter) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *DockerParameter) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Value = v + } + return nil +} + +func (p *DockerParameter) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("DockerParameter"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) + } + if err := oprot.WriteString(string(p.Value)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) + } + return err +} + +func (p *DockerParameter) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("DockerParameter(%+v)", *p) +} + +// Describes a docker container +// +// Attributes: +// - Image: The container image to be run +// - Parameters: The arbitrary parameters to pass to container +type DockerContainer struct { + Image string `thrift:"image,1" json:"image"` + Parameters []*DockerParameter `thrift:"parameters,2" json:"parameters,omitempty"` +} + +func NewDockerContainer() *DockerContainer { + return &DockerContainer{} +} + +func (p *DockerContainer) GetImage() string { + return p.Image +} + +var DockerContainer_Parameters_DEFAULT []*DockerParameter + +func (p *DockerContainer) GetParameters() []*DockerParameter { + return p.Parameters +} +func (p *DockerContainer) IsSetParameters() bool { + return p.Parameters != nil +} + +func (p *DockerContainer) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Image = v + } + return nil +} + +func (p *DockerContainer) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + 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++ { + _elem3 := &DockerParameter{} + if err := _elem3.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) + } + p.Parameters = append(p.Parameters, _elem3) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:image: ", p), err) + } + if err := oprot.WriteString(string(p.Image)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.image (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetParameters() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Parameters { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parameters: ", p), err) + } + } + return err +} + +func (p *DockerContainer) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("DockerContainer(%+v)", *p) +} + +// Describes a container to be used in a task +// +// Attributes: +// - Mesos +// - Docker +type Container struct { + Mesos *MesosContainer `thrift:"mesos,1" json:"mesos,omitempty"` + Docker *DockerContainer `thrift:"docker,2" json:"docker,omitempty"` +} + +func NewContainer() *Container { + return &Container{} +} + +var Container_Mesos_DEFAULT *MesosContainer + +func (p *Container) GetMesos() *MesosContainer { + if !p.IsSetMesos() { + return Container_Mesos_DEFAULT + } + return p.Mesos +} + +var Container_Docker_DEFAULT *DockerContainer + +func (p *Container) GetDocker() *DockerContainer { + if !p.IsSetDocker() { + return Container_Docker_DEFAULT + } + return p.Docker +} +func (p *Container) CountSetFieldsContainer() int { + count := 0 + if p.IsSetMesos() { + count++ + } + if p.IsSetDocker() { + count++ + } + return count + +} + +func (p *Container) IsSetMesos() bool { + return p.Mesos != nil +} + +func (p *Container) IsSetDocker() bool { + return p.Docker != nil +} + +func (p *Container) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *Container) readField1(iprot thrift.TProtocol) error { + p.Mesos = &MesosContainer{} + if err := p.Mesos.Read(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 { + p.Docker = &DockerContainer{} + if err := p.Docker.Read(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 { + 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *Container) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetMesos() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Mesos), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetDocker() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Docker), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:docker: ", p), err) + } + } + return err +} + +func (p *Container) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Container(%+v)", *p) +} + +// Describes resource value required to run a task. +// +// Attributes: +// - NumCpus +// - RamMb +// - DiskMb +// - NamedPort +// - NumGpus +type Resource struct { + NumCpus *float64 `thrift:"numCpus,1" json:"numCpus,omitempty"` + RamMb *int64 `thrift:"ramMb,2" json:"ramMb,omitempty"` + DiskMb *int64 `thrift:"diskMb,3" json:"diskMb,omitempty"` + NamedPort *string `thrift:"namedPort,4" json:"namedPort,omitempty"` + NumGpus *int64 `thrift:"numGpus,5" json:"numGpus,omitempty"` +} + +func NewResource() *Resource { + return &Resource{} +} + +var Resource_NumCpus_DEFAULT float64 + +func (p *Resource) GetNumCpus() float64 { + if !p.IsSetNumCpus() { + return Resource_NumCpus_DEFAULT + } + return *p.NumCpus +} + +var Resource_RamMb_DEFAULT int64 + +func (p *Resource) GetRamMb() int64 { + if !p.IsSetRamMb() { + return Resource_RamMb_DEFAULT + } + return *p.RamMb +} + +var Resource_DiskMb_DEFAULT int64 + +func (p *Resource) GetDiskMb() int64 { + if !p.IsSetDiskMb() { + return Resource_DiskMb_DEFAULT + } + return *p.DiskMb +} + +var Resource_NamedPort_DEFAULT string + +func (p *Resource) GetNamedPort() string { + if !p.IsSetNamedPort() { + return Resource_NamedPort_DEFAULT + } + return *p.NamedPort +} + +var Resource_NumGpus_DEFAULT int64 + +func (p *Resource) GetNumGpus() int64 { + if !p.IsSetNumGpus() { + return Resource_NumGpus_DEFAULT + } + return *p.NumGpus +} +func (p *Resource) CountSetFieldsResource() int { + count := 0 + if p.IsSetNumCpus() { + count++ + } + if p.IsSetRamMb() { + count++ + } + if p.IsSetDiskMb() { + count++ + } + if p.IsSetNamedPort() { + count++ + } + if p.IsSetNumGpus() { + count++ + } + return count + +} + +func (p *Resource) IsSetNumCpus() bool { + return p.NumCpus != nil +} + +func (p *Resource) IsSetRamMb() bool { + return p.RamMb != nil +} + +func (p *Resource) IsSetDiskMb() bool { + return p.DiskMb != nil +} + +func (p *Resource) IsSetNamedPort() bool { + return p.NamedPort != nil +} + +func (p *Resource) IsSetNumGpus() bool { + return p.NumGpus != nil +} + +func (p *Resource) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.NumCpus = &v + } + return nil +} + +func (p *Resource) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.RamMb = &v + } + return nil +} + +func (p *Resource) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.DiskMb = &v + } + return nil +} + +func (p *Resource) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.NamedPort = &v + } + return nil +} + +func (p *Resource) readField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 5: ", err) + } else { + p.NumGpus = &v + } + return nil +} + +func (p *Resource) Write(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *Resource) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetNumCpus() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.numCpus (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetRamMb() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.ramMb (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetDiskMb() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.diskMb (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetNamedPort() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.namedPort (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetNumGpus() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.numGpus (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:numGpus: ", p), err) + } + } + return err +} + +func (p *Resource) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Resource(%+v)", *p) +} + +// Description of the tasks contained within a job. +// +// Attributes: +// - Job: Job task belongs to. +// - Owner: contains the role component of JobKey +// - IsService +// - NumCpus +// - RamMb +// - DiskMb +// - Priority +// - MaxTaskFailures +// - Production: Whether this is a production task, which can preempt. +// - Tier: Task tier type. +// - Resources: All resources required to run a task. +// - MesosFetcherUris: Resources to retrieve with Mesos Fetcher +// - Constraints +// - RequestedPorts: a list of named ports this task requests +// - TaskLinks: Custom links to include when displaying this task on the scheduler dashboard. Keys are anchor +// text, values are URLs. Wildcards are supported for dynamic link crafting based on host, ports, +// instance, etc. +// - ContactEmail +// - ExecutorConfig: Executor configuration +// - Metadata: Used to display additional details in the UI. +// - Container: the container the task should use to execute +type TaskConfig struct { + // unused fields # 1 to 6 + IsService bool `thrift:"isService,7" json:"isService"` + NumCpus float64 `thrift:"numCpus,8" json:"numCpus"` + RamMb int64 `thrift:"ramMb,9" json:"ramMb"` + DiskMb int64 `thrift:"diskMb,10" json:"diskMb"` + Priority int32 `thrift:"priority,11" json:"priority"` + // unused field # 12 + MaxTaskFailures int32 `thrift:"maxTaskFailures,13" json:"maxTaskFailures"` + // unused fields # 14 to 16 + Owner *Identity `thrift:"owner,17" json:"owner"` + Production *bool `thrift:"production,18" json:"production,omitempty"` + // unused field # 19 + Constraints map[*Constraint]bool `thrift:"constraints,20" json:"constraints"` + RequestedPorts map[string]bool `thrift:"requestedPorts,21" json:"requestedPorts"` + TaskLinks map[string]string `thrift:"taskLinks,22" json:"taskLinks,omitempty"` + ContactEmail *string `thrift:"contactEmail,23" json:"contactEmail,omitempty"` + // unused field # 24 + ExecutorConfig *ExecutorConfig `thrift:"executorConfig,25" json:"executorConfig,omitempty"` + // unused field # 26 + Metadata map[*Metadata]bool `thrift:"metadata,27" json:"metadata,omitempty"` + Job *JobKey `thrift:"job,28" json:"job"` + Container *Container `thrift:"container,29" json:"container"` + Tier *string `thrift:"tier,30" json:"tier,omitempty"` + // unused field # 31 + Resources map[*Resource]bool `thrift:"resources,32" json:"resources"` + MesosFetcherUris map[*MesosFetcherURI]bool `thrift:"mesosFetcherUris,33" json:"mesosFetcherUris,omitempty"` +} + +func NewTaskConfig() *TaskConfig { + return &TaskConfig{} +} + +var TaskConfig_Job_DEFAULT *JobKey + +func (p *TaskConfig) GetJob() *JobKey { + if !p.IsSetJob() { + return TaskConfig_Job_DEFAULT + } + return p.Job +} + +var TaskConfig_Owner_DEFAULT *Identity + +func (p *TaskConfig) GetOwner() *Identity { + if !p.IsSetOwner() { + return TaskConfig_Owner_DEFAULT + } + return p.Owner +} + +func (p *TaskConfig) GetIsService() bool { + return p.IsService +} + +func (p *TaskConfig) GetNumCpus() float64 { + return p.NumCpus +} + +func (p *TaskConfig) GetRamMb() int64 { + return p.RamMb +} + +func (p *TaskConfig) GetDiskMb() int64 { + return p.DiskMb +} + +func (p *TaskConfig) GetPriority() int32 { + return p.Priority +} + +func (p *TaskConfig) GetMaxTaskFailures() int32 { + return p.MaxTaskFailures +} + +var TaskConfig_Production_DEFAULT bool + +func (p *TaskConfig) GetProduction() bool { + if !p.IsSetProduction() { + return TaskConfig_Production_DEFAULT + } + return *p.Production +} + +var TaskConfig_Tier_DEFAULT string + +func (p *TaskConfig) GetTier() string { + if !p.IsSetTier() { + return TaskConfig_Tier_DEFAULT + } + return *p.Tier +} + +func (p *TaskConfig) GetResources() map[*Resource]bool { + return p.Resources +} + +var TaskConfig_MesosFetcherUris_DEFAULT map[*MesosFetcherURI]bool + +func (p *TaskConfig) GetMesosFetcherUris() map[*MesosFetcherURI]bool { + return p.MesosFetcherUris +} + +func (p *TaskConfig) GetConstraints() map[*Constraint]bool { + return p.Constraints +} + +func (p *TaskConfig) GetRequestedPorts() map[string]bool { + return p.RequestedPorts +} + +var TaskConfig_TaskLinks_DEFAULT map[string]string + +func (p *TaskConfig) GetTaskLinks() map[string]string { + return p.TaskLinks +} + +var TaskConfig_ContactEmail_DEFAULT string + +func (p *TaskConfig) GetContactEmail() string { + if !p.IsSetContactEmail() { + return TaskConfig_ContactEmail_DEFAULT + } + return *p.ContactEmail +} + +var TaskConfig_ExecutorConfig_DEFAULT *ExecutorConfig + +func (p *TaskConfig) GetExecutorConfig() *ExecutorConfig { + if !p.IsSetExecutorConfig() { + return TaskConfig_ExecutorConfig_DEFAULT + } + return p.ExecutorConfig +} + +var TaskConfig_Metadata_DEFAULT map[*Metadata]bool + +func (p *TaskConfig) GetMetadata() map[*Metadata]bool { + return p.Metadata +} + +var TaskConfig_Container_DEFAULT *Container = &Container{ + Mesos: &MesosContainer{}, +} + +func (p *TaskConfig) GetContainer() *Container { + if !p.IsSetContainer() { + return TaskConfig_Container_DEFAULT + } + return p.Container +} +func (p *TaskConfig) IsSetJob() bool { + return p.Job != nil +} + +func (p *TaskConfig) IsSetOwner() bool { + return p.Owner != nil +} + +func (p *TaskConfig) IsSetProduction() bool { + return p.Production != nil +} + +func (p *TaskConfig) IsSetTier() bool { + return p.Tier != nil +} + +func (p *TaskConfig) IsSetMesosFetcherUris() bool { + return p.MesosFetcherUris != nil +} + +func (p *TaskConfig) IsSetTaskLinks() bool { + return p.TaskLinks != nil +} + +func (p *TaskConfig) IsSetContactEmail() bool { + return p.ContactEmail != nil +} + +func (p *TaskConfig) IsSetExecutorConfig() bool { + return p.ExecutorConfig != nil +} + +func (p *TaskConfig) IsSetMetadata() bool { + return p.Metadata != nil +} + +func (p *TaskConfig) IsSetContainer() bool { + return p.Container != nil +} + +func (p *TaskConfig) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 28: + if err := p.readField28(iprot); err != nil { + return err + } + case 17: + if err := p.readField17(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 10: + if err := p.readField10(iprot); err != nil { + return err + } + case 11: + if err := p.readField11(iprot); err != nil { + return err + } + case 13: + if err := p.readField13(iprot); err != nil { + return err + } + case 18: + if err := p.readField18(iprot); err != nil { + return err + } + case 30: + if err := p.readField30(iprot); err != nil { + return err + } + case 32: + if err := p.readField32(iprot); err != nil { + return err + } + case 33: + if err := p.readField33(iprot); err != nil { + return err + } + case 20: + if err := p.readField20(iprot); err != nil { + return err + } + case 21: + if err := p.readField21(iprot); err != nil { + return err + } + case 22: + if err := p.readField22(iprot); err != nil { + return err + } + case 23: + if err := p.readField23(iprot); err != nil { + return err + } + case 25: + if err := p.readField25(iprot); err != nil { + return err + } + case 27: + if err := p.readField27(iprot); err != nil { + return err + } + case 29: + if err := p.readField29(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *TaskConfig) readField28(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + p.Owner = &Identity{} + if err := p.Owner.Read(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 { + return thrift.PrependError("error reading field 7: ", err) + } else { + p.IsService = v + } + return nil +} + +func (p *TaskConfig) readField8(iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(); err != nil { + return thrift.PrependError("error reading field 8: ", err) + } else { + p.NumCpus = v + } + return nil +} + +func (p *TaskConfig) readField9(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 9: ", err) + } else { + p.RamMb = v + } + return nil +} + +func (p *TaskConfig) readField10(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 10: ", err) + } else { + p.DiskMb = v + } + return nil +} + +func (p *TaskConfig) readField11(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 11: ", err) + } else { + p.Priority = v + } + return nil +} + +func (p *TaskConfig) readField13(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 13: ", err) + } else { + p.MaxTaskFailures = v + } + return nil +} + +func (p *TaskConfig) readField18(iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return thrift.PrependError("error reading field 18: ", err) + } else { + p.Production = &v + } + return nil +} + +func (p *TaskConfig) readField30(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 30: ", err) + } else { + p.Tier = &v + } + return nil +} + +func (p *TaskConfig) readField32(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Resource]bool, size) + p.Resources = tSet + for i := 0; i < size; i++ { + _elem4 := &Resource{} + if err := _elem4.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) + } + p.Resources[_elem4] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskConfig) readField33(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*MesosFetcherURI]bool, size) + p.MesosFetcherUris = tSet + for i := 0; i < size; i++ { + _elem5 := &MesosFetcherURI{} + if err := _elem5.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) + } + p.MesosFetcherUris[_elem5] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskConfig) readField20(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Constraint]bool, 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) + } + p.Constraints[_elem6] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskConfig) readField21(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.RequestedPorts = tSet + for i := 0; i < size; i++ { + var _elem7 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem7 = v + } + p.RequestedPorts[_elem7] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskConfig) readField22(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + 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 { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key8 = v + } + var _val9 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val9 = v + } + p.TaskLinks[_key8] = _val9 + } + if err := iprot.ReadMapEnd(); 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 { + return thrift.PrependError("error reading field 23: ", err) + } else { + p.ContactEmail = &v + } + return nil +} + +func (p *TaskConfig) readField25(iprot thrift.TProtocol) error { + p.ExecutorConfig = &ExecutorConfig{} + if err := p.ExecutorConfig.Read(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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Metadata]bool, 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) + } + p.Metadata[_elem10] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskConfig) readField29(iprot thrift.TProtocol) error { + p.Container = &Container{} + if err := p.Container.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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.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.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.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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:isService: ", p), err) + } + if err := oprot.WriteBool(bool(p.IsService)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isService (7) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:isService: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField8(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("numCpus", thrift.DOUBLE, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:numCpus: ", p), err) + } + if err := oprot.WriteDouble(float64(p.NumCpus)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.numCpus (8) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:numCpus: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField9(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("ramMb", thrift.I64, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:ramMb: ", p), err) + } + if err := oprot.WriteI64(int64(p.RamMb)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.ramMb (9) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:ramMb: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField10(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("diskMb", thrift.I64, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:diskMb: ", p), err) + } + if err := oprot.WriteI64(int64(p.DiskMb)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.diskMb (10) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:diskMb: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField11(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.priority (11) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:maxTaskFailures: ", p), err) + } + if err := oprot.WriteI32(int32(p.MaxTaskFailures)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.maxTaskFailures (13) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 17:owner: ", p), err) + } + if err := p.Owner.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetProduction() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.production (18) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Constraints { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 20:constraints: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField21(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("requestedPorts", thrift.SET, 21); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 21:requestedPorts: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRING, len(p.RequestedPorts)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.RequestedPorts { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 21:requestedPorts: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField22(oprot thrift.TProtocol) (err error) { + if p.IsSetTaskLinks() { + if err := oprot.WriteFieldBegin("taskLinks", thrift.MAP, 22); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 22:taskLinks: ", p), err) + } + if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.TaskLinks)); err != nil { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.TaskLinks { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 22:taskLinks: ", p), err) + } + } + return err +} + +func (p *TaskConfig) writeField23(oprot thrift.TProtocol) (err error) { + if p.IsSetContactEmail() { + if err := oprot.WriteFieldBegin("contactEmail", thrift.STRING, 23); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 23:contactEmail: ", p), err) + } + if err := oprot.WriteString(string(*p.ContactEmail)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.contactEmail (23) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 23:contactEmail: ", p), err) + } + } + return err +} + +func (p *TaskConfig) writeField25(oprot thrift.TProtocol) (err error) { + if p.IsSetExecutorConfig() { + if err := oprot.WriteFieldBegin("executorConfig", thrift.STRUCT, 25); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 25:executorConfig: ", p), err) + } + if err := p.ExecutorConfig.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ExecutorConfig), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 25:executorConfig: ", p), err) + } + } + return err +} + +func (p *TaskConfig) writeField27(oprot thrift.TProtocol) (err error) { + if p.IsSetMetadata() { + if err := oprot.WriteFieldBegin("metadata", thrift.SET, 27); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 27:metadata: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Metadata)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Metadata { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 27:metadata: ", p), err) + } + } + return err +} + +func (p *TaskConfig) writeField28(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("job", thrift.STRUCT, 28); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 28:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 28:job: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField29(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("container", thrift.STRUCT, 29); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 29:container: ", p), err) + } + if err := p.Container.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Container), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 29:container: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField30(oprot thrift.TProtocol) (err error) { + if p.IsSetTier() { + if err := oprot.WriteFieldBegin("tier", thrift.STRING, 30); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 30:tier: ", p), err) + } + if err := oprot.WriteString(string(*p.Tier)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.tier (30) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 30:tier: ", p), err) + } + } + return err +} + +func (p *TaskConfig) writeField32(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("resources", thrift.SET, 32); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 32:resources: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Resources)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Resources { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 32:resources: ", p), err) + } + return err +} + +func (p *TaskConfig) writeField33(oprot thrift.TProtocol) (err error) { + if p.IsSetMesosFetcherUris() { + if err := oprot.WriteFieldBegin("mesosFetcherUris", thrift.SET, 33); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 33:mesosFetcherUris: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.MesosFetcherUris)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.MesosFetcherUris { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 33:mesosFetcherUris: ", p), err) + } + } + return err +} + +func (p *TaskConfig) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TaskConfig(%+v)", *p) +} + +// Attributes: +// - NumCpus: Number of CPU cores allotted. +// - RamMb: Megabytes of RAM allotted. +// - DiskMb: Megabytes of disk space allotted. +// - Resources: Aggregated resource values. +type ResourceAggregate struct { + NumCpus float64 `thrift:"numCpus,1" json:"numCpus"` + RamMb int64 `thrift:"ramMb,2" json:"ramMb"` + DiskMb int64 `thrift:"diskMb,3" json:"diskMb"` + Resources map[*Resource]bool `thrift:"resources,4" json:"resources"` +} + +func NewResourceAggregate() *ResourceAggregate { + return &ResourceAggregate{} +} + +func (p *ResourceAggregate) GetNumCpus() float64 { + return p.NumCpus +} + +func (p *ResourceAggregate) GetRamMb() int64 { + return p.RamMb +} + +func (p *ResourceAggregate) GetDiskMb() int64 { + return p.DiskMb +} + +func (p *ResourceAggregate) GetResources() map[*Resource]bool { + return p.Resources +} +func (p *ResourceAggregate) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ResourceAggregate) readField1(iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(); err != nil { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.NumCpus = v + } + return nil +} + +func (p *ResourceAggregate) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.RamMb = v + } + return nil +} + +func (p *ResourceAggregate) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.DiskMb = v + } + return nil +} + +func (p *ResourceAggregate) readField4(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Resource]bool, 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) + } + p.Resources[_elem11] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ResourceAggregate) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.numCpus (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:numCpus: ", p), err) + } + return err +} + +func (p *ResourceAggregate) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.ramMb (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:ramMb: ", p), err) + } + return err +} + +func (p *ResourceAggregate) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.diskMb (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:diskMb: ", p), err) + } + return err +} + +func (p *ResourceAggregate) writeField4(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Resources { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:resources: ", p), err) + } + return err +} + +func (p *ResourceAggregate) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ResourceAggregate(%+v)", *p) +} + +// Description of an Aurora job. One task will be scheduled for each instance within the job. +// +// Attributes: +// - Key: Key for this job. If not specified name, owner.role, and a reasonable default environment are +// used to construct it server-side. +// - Owner: Owner of this job. +// - CronSchedule: If present, the job will be handled as a cron job with this crontab-syntax schedule. +// - CronCollisionPolicy: Collision policy to use when handling overlapping cron runs. Default is KILL_EXISTING. +// - TaskConfig: Task configuration for this job. +// - InstanceCount: The number of instances in the job. Generated instance IDs for tasks will be in the range +// [0, instances). +type JobConfiguration struct { + // unused fields # 1 to 3 + CronSchedule *string `thrift:"cronSchedule,4" json:"cronSchedule,omitempty"` + CronCollisionPolicy CronCollisionPolicy `thrift:"cronCollisionPolicy,5" json:"cronCollisionPolicy"` + TaskConfig *TaskConfig `thrift:"taskConfig,6" json:"taskConfig"` + Owner *Identity `thrift:"owner,7" json:"owner"` + InstanceCount int32 `thrift:"instanceCount,8" json:"instanceCount"` + Key *JobKey `thrift:"key,9" json:"key"` +} + +func NewJobConfiguration() *JobConfiguration { + return &JobConfiguration{} +} + +var JobConfiguration_Key_DEFAULT *JobKey + +func (p *JobConfiguration) GetKey() *JobKey { + if !p.IsSetKey() { + return JobConfiguration_Key_DEFAULT + } + return p.Key +} + +var JobConfiguration_Owner_DEFAULT *Identity + +func (p *JobConfiguration) GetOwner() *Identity { + if !p.IsSetOwner() { + return JobConfiguration_Owner_DEFAULT + } + return p.Owner +} + +var JobConfiguration_CronSchedule_DEFAULT string + +func (p *JobConfiguration) GetCronSchedule() string { + if !p.IsSetCronSchedule() { + return JobConfiguration_CronSchedule_DEFAULT + } + return *p.CronSchedule +} + +func (p *JobConfiguration) GetCronCollisionPolicy() CronCollisionPolicy { + return p.CronCollisionPolicy +} + +var JobConfiguration_TaskConfig_DEFAULT *TaskConfig + +func (p *JobConfiguration) GetTaskConfig() *TaskConfig { + if !p.IsSetTaskConfig() { + return JobConfiguration_TaskConfig_DEFAULT + } + return p.TaskConfig +} + +func (p *JobConfiguration) GetInstanceCount() int32 { + return p.InstanceCount +} +func (p *JobConfiguration) IsSetKey() bool { + return p.Key != nil +} + +func (p *JobConfiguration) IsSetOwner() bool { + return p.Owner != nil +} + +func (p *JobConfiguration) IsSetCronSchedule() bool { + return p.CronSchedule != nil +} + +func (p *JobConfiguration) IsSetTaskConfig() bool { + return p.TaskConfig != nil +} + +func (p *JobConfiguration) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobConfiguration) readField9(iprot thrift.TProtocol) error { + p.Key = &JobKey{} + if err := p.Key.Read(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 { + p.Owner = &Identity{} + if err := p.Owner.Read(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 { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.CronSchedule = &v + } + return nil +} + +func (p *JobConfiguration) readField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 5: ", err) + } else { + temp := CronCollisionPolicy(v) + p.CronCollisionPolicy = temp + } + return nil +} + +func (p *JobConfiguration) readField6(iprot thrift.TProtocol) error { + p.TaskConfig = &TaskConfig{} + if err := p.TaskConfig.Read(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 { + return thrift.PrependError("error reading field 8: ", err) + } else { + p.InstanceCount = v + } + return nil +} + +func (p *JobConfiguration) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobConfiguration"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *JobConfiguration) writeField4(oprot thrift.TProtocol) (err error) { + if p.IsSetCronSchedule() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.cronSchedule (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:cronCollisionPolicy: ", p), err) + } + if err := oprot.WriteI32(int32(p.CronCollisionPolicy)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.cronCollisionPolicy (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:taskConfig: ", p), err) + } + if err := p.TaskConfig.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:owner: ", p), err) + } + if err := p.Owner.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Owner), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:instanceCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.instanceCount (8) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:key: ", p), err) + } + return err +} + +func (p *JobConfiguration) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobConfiguration(%+v)", *p) +} + +// Attributes: +// - ActiveTaskCount: Number of tasks in active state for this job. +// - FinishedTaskCount: Number of tasks in finished state for this job. +// - FailedTaskCount: Number of failed tasks for this job. +// - PendingTaskCount: Number of tasks in pending state for this job. +type JobStats struct { + ActiveTaskCount int32 `thrift:"activeTaskCount,1" json:"activeTaskCount"` + FinishedTaskCount int32 `thrift:"finishedTaskCount,2" json:"finishedTaskCount"` + FailedTaskCount int32 `thrift:"failedTaskCount,3" json:"failedTaskCount"` + PendingTaskCount int32 `thrift:"pendingTaskCount,4" json:"pendingTaskCount"` +} + +func NewJobStats() *JobStats { + return &JobStats{} +} + +func (p *JobStats) GetActiveTaskCount() int32 { + return p.ActiveTaskCount +} + +func (p *JobStats) GetFinishedTaskCount() int32 { + return p.FinishedTaskCount +} + +func (p *JobStats) GetFailedTaskCount() int32 { + return p.FailedTaskCount +} + +func (p *JobStats) GetPendingTaskCount() int32 { + return p.PendingTaskCount +} +func (p *JobStats) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.ActiveTaskCount = v + } + return nil +} + +func (p *JobStats) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.FinishedTaskCount = v + } + return nil +} + +func (p *JobStats) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.FailedTaskCount = v + } + return nil +} + +func (p *JobStats) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.PendingTaskCount = v + } + return nil +} + +func (p *JobStats) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobStats"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:activeTaskCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.ActiveTaskCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.activeTaskCount (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:finishedTaskCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.FinishedTaskCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.finishedTaskCount (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedTaskCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.FailedTaskCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.failedTaskCount (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:pendingTaskCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.PendingTaskCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.pendingTaskCount (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:pendingTaskCount: ", p), err) + } + return err +} + +func (p *JobStats) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobStats(%+v)", *p) +} + +// Attributes: +// - Job +// - Stats +// - NextCronRunMs: Timestamp of next cron run in ms since epoch, for a cron job +type JobSummary struct { + Job *JobConfiguration `thrift:"job,1" json:"job"` + Stats *JobStats `thrift:"stats,2" json:"stats"` + NextCronRunMs *int64 `thrift:"nextCronRunMs,3" json:"nextCronRunMs,omitempty"` +} + +func NewJobSummary() *JobSummary { + return &JobSummary{} +} + +var JobSummary_Job_DEFAULT *JobConfiguration + +func (p *JobSummary) GetJob() *JobConfiguration { + if !p.IsSetJob() { + return JobSummary_Job_DEFAULT + } + return p.Job +} + +var JobSummary_Stats_DEFAULT *JobStats + +func (p *JobSummary) GetStats() *JobStats { + if !p.IsSetStats() { + return JobSummary_Stats_DEFAULT + } + return p.Stats +} + +var JobSummary_NextCronRunMs_DEFAULT int64 + +func (p *JobSummary) GetNextCronRunMs() int64 { + if !p.IsSetNextCronRunMs() { + return JobSummary_NextCronRunMs_DEFAULT + } + return *p.NextCronRunMs +} +func (p *JobSummary) IsSetJob() bool { + return p.Job != nil +} + +func (p *JobSummary) IsSetStats() bool { + return p.Stats != nil +} + +func (p *JobSummary) IsSetNextCronRunMs() bool { + return p.NextCronRunMs != nil +} + +func (p *JobSummary) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobSummary) readField1(iprot thrift.TProtocol) error { + p.Job = &JobConfiguration{} + if err := p.Job.Read(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 { + p.Stats = &JobStats{} + if err := p.Stats.Read(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 { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.NextCronRunMs = &v + } + return nil +} + +func (p *JobSummary) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobSummary"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:stats: ", p), err) + } + if err := p.Stats.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetNextCronRunMs() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.nextCronRunMs (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nextCronRunMs: ", p), err) + } + } + return err +} + +func (p *JobSummary) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobSummary(%+v)", *p) +} + +// Closed range of integers. +// +// Attributes: +// - First +// - Last +type Range struct { + First int32 `thrift:"first,1" json:"first"` + Last int32 `thrift:"last,2" json:"last"` +} + +func NewRange() *Range { + return &Range{} +} + +func (p *Range) GetFirst() int32 { + return p.First +} + +func (p *Range) GetLast() int32 { + return p.Last +} +func (p *Range) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.First = v + } + return nil +} + +func (p *Range) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Last = v + } + return nil +} + +func (p *Range) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("Range"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:first: ", p), err) + } + if err := oprot.WriteI32(int32(p.First)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.first (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:last: ", p), err) + } + if err := oprot.WriteI32(int32(p.Last)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.last (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:last: ", p), err) + } + return err +} + +func (p *Range) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Range(%+v)", *p) +} + +// Attributes: +// - Config +// - Instances +type ConfigGroup struct { + Config *TaskConfig `thrift:"config,1" json:"config"` + // unused field # 2 + Instances map[*Range]bool `thrift:"instances,3" json:"instances"` +} + +func NewConfigGroup() *ConfigGroup { + return &ConfigGroup{} +} + +var ConfigGroup_Config_DEFAULT *TaskConfig + +func (p *ConfigGroup) GetConfig() *TaskConfig { + if !p.IsSetConfig() { + return ConfigGroup_Config_DEFAULT + } + return p.Config +} + +func (p *ConfigGroup) GetInstances() map[*Range]bool { + return p.Instances +} +func (p *ConfigGroup) IsSetConfig() bool { + return p.Config != nil +} + +func (p *ConfigGroup) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ConfigGroup) readField1(iprot thrift.TProtocol) error { + p.Config = &TaskConfig{} + if err := p.Config.Read(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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Range]bool, 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) + } + p.Instances[_elem12] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:config: ", p), err) + } + if err := p.Config.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Config), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Instances { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:instances: ", p), err) + } + return err +} + +func (p *ConfigGroup) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ConfigGroup(%+v)", *p) +} + +// Attributes: +// - Key +// - Groups +type ConfigSummary struct { + Key *JobKey `thrift:"key,1" json:"key"` + Groups map[*ConfigGroup]bool `thrift:"groups,2" json:"groups"` +} + +func NewConfigSummary() *ConfigSummary { + return &ConfigSummary{} +} + +var ConfigSummary_Key_DEFAULT *JobKey + +func (p *ConfigSummary) GetKey() *JobKey { + if !p.IsSetKey() { + return ConfigSummary_Key_DEFAULT + } + return p.Key +} + +func (p *ConfigSummary) GetGroups() map[*ConfigGroup]bool { + return p.Groups +} +func (p *ConfigSummary) IsSetKey() bool { + return p.Key != nil +} + +func (p *ConfigSummary) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ConfigSummary) readField1(iprot thrift.TProtocol) error { + p.Key = &JobKey{} + if err := p.Key.Read(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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ConfigGroup]bool, 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) + } + p.Groups[_elem13] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Groups { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:groups: ", p), err) + } + return err +} + +func (p *ConfigSummary) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ConfigSummary(%+v)", *p) +} + +// Attributes: +// - TaskConfig +type PopulateJobResult_ struct { + // unused field # 1 + TaskConfig *TaskConfig `thrift:"taskConfig,2" json:"taskConfig"` +} + +func NewPopulateJobResult_() *PopulateJobResult_ { + return &PopulateJobResult_{} +} + +var PopulateJobResult__TaskConfig_DEFAULT *TaskConfig + +func (p *PopulateJobResult_) GetTaskConfig() *TaskConfig { + if !p.IsSetTaskConfig() { + return PopulateJobResult__TaskConfig_DEFAULT + } + return p.TaskConfig +} +func (p *PopulateJobResult_) IsSetTaskConfig() bool { + return p.TaskConfig != nil +} + +func (p *PopulateJobResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *PopulateJobResult_) readField2(iprot thrift.TProtocol) error { + p.TaskConfig = &TaskConfig{} + if err := p.TaskConfig.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:taskConfig: ", p), err) + } + if err := p.TaskConfig.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:taskConfig: ", p), err) + } + return err +} + +func (p *PopulateJobResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PopulateJobResult_(%+v)", *p) +} + +// Attributes: +// - Quota: Total allocated resource quota. +// - ProdSharedConsumption: Resources consumed by production jobs from a shared resource pool. +// - NonProdSharedConsumption: Resources consumed by non-production jobs from a shared resource pool. +// - ProdDedicatedConsumption: Resources consumed by production jobs from a dedicated resource pool. +// - NonProdDedicatedConsumption: Resources consumed by non-production jobs from a dedicated resource pool. +type GetQuotaResult_ struct { + Quota *ResourceAggregate `thrift:"quota,1" json:"quota"` + ProdSharedConsumption *ResourceAggregate `thrift:"prodSharedConsumption,2" json:"prodSharedConsumption,omitempty"` + NonProdSharedConsumption *ResourceAggregate `thrift:"nonProdSharedConsumption,3" json:"nonProdSharedConsumption,omitempty"` + ProdDedicatedConsumption *ResourceAggregate `thrift:"prodDedicatedConsumption,4" json:"prodDedicatedConsumption,omitempty"` + NonProdDedicatedConsumption *ResourceAggregate `thrift:"nonProdDedicatedConsumption,5" json:"nonProdDedicatedConsumption,omitempty"` +} + +func NewGetQuotaResult_() *GetQuotaResult_ { + return &GetQuotaResult_{} +} + +var GetQuotaResult__Quota_DEFAULT *ResourceAggregate + +func (p *GetQuotaResult_) GetQuota() *ResourceAggregate { + if !p.IsSetQuota() { + return GetQuotaResult__Quota_DEFAULT + } + return p.Quota +} + +var GetQuotaResult__ProdSharedConsumption_DEFAULT *ResourceAggregate + +func (p *GetQuotaResult_) GetProdSharedConsumption() *ResourceAggregate { + if !p.IsSetProdSharedConsumption() { + return GetQuotaResult__ProdSharedConsumption_DEFAULT + } + return p.ProdSharedConsumption +} + +var GetQuotaResult__NonProdSharedConsumption_DEFAULT *ResourceAggregate + +func (p *GetQuotaResult_) GetNonProdSharedConsumption() *ResourceAggregate { + if !p.IsSetNonProdSharedConsumption() { + return GetQuotaResult__NonProdSharedConsumption_DEFAULT + } + return p.NonProdSharedConsumption +} + +var GetQuotaResult__ProdDedicatedConsumption_DEFAULT *ResourceAggregate + +func (p *GetQuotaResult_) GetProdDedicatedConsumption() *ResourceAggregate { + if !p.IsSetProdDedicatedConsumption() { + return GetQuotaResult__ProdDedicatedConsumption_DEFAULT + } + return p.ProdDedicatedConsumption +} + +var GetQuotaResult__NonProdDedicatedConsumption_DEFAULT *ResourceAggregate + +func (p *GetQuotaResult_) GetNonProdDedicatedConsumption() *ResourceAggregate { + if !p.IsSetNonProdDedicatedConsumption() { + return GetQuotaResult__NonProdDedicatedConsumption_DEFAULT + } + return p.NonProdDedicatedConsumption +} +func (p *GetQuotaResult_) IsSetQuota() bool { + return p.Quota != nil +} + +func (p *GetQuotaResult_) IsSetProdSharedConsumption() bool { + return p.ProdSharedConsumption != nil +} + +func (p *GetQuotaResult_) IsSetNonProdSharedConsumption() bool { + return p.NonProdSharedConsumption != nil +} + +func (p *GetQuotaResult_) IsSetProdDedicatedConsumption() bool { + return p.ProdDedicatedConsumption != nil +} + +func (p *GetQuotaResult_) IsSetNonProdDedicatedConsumption() bool { + return p.NonProdDedicatedConsumption != nil +} + +func (p *GetQuotaResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *GetQuotaResult_) readField1(iprot thrift.TProtocol) error { + p.Quota = &ResourceAggregate{} + if err := p.Quota.Read(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 { + p.ProdSharedConsumption = &ResourceAggregate{} + if err := p.ProdSharedConsumption.Read(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 { + p.NonProdSharedConsumption = &ResourceAggregate{} + if err := p.NonProdSharedConsumption.Read(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 { + p.ProdDedicatedConsumption = &ResourceAggregate{} + if err := p.ProdDedicatedConsumption.Read(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 { + p.NonProdDedicatedConsumption = &ResourceAggregate{} + if err := p.NonProdDedicatedConsumption.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:quota: ", p), err) + } + if err := p.Quota.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Quota), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetProdSharedConsumption() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdSharedConsumption), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetNonProdSharedConsumption() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdSharedConsumption), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetProdDedicatedConsumption() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProdDedicatedConsumption), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetNonProdDedicatedConsumption() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NonProdDedicatedConsumption), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:nonProdDedicatedConsumption: ", p), err) + } + } + return err +} + +func (p *GetQuotaResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetQuotaResult_(%+v)", *p) +} + +// Event marking a state transition within a task's lifecycle. +// +// Attributes: +// - Timestamp: Epoch timestamp in milliseconds. +// - Status: New status of the task. +// - Message: Audit message that explains why a transition occurred. +// - Scheduler: Hostname of the scheduler machine that performed the event. +type TaskEvent struct { + Timestamp int64 `thrift:"timestamp,1" json:"timestamp"` + Status ScheduleStatus `thrift:"status,2" json:"status"` + Message *string `thrift:"message,3" json:"message,omitempty"` + Scheduler *string `thrift:"scheduler,4" json:"scheduler,omitempty"` +} + +func NewTaskEvent() *TaskEvent { + return &TaskEvent{} +} + +func (p *TaskEvent) GetTimestamp() int64 { + return p.Timestamp +} + +func (p *TaskEvent) GetStatus() ScheduleStatus { + return p.Status +} + +var TaskEvent_Message_DEFAULT string + +func (p *TaskEvent) GetMessage() string { + if !p.IsSetMessage() { + return TaskEvent_Message_DEFAULT + } + return *p.Message +} + +var TaskEvent_Scheduler_DEFAULT string + +func (p *TaskEvent) GetScheduler() string { + if !p.IsSetScheduler() { + return TaskEvent_Scheduler_DEFAULT + } + return *p.Scheduler +} +func (p *TaskEvent) IsSetMessage() bool { + return p.Message != nil +} + +func (p *TaskEvent) IsSetScheduler() bool { + return p.Scheduler != nil +} + +func (p *TaskEvent) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Timestamp = v + } + return nil +} + +func (p *TaskEvent) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + temp := ScheduleStatus(v) + p.Status = temp + } + return nil +} + +func (p *TaskEvent) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.Message = &v + } + return nil +} + +func (p *TaskEvent) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.Scheduler = &v + } + return nil +} + +func (p *TaskEvent) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("TaskEvent"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) + } + if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetMessage() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetScheduler() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.scheduler (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:scheduler: ", p), err) + } + } + return err +} + +func (p *TaskEvent) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TaskEvent(%+v)", *p) +} + +// A task assignment that is provided to an executor. +// +// Attributes: +// - TaskId: The mesos task ID for this task. Guaranteed to be globally unique +// - SlaveId: The mesos slave ID that this task has been assigned to. +// This will not be populated for a PENDING task. +// - SlaveHost: The name of the machine that this task has been assigned to. +// This will not be populated for a PENDING task. +// - Task: Information about how to run this task. +// - AssignedPorts: Ports reserved on the machine while this task is running. +// - InstanceId: The instance ID assigned to this task. Instance IDs must be unique and contiguous within a +// job, and will be in the range [0, N-1] (inclusive) for a job that has N instances. +type AssignedTask struct { + TaskId string `thrift:"taskId,1" json:"taskId"` + SlaveId string `thrift:"slaveId,2" json:"slaveId"` + SlaveHost string `thrift:"slaveHost,3" json:"slaveHost"` + Task *TaskConfig `thrift:"task,4" json:"task"` + AssignedPorts map[string]int32 `thrift:"assignedPorts,5" json:"assignedPorts"` + InstanceId int32 `thrift:"instanceId,6" json:"instanceId"` +} + +func NewAssignedTask() *AssignedTask { + return &AssignedTask{} +} + +func (p *AssignedTask) GetTaskId() string { + return p.TaskId +} + +func (p *AssignedTask) GetSlaveId() string { + return p.SlaveId +} + +func (p *AssignedTask) GetSlaveHost() string { + return p.SlaveHost +} + +var AssignedTask_Task_DEFAULT *TaskConfig + +func (p *AssignedTask) GetTask() *TaskConfig { + if !p.IsSetTask() { + return AssignedTask_Task_DEFAULT + } + return p.Task +} + +func (p *AssignedTask) GetAssignedPorts() map[string]int32 { + return p.AssignedPorts +} + +func (p *AssignedTask) GetInstanceId() int32 { + return p.InstanceId +} +func (p *AssignedTask) IsSetTask() bool { + return p.Task != nil +} + +func (p *AssignedTask) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.TaskId = v + } + return nil +} + +func (p *AssignedTask) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.SlaveId = v + } + return nil +} + +func (p *AssignedTask) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.SlaveHost = v + } + return nil +} + +func (p *AssignedTask) readField4(iprot thrift.TProtocol) error { + p.Task = &TaskConfig{} + if err := p.Task.Read(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() + 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 { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key14 = v + } + var _val15 int32 + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val15 = v + } + p.AssignedPorts[_key14] = _val15 + } + if err := iprot.ReadMapEnd(); 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 { + return thrift.PrependError("error reading field 6: ", err) + } else { + p.InstanceId = v + } + return nil +} + +func (p *AssignedTask) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("AssignedTask"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) + } + if err := oprot.WriteString(string(p.TaskId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:slaveId: ", p), err) + } + if err := oprot.WriteString(string(p.SlaveId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.slaveId (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:slaveHost: ", p), err) + } + if err := oprot.WriteString(string(p.SlaveHost)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.slaveHost (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:task: ", p), err) + } + if err := p.Task.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.AssignedPorts { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:instanceId: ", p), err) + } + if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.instanceId (6) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:instanceId: ", p), err) + } + return err +} + +func (p *AssignedTask) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AssignedTask(%+v)", *p) +} + +// A task that has been scheduled. +// +// Attributes: +// - AssignedTask: The task that was scheduled. +// - Status: The current status of this task. +// - FailureCount: The number of failures that this task has accumulated over the multi-generational history of +// this task. +// - TaskEvents: State change history for this task. +// - AncestorId: The task ID of the previous generation of this task. When a task is automatically rescheduled, +// a copy of the task is created and ancestor ID of the previous task's task ID. +type ScheduledTask struct { + AssignedTask *AssignedTask `thrift:"assignedTask,1" json:"assignedTask"` + Status ScheduleStatus `thrift:"status,2" json:"status"` + FailureCount int32 `thrift:"failureCount,3" json:"failureCount"` + TaskEvents []*TaskEvent `thrift:"taskEvents,4" json:"taskEvents"` + AncestorId string `thrift:"ancestorId,5" json:"ancestorId"` +} + +func NewScheduledTask() *ScheduledTask { + return &ScheduledTask{} +} + +var ScheduledTask_AssignedTask_DEFAULT *AssignedTask + +func (p *ScheduledTask) GetAssignedTask() *AssignedTask { + if !p.IsSetAssignedTask() { + return ScheduledTask_AssignedTask_DEFAULT + } + return p.AssignedTask +} + +func (p *ScheduledTask) GetStatus() ScheduleStatus { + return p.Status +} + +func (p *ScheduledTask) GetFailureCount() int32 { + return p.FailureCount +} + +func (p *ScheduledTask) GetTaskEvents() []*TaskEvent { + return p.TaskEvents +} + +func (p *ScheduledTask) GetAncestorId() string { + return p.AncestorId +} +func (p *ScheduledTask) IsSetAssignedTask() bool { + return p.AssignedTask != nil +} + +func (p *ScheduledTask) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ScheduledTask) readField1(iprot thrift.TProtocol) error { + p.AssignedTask = &AssignedTask{} + if err := p.AssignedTask.Read(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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + temp := ScheduleStatus(v) + p.Status = temp + } + return nil +} + +func (p *ScheduledTask) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.FailureCount = v + } + return nil +} + +func (p *ScheduledTask) readField4(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + 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) + } + p.TaskEvents = append(p.TaskEvents, _elem16) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError("error reading field 5: ", err) + } else { + p.AncestorId = v + } + return nil +} + +func (p *ScheduledTask) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("ScheduledTask"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:assignedTask: ", p), err) + } + if err := p.AssignedTask.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AssignedTask), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failureCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.FailureCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.failureCount (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.TaskEvents { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:ancestorId: ", p), err) + } + if err := oprot.WriteString(string(p.AncestorId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.ancestorId (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:ancestorId: ", p), err) + } + return err +} + +func (p *ScheduledTask) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ScheduledTask(%+v)", *p) +} + +// Attributes: +// - Tasks +type ScheduleStatusResult_ struct { + Tasks []*ScheduledTask `thrift:"tasks,1" json:"tasks"` +} + +func NewScheduleStatusResult_() *ScheduleStatusResult_ { + return &ScheduleStatusResult_{} +} + +func (p *ScheduleStatusResult_) GetTasks() []*ScheduledTask { + return p.Tasks +} +func (p *ScheduleStatusResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + 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) + } + p.Tasks = append(p.Tasks, _elem17) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Tasks { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:tasks: ", p), err) + } + return err +} + +func (p *ScheduleStatusResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ScheduleStatusResult_(%+v)", *p) +} + +// Attributes: +// - Configs +type GetJobsResult_ struct { + Configs map[*JobConfiguration]bool `thrift:"configs,1" json:"configs"` +} + +func NewGetJobsResult_() *GetJobsResult_ { + return &GetJobsResult_{} +} + +func (p *GetJobsResult_) GetConfigs() map[*JobConfiguration]bool { + return p.Configs +} +func (p *GetJobsResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*JobConfiguration]bool, 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) + } + p.Configs[_elem18] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Configs { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:configs: ", p), err) + } + return err +} + +func (p *GetJobsResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetJobsResult_(%+v)", *p) +} + +// Contains a set of restrictions on matching tasks where all restrictions must be met +// (terms are AND'ed together). +// +// Attributes: +// - Role +// - Environment +// - JobName +// - TaskIds +// - Statuses +// - InstanceIds +// - SlaveHosts +// - JobKeys +// - Offset +// - Limit +type TaskQuery struct { + // unused field # 1 + JobName string `thrift:"jobName,2" json:"jobName"` + // unused field # 3 + TaskIds map[string]bool `thrift:"taskIds,4" json:"taskIds"` + Statuses map[ScheduleStatus]bool `thrift:"statuses,5" json:"statuses"` + // unused field # 6 + InstanceIds map[int32]bool `thrift:"instanceIds,7" json:"instanceIds"` + // unused field # 8 + Environment string `thrift:"environment,9" json:"environment"` + SlaveHosts map[string]bool `thrift:"slaveHosts,10" json:"slaveHosts"` + JobKeys map[*JobKey]bool `thrift:"jobKeys,11" json:"jobKeys"` + Offset int32 `thrift:"offset,12" json:"offset"` + Limit int32 `thrift:"limit,13" json:"limit"` + Role string `thrift:"role,14" json:"role"` +} + +func NewTaskQuery() *TaskQuery { + return &TaskQuery{} +} + +func (p *TaskQuery) GetRole() string { + return p.Role +} + +func (p *TaskQuery) GetEnvironment() string { + return p.Environment +} + +func (p *TaskQuery) GetJobName() string { + return p.JobName +} + +func (p *TaskQuery) GetTaskIds() map[string]bool { + return p.TaskIds +} + +func (p *TaskQuery) GetStatuses() map[ScheduleStatus]bool { + return p.Statuses +} + +func (p *TaskQuery) GetInstanceIds() map[int32]bool { + return p.InstanceIds +} + +func (p *TaskQuery) GetSlaveHosts() map[string]bool { + return p.SlaveHosts +} + +func (p *TaskQuery) GetJobKeys() map[*JobKey]bool { + return p.JobKeys +} + +func (p *TaskQuery) GetOffset() int32 { + return p.Offset +} + +func (p *TaskQuery) GetLimit() int32 { + return p.Limit +} +func (p *TaskQuery) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 14: + if err := p.readField14(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 10: + if err := p.readField10(iprot); err != nil { + return err + } + case 11: + if err := p.readField11(iprot); err != nil { + return err + } + case 12: + if err := p.readField12(iprot); err != nil { + return err + } + case 13: + if err := p.readField13(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 14: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *TaskQuery) readField9(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 9: ", err) + } else { + p.Environment = v + } + return nil +} + +func (p *TaskQuery) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.JobName = v + } + return nil +} + +func (p *TaskQuery) readField4(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.TaskIds = tSet + for i := 0; i < size; i++ { + var _elem19 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem19 = v + } + p.TaskIds[_elem19] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskQuery) readField5(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[ScheduleStatus]bool, size) + p.Statuses = tSet + for i := 0; i < size; i++ { + var _elem20 ScheduleStatus + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + temp := ScheduleStatus(v) + _elem20 = temp + } + p.Statuses[_elem20] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskQuery) readField7(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[int32]bool, size) + p.InstanceIds = tSet + for i := 0; i < size; i++ { + var _elem21 int32 + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem21 = v + } + p.InstanceIds[_elem21] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskQuery) readField10(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.SlaveHosts = tSet + for i := 0; i < size; i++ { + var _elem22 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem22 = v + } + p.SlaveHosts[_elem22] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *TaskQuery) readField11(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*JobKey]bool, 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) + } + p.JobKeys[_elem23] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError("error reading field 12: ", err) + } else { + p.Offset = v + } + return nil +} + +func (p *TaskQuery) readField13(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 13: ", err) + } else { + p.Limit = v + } + return nil +} + +func (p *TaskQuery) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("TaskQuery"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *TaskQuery) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.jobName (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.TaskIds { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:taskIds: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField5(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("statuses", thrift.SET, 5); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:statuses: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.I32, len(p.Statuses)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Statuses { + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:statuses: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField7(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("instanceIds", thrift.SET, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:instanceIds: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.I32, len(p.InstanceIds)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.InstanceIds { + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:instanceIds: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField9(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("environment", thrift.STRING, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:environment: ", p), err) + } + if err := oprot.WriteString(string(p.Environment)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.environment (9) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:environment: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField10(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("slaveHosts", thrift.SET, 10); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:slaveHosts: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRING, len(p.SlaveHosts)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.SlaveHosts { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 10:slaveHosts: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField11(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("jobKeys", thrift.SET, 11); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:jobKeys: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.JobKeys)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.JobKeys { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 11:jobKeys: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField12(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("offset", thrift.I32, 12); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:offset: ", p), err) + } + if err := oprot.WriteI32(int32(p.Offset)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.offset (12) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 12:offset: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField13(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("limit", thrift.I32, 13); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:limit: ", p), err) + } + if err := oprot.WriteI32(int32(p.Limit)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.limit (13) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 13:limit: ", p), err) + } + return err +} + +func (p *TaskQuery) writeField14(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("role", thrift.STRING, 14); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:role: ", p), err) + } + if err := oprot.WriteString(string(p.Role)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.role (14) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 14:role: ", p), err) + } + return err +} + +func (p *TaskQuery) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TaskQuery(%+v)", *p) +} + +// Attributes: +// - Host +// - Mode +type HostStatus struct { + Host string `thrift:"host,1" json:"host"` + Mode MaintenanceMode `thrift:"mode,2" json:"mode"` +} + +func NewHostStatus() *HostStatus { + return &HostStatus{} +} + +func (p *HostStatus) GetHost() string { + return p.Host +} + +func (p *HostStatus) GetMode() MaintenanceMode { + return p.Mode +} +func (p *HostStatus) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Host = v + } + return nil +} + +func (p *HostStatus) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + temp := MaintenanceMode(v) + p.Mode = temp + } + return nil +} + +func (p *HostStatus) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("HostStatus"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:host: ", p), err) + } + if err := oprot.WriteString(string(p.Host)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.host (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:mode: ", p), err) + } + if err := oprot.WriteI32(int32(p.Mode)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.mode (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:mode: ", p), err) + } + return err +} + +func (p *HostStatus) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("HostStatus(%+v)", *p) +} + +// Attributes: +// - Role +// - JobCount +// - CronJobCount +type RoleSummary struct { + Role string `thrift:"role,1" json:"role"` + JobCount int32 `thrift:"jobCount,2" json:"jobCount"` + CronJobCount int32 `thrift:"cronJobCount,3" json:"cronJobCount"` +} + +func NewRoleSummary() *RoleSummary { + return &RoleSummary{} +} + +func (p *RoleSummary) GetRole() string { + return p.Role +} + +func (p *RoleSummary) GetJobCount() int32 { + return p.JobCount +} + +func (p *RoleSummary) GetCronJobCount() int32 { + return p.CronJobCount +} +func (p *RoleSummary) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *RoleSummary) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.JobCount = v + } + return nil +} + +func (p *RoleSummary) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.CronJobCount = v + } + return nil +} + +func (p *RoleSummary) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("RoleSummary"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:role: ", p), err) + } + if err := oprot.WriteString(string(p.Role)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.role (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:jobCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.JobCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.jobCount (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:cronJobCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.CronJobCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.cronJobCount (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:cronJobCount: ", p), err) + } + return err +} + +func (p *RoleSummary) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("RoleSummary(%+v)", *p) +} + +// Attributes: +// - HostNames +type Hosts struct { + HostNames map[string]bool `thrift:"hostNames,1" json:"hostNames"` +} + +func NewHosts() *Hosts { + return &Hosts{} +} + +func (p *Hosts) GetHostNames() map[string]bool { + return p.HostNames +} +func (p *Hosts) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.HostNames = tSet + for i := 0; i < size; i++ { + var _elem24 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem24 = v + } + p.HostNames[_elem24] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.HostNames { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:hostNames: ", p), err) + } + return err +} + +func (p *Hosts) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Hosts(%+v)", *p) +} + +// Attributes: +// - TaskId +// - Reason +type PendingReason struct { + TaskId string `thrift:"taskId,1" json:"taskId"` + Reason string `thrift:"reason,2" json:"reason"` +} + +func NewPendingReason() *PendingReason { + return &PendingReason{} +} + +func (p *PendingReason) GetTaskId() string { + return p.TaskId +} + +func (p *PendingReason) GetReason() string { + return p.Reason +} +func (p *PendingReason) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.TaskId = v + } + return nil +} + +func (p *PendingReason) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Reason = v + } + return nil +} + +func (p *PendingReason) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("PendingReason"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskId: ", p), err) + } + if err := oprot.WriteString(string(p.TaskId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.taskId (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:reason: ", p), err) + } + if err := oprot.WriteString(string(p.Reason)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.reason (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:reason: ", p), err) + } + return err +} + +func (p *PendingReason) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PendingReason(%+v)", *p) +} + +// Job update key. +// +// Attributes: +// - Job: Job being updated +// - ID: Update ID. +type JobUpdateKey struct { + Job *JobKey `thrift:"job,1" json:"job"` + ID string `thrift:"id,2" json:"id"` +} + +func NewJobUpdateKey() *JobUpdateKey { + return &JobUpdateKey{} +} + +var JobUpdateKey_Job_DEFAULT *JobKey + +func (p *JobUpdateKey) GetJob() *JobKey { + if !p.IsSetJob() { + return JobUpdateKey_Job_DEFAULT + } + return p.Job +} + +func (p *JobUpdateKey) GetID() string { + return p.ID +} +func (p *JobUpdateKey) IsSetJob() bool { + return p.Job != nil +} + +func (p *JobUpdateKey) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateKey) readField1(iprot thrift.TProtocol) error { + p.Job = &JobKey{} + if err := p.Job.Read(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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.ID = v + } + return nil +} + +func (p *JobUpdateKey) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateKey"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:job: ", p), err) + } + if err := p.Job.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Job), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:id: ", p), err) + } + if err := oprot.WriteString(string(p.ID)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.id (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:id: ", p), err) + } + return err +} + +func (p *JobUpdateKey) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateKey(%+v)", *p) +} + +// Job update thresholds and limits. +// +// Attributes: +// - UpdateGroupSize: 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 +// 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 +// block. A blocked update is unable to continue but retains its current status. It may only get +// unblocked by a fresh pulseJobUpdate call. +type JobUpdateSettings struct { + UpdateGroupSize int32 `thrift:"updateGroupSize,1" json:"updateGroupSize"` + MaxPerInstanceFailures int32 `thrift:"maxPerInstanceFailures,2" json:"maxPerInstanceFailures"` + MaxFailedInstances int32 `thrift:"maxFailedInstances,3" json:"maxFailedInstances"` + // unused field # 4 + MinWaitInInstanceRunningMs int32 `thrift:"minWaitInInstanceRunningMs,5" json:"minWaitInInstanceRunningMs"` + RollbackOnFailure bool `thrift:"rollbackOnFailure,6" json:"rollbackOnFailure"` + UpdateOnlyTheseInstances map[*Range]bool `thrift:"updateOnlyTheseInstances,7" json:"updateOnlyTheseInstances"` + WaitForBatchCompletion bool `thrift:"waitForBatchCompletion,8" json:"waitForBatchCompletion"` + BlockIfNoPulsesAfterMs *int32 `thrift:"blockIfNoPulsesAfterMs,9" json:"blockIfNoPulsesAfterMs,omitempty"` +} + +func NewJobUpdateSettings() *JobUpdateSettings { + return &JobUpdateSettings{} +} + +func (p *JobUpdateSettings) GetUpdateGroupSize() int32 { + return p.UpdateGroupSize +} + +func (p *JobUpdateSettings) GetMaxPerInstanceFailures() int32 { + return p.MaxPerInstanceFailures +} + +func (p *JobUpdateSettings) GetMaxFailedInstances() int32 { + return p.MaxFailedInstances +} + +func (p *JobUpdateSettings) GetMinWaitInInstanceRunningMs() int32 { + return p.MinWaitInInstanceRunningMs +} + +func (p *JobUpdateSettings) GetRollbackOnFailure() bool { + return p.RollbackOnFailure +} + +func (p *JobUpdateSettings) GetUpdateOnlyTheseInstances() map[*Range]bool { + return p.UpdateOnlyTheseInstances +} + +func (p *JobUpdateSettings) GetWaitForBatchCompletion() bool { + return p.WaitForBatchCompletion +} + +var JobUpdateSettings_BlockIfNoPulsesAfterMs_DEFAULT int32 + +func (p *JobUpdateSettings) GetBlockIfNoPulsesAfterMs() int32 { + if !p.IsSetBlockIfNoPulsesAfterMs() { + return JobUpdateSettings_BlockIfNoPulsesAfterMs_DEFAULT + } + return *p.BlockIfNoPulsesAfterMs +} +func (p *JobUpdateSettings) IsSetBlockIfNoPulsesAfterMs() bool { + return p.BlockIfNoPulsesAfterMs != nil +} + +func (p *JobUpdateSettings) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.UpdateGroupSize = v + } + return nil +} + +func (p *JobUpdateSettings) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.MaxPerInstanceFailures = v + } + return nil +} + +func (p *JobUpdateSettings) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.MaxFailedInstances = v + } + return nil +} + +func (p *JobUpdateSettings) readField5(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 5: ", err) + } else { + p.MinWaitInInstanceRunningMs = v + } + return nil +} + +func (p *JobUpdateSettings) readField6(iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return thrift.PrependError("error reading field 6: ", err) + } else { + p.RollbackOnFailure = v + } + return nil +} + +func (p *JobUpdateSettings) readField7(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Range]bool, 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) + } + p.UpdateOnlyTheseInstances[_elem25] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError("error reading field 8: ", err) + } else { + p.WaitForBatchCompletion = v + } + return nil +} + +func (p *JobUpdateSettings) readField9(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 9: ", err) + } else { + p.BlockIfNoPulsesAfterMs = &v + } + return nil +} + +func (p *JobUpdateSettings) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateSettings"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:updateGroupSize: ", p), err) + } + if err := oprot.WriteI32(int32(p.UpdateGroupSize)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.updateGroupSize (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxPerInstanceFailures: ", p), err) + } + if err := oprot.WriteI32(int32(p.MaxPerInstanceFailures)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.maxPerInstanceFailures (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:maxFailedInstances: ", p), err) + } + if err := oprot.WriteI32(int32(p.MaxFailedInstances)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.maxFailedInstances (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:minWaitInInstanceRunningMs: ", p), err) + } + if err := oprot.WriteI32(int32(p.MinWaitInInstanceRunningMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.minWaitInInstanceRunningMs (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:rollbackOnFailure: ", p), err) + } + if err := oprot.WriteBool(bool(p.RollbackOnFailure)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.rollbackOnFailure (6) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.UpdateOnlyTheseInstances { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:updateOnlyTheseInstances: ", p), err) + } + return err +} + +func (p *JobUpdateSettings) writeField8(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("waitForBatchCompletion", thrift.BOOL, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:waitForBatchCompletion: ", p), err) + } + if err := oprot.WriteBool(bool(p.WaitForBatchCompletion)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.waitForBatchCompletion (8) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:waitForBatchCompletion: ", p), err) + } + return err +} + +func (p *JobUpdateSettings) writeField9(oprot thrift.TProtocol) (err error) { + if p.IsSetBlockIfNoPulsesAfterMs() { + if err := oprot.WriteFieldBegin("blockIfNoPulsesAfterMs", thrift.I32, 9); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:blockIfNoPulsesAfterMs: ", p), err) + } + if err := oprot.WriteI32(int32(*p.BlockIfNoPulsesAfterMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.blockIfNoPulsesAfterMs (9) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 9:blockIfNoPulsesAfterMs: ", p), err) + } + } + return err +} + +func (p *JobUpdateSettings) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateSettings(%+v)", *p) +} + +// Event marking a state transition in job update lifecycle. +// +// Attributes: +// - Status: Update status. +// - TimestampMs: Epoch timestamp in milliseconds. +// - User: User who performed this event (if user-initiated). +// - Message: Message from the user (for user-initiated transitions) or the scheduler about why the state was +// changed. +type JobUpdateEvent struct { + Status JobUpdateStatus `thrift:"status,1" json:"status"` + TimestampMs int64 `thrift:"timestampMs,2" json:"timestampMs"` + User *string `thrift:"user,3" json:"user,omitempty"` + Message *string `thrift:"message,4" json:"message,omitempty"` +} + +func NewJobUpdateEvent() *JobUpdateEvent { + return &JobUpdateEvent{} +} + +func (p *JobUpdateEvent) GetStatus() JobUpdateStatus { + return p.Status +} + +func (p *JobUpdateEvent) GetTimestampMs() int64 { + return p.TimestampMs +} + +var JobUpdateEvent_User_DEFAULT string + +func (p *JobUpdateEvent) GetUser() string { + if !p.IsSetUser() { + return JobUpdateEvent_User_DEFAULT + } + return *p.User +} + +var JobUpdateEvent_Message_DEFAULT string + +func (p *JobUpdateEvent) GetMessage() string { + if !p.IsSetMessage() { + return JobUpdateEvent_Message_DEFAULT + } + return *p.Message +} +func (p *JobUpdateEvent) IsSetUser() bool { + return p.User != nil +} + +func (p *JobUpdateEvent) IsSetMessage() bool { + return p.Message != nil +} + +func (p *JobUpdateEvent) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + temp := JobUpdateStatus(v) + p.Status = temp + } + return nil +} + +func (p *JobUpdateEvent) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.TimestampMs = v + } + return nil +} + +func (p *JobUpdateEvent) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.User = &v + } + return nil +} + +func (p *JobUpdateEvent) readField4(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.Message = &v + } + return nil +} + +func (p *JobUpdateEvent) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateEvent"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) + } + if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetUser() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetMessage() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.message (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:message: ", p), err) + } + } + return err +} + +func (p *JobUpdateEvent) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateEvent(%+v)", *p) +} + +// Event marking a state transition in job instance update lifecycle. +// +// Attributes: +// - InstanceId: Job instance ID. +// - TimestampMs: Epoch timestamp in milliseconds. +// - Action: Job update action taken on the instance. +type JobInstanceUpdateEvent struct { + InstanceId int32 `thrift:"instanceId,1" json:"instanceId"` + TimestampMs int64 `thrift:"timestampMs,2" json:"timestampMs"` + Action JobUpdateAction `thrift:"action,3" json:"action"` +} + +func NewJobInstanceUpdateEvent() *JobInstanceUpdateEvent { + return &JobInstanceUpdateEvent{} +} + +func (p *JobInstanceUpdateEvent) GetInstanceId() int32 { + return p.InstanceId +} + +func (p *JobInstanceUpdateEvent) GetTimestampMs() int64 { + return p.TimestampMs +} + +func (p *JobInstanceUpdateEvent) GetAction() JobUpdateAction { + return p.Action +} +func (p *JobInstanceUpdateEvent) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.InstanceId = v + } + return nil +} + +func (p *JobInstanceUpdateEvent) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.TimestampMs = v + } + return nil +} + +func (p *JobInstanceUpdateEvent) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + temp := JobUpdateAction(v) + p.Action = temp + } + return nil +} + +func (p *JobInstanceUpdateEvent) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobInstanceUpdateEvent"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:instanceId: ", p), err) + } + if err := oprot.WriteI32(int32(p.InstanceId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.instanceId (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:timestampMs: ", p), err) + } + if err := oprot.WriteI64(int64(p.TimestampMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.timestampMs (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:action: ", p), err) + } + if err := oprot.WriteI32(int32(p.Action)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.action (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:action: ", p), err) + } + return err +} + +func (p *JobInstanceUpdateEvent) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobInstanceUpdateEvent(%+v)", *p) +} + +// Maps instance IDs to TaskConfigs it. +// +// Attributes: +// - Task: A TaskConfig associated with instances. +// - Instances: Instances associated with the TaskConfig. +type InstanceTaskConfig struct { + Task *TaskConfig `thrift:"task,1" json:"task"` + Instances map[*Range]bool `thrift:"instances,2" json:"instances"` +} + +func NewInstanceTaskConfig() *InstanceTaskConfig { + return &InstanceTaskConfig{} +} + +var InstanceTaskConfig_Task_DEFAULT *TaskConfig + +func (p *InstanceTaskConfig) GetTask() *TaskConfig { + if !p.IsSetTask() { + return InstanceTaskConfig_Task_DEFAULT + } + return p.Task +} + +func (p *InstanceTaskConfig) GetInstances() map[*Range]bool { + return p.Instances +} +func (p *InstanceTaskConfig) IsSetTask() bool { + return p.Task != nil +} + +func (p *InstanceTaskConfig) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *InstanceTaskConfig) readField1(iprot thrift.TProtocol) error { + p.Task = &TaskConfig{} + if err := p.Task.Read(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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*Range]bool, 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) + } + p.Instances[_elem26] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:task: ", p), err) + } + if err := p.Task.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Task), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Instances { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instances: ", p), err) + } + return err +} + +func (p *InstanceTaskConfig) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("InstanceTaskConfig(%+v)", *p) +} + +// Current job update state including status and created/modified timestamps. +// +// Attributes: +// - Status: Current status of the update. +// - CreatedTimestampMs: Created timestamp in milliseconds. +// - LastModifiedTimestampMs: Last modified timestamp in milliseconds. +type JobUpdateState struct { + Status JobUpdateStatus `thrift:"status,1" json:"status"` + CreatedTimestampMs int64 `thrift:"createdTimestampMs,2" json:"createdTimestampMs"` + LastModifiedTimestampMs int64 `thrift:"lastModifiedTimestampMs,3" json:"lastModifiedTimestampMs"` +} + +func NewJobUpdateState() *JobUpdateState { + return &JobUpdateState{} +} + +func (p *JobUpdateState) GetStatus() JobUpdateStatus { + return p.Status +} + +func (p *JobUpdateState) GetCreatedTimestampMs() int64 { + return p.CreatedTimestampMs +} + +func (p *JobUpdateState) GetLastModifiedTimestampMs() int64 { + return p.LastModifiedTimestampMs +} +func (p *JobUpdateState) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + temp := JobUpdateStatus(v) + p.Status = temp + } + return nil +} + +func (p *JobUpdateState) readField2(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.CreatedTimestampMs = v + } + return nil +} + +func (p *JobUpdateState) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.LastModifiedTimestampMs = v + } + return nil +} + +func (p *JobUpdateState) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateState"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:createdTimestampMs: ", p), err) + } + if err := oprot.WriteI64(int64(p.CreatedTimestampMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.createdTimestampMs (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:lastModifiedTimestampMs: ", p), err) + } + if err := oprot.WriteI64(int64(p.LastModifiedTimestampMs)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.lastModifiedTimestampMs (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:lastModifiedTimestampMs: ", p), err) + } + return err +} + +func (p *JobUpdateState) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateState(%+v)", *p) +} + +// Summary of the job update including job key, user and current state. +// +// Attributes: +// - Key: Unique identifier for the update. +// - User: User initiated an update. +// - State: Current job update state. +type JobUpdateSummary struct { + // unused fields # 1 to 2 + User string `thrift:"user,3" json:"user"` + State *JobUpdateState `thrift:"state,4" json:"state"` + Key *JobUpdateKey `thrift:"key,5" json:"key"` +} + +func NewJobUpdateSummary() *JobUpdateSummary { + return &JobUpdateSummary{} +} + +var JobUpdateSummary_Key_DEFAULT *JobUpdateKey + +func (p *JobUpdateSummary) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return JobUpdateSummary_Key_DEFAULT + } + return p.Key +} + +func (p *JobUpdateSummary) GetUser() string { + return p.User +} + +var JobUpdateSummary_State_DEFAULT *JobUpdateState + +func (p *JobUpdateSummary) GetState() *JobUpdateState { + if !p.IsSetState() { + return JobUpdateSummary_State_DEFAULT + } + return p.State +} +func (p *JobUpdateSummary) IsSetKey() bool { + return p.Key != nil +} + +func (p *JobUpdateSummary) IsSetState() bool { + return p.State != nil +} + +func (p *JobUpdateSummary) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateSummary) readField5(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(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 { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.User = v + } + return nil +} + +func (p *JobUpdateSummary) readField4(iprot thrift.TProtocol) error { + p.State = &JobUpdateState{} + if err := p.State.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.State), err) + } + return nil +} + +func (p *JobUpdateSummary) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateSummary"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:user: ", p), err) + } + if err := oprot.WriteString(string(p.User)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.user (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:state: ", p), err) + } + if err := p.State.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.State), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:key: ", p), err) + } + return err +} + +func (p *JobUpdateSummary) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateSummary(%+v)", *p) +} + +// Update configuration and setting details. +// +// Attributes: +// - InitialState: Actual InstanceId -> TaskConfig mapping when the update was requested. +// - DesiredState: Desired configuration when the update completes. +// - Settings: Update specific settings. +type JobUpdateInstructions struct { + InitialState map[*InstanceTaskConfig]bool `thrift:"initialState,1" json:"initialState"` + DesiredState *InstanceTaskConfig `thrift:"desiredState,2" json:"desiredState"` + Settings *JobUpdateSettings `thrift:"settings,3" json:"settings"` +} + +func NewJobUpdateInstructions() *JobUpdateInstructions { + return &JobUpdateInstructions{} +} + +func (p *JobUpdateInstructions) GetInitialState() map[*InstanceTaskConfig]bool { + return p.InitialState +} + +var JobUpdateInstructions_DesiredState_DEFAULT *InstanceTaskConfig + +func (p *JobUpdateInstructions) GetDesiredState() *InstanceTaskConfig { + if !p.IsSetDesiredState() { + return JobUpdateInstructions_DesiredState_DEFAULT + } + return p.DesiredState +} + +var JobUpdateInstructions_Settings_DEFAULT *JobUpdateSettings + +func (p *JobUpdateInstructions) GetSettings() *JobUpdateSettings { + if !p.IsSetSettings() { + return JobUpdateInstructions_Settings_DEFAULT + } + return p.Settings +} +func (p *JobUpdateInstructions) IsSetDesiredState() bool { + return p.DesiredState != nil +} + +func (p *JobUpdateInstructions) IsSetSettings() bool { + return p.Settings != nil +} + +func (p *JobUpdateInstructions) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*InstanceTaskConfig]bool, size) + p.InitialState = tSet + for i := 0; i < size; i++ { + _elem27 := &InstanceTaskConfig{} + if err := _elem27.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) + } + p.InitialState[_elem27] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *JobUpdateInstructions) readField2(iprot thrift.TProtocol) error { + p.DesiredState = &InstanceTaskConfig{} + if err := p.DesiredState.Read(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 { + p.Settings = &JobUpdateSettings{} + if err := p.Settings.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.InitialState { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:initialState: ", p), err) + } + return err +} + +func (p *JobUpdateInstructions) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("desiredState", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:desiredState: ", p), err) + } + if err := p.DesiredState.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DesiredState), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:desiredState: ", p), err) + } + return err +} + +func (p *JobUpdateInstructions) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:settings: ", p), err) + } + return err +} + +func (p *JobUpdateInstructions) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateInstructions(%+v)", *p) +} + +// Full definition of the job update. +// +// Attributes: +// - Summary: Update summary. +// - Instructions: Update configuration. +type JobUpdate struct { + Summary *JobUpdateSummary `thrift:"summary,1" json:"summary"` + Instructions *JobUpdateInstructions `thrift:"instructions,2" json:"instructions"` +} + +func NewJobUpdate() *JobUpdate { + return &JobUpdate{} +} + +var JobUpdate_Summary_DEFAULT *JobUpdateSummary + +func (p *JobUpdate) GetSummary() *JobUpdateSummary { + if !p.IsSetSummary() { + return JobUpdate_Summary_DEFAULT + } + return p.Summary +} + +var JobUpdate_Instructions_DEFAULT *JobUpdateInstructions + +func (p *JobUpdate) GetInstructions() *JobUpdateInstructions { + if !p.IsSetInstructions() { + return JobUpdate_Instructions_DEFAULT + } + return p.Instructions +} +func (p *JobUpdate) IsSetSummary() bool { + return p.Summary != nil +} + +func (p *JobUpdate) IsSetInstructions() bool { + return p.Instructions != nil +} + +func (p *JobUpdate) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdate) readField1(iprot thrift.TProtocol) error { + p.Summary = &JobUpdateSummary{} + if err := p.Summary.Read(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 { + p.Instructions = &JobUpdateInstructions{} + if err := p.Instructions.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) + } + if err := p.Summary.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instructions: ", p), err) + } + if err := p.Instructions.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Instructions), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instructions: ", p), err) + } + return err +} + +func (p *JobUpdate) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdate(%+v)", *p) +} + +// Attributes: +// - Update: Update definition. +// - UpdateEvents: History for this update. +// - InstanceEvents: History for the individual instances updated. +type JobUpdateDetails struct { + Update *JobUpdate `thrift:"update,1" json:"update"` + UpdateEvents []*JobUpdateEvent `thrift:"updateEvents,2" json:"updateEvents"` + InstanceEvents []*JobInstanceUpdateEvent `thrift:"instanceEvents,3" json:"instanceEvents"` +} + +func NewJobUpdateDetails() *JobUpdateDetails { + return &JobUpdateDetails{} +} + +var JobUpdateDetails_Update_DEFAULT *JobUpdate + +func (p *JobUpdateDetails) GetUpdate() *JobUpdate { + if !p.IsSetUpdate() { + return JobUpdateDetails_Update_DEFAULT + } + return p.Update +} + +func (p *JobUpdateDetails) GetUpdateEvents() []*JobUpdateEvent { + return p.UpdateEvents +} + +func (p *JobUpdateDetails) GetInstanceEvents() []*JobInstanceUpdateEvent { + return p.InstanceEvents +} +func (p *JobUpdateDetails) IsSetUpdate() bool { + return p.Update != nil +} + +func (p *JobUpdateDetails) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateDetails) readField1(iprot thrift.TProtocol) error { + p.Update = &JobUpdate{} + if err := p.Update.Read(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() + 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++ { + _elem28 := &JobUpdateEvent{} + if err := _elem28.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem28), err) + } + p.UpdateEvents = append(p.UpdateEvents, _elem28) + } + if err := iprot.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *JobUpdateDetails) readField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + 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++ { + _elem29 := &JobInstanceUpdateEvent{} + if err := _elem29.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem29), err) + } + p.InstanceEvents = append(p.InstanceEvents, _elem29) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:update: ", p), err) + } + if err := p.Update.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Update), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.UpdateEvents { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.InstanceEvents { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:instanceEvents: ", p), err) + } + return err +} + +func (p *JobUpdateDetails) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateDetails(%+v)", *p) +} + +// A request to update the following instances of an existing job. Used by startUpdate. +// +// Attributes: +// - TaskConfig: Desired TaskConfig to apply. +// - InstanceCount: Desired number of instances of the task config. +// - Settings: Update settings and limits. +type JobUpdateRequest struct { + TaskConfig *TaskConfig `thrift:"taskConfig,1" json:"taskConfig"` + InstanceCount int32 `thrift:"instanceCount,2" json:"instanceCount"` + Settings *JobUpdateSettings `thrift:"settings,3" json:"settings"` +} + +func NewJobUpdateRequest() *JobUpdateRequest { + return &JobUpdateRequest{} +} + +var JobUpdateRequest_TaskConfig_DEFAULT *TaskConfig + +func (p *JobUpdateRequest) GetTaskConfig() *TaskConfig { + if !p.IsSetTaskConfig() { + return JobUpdateRequest_TaskConfig_DEFAULT + } + return p.TaskConfig +} + +func (p *JobUpdateRequest) GetInstanceCount() int32 { + return p.InstanceCount +} + +var JobUpdateRequest_Settings_DEFAULT *JobUpdateSettings + +func (p *JobUpdateRequest) GetSettings() *JobUpdateSettings { + if !p.IsSetSettings() { + return JobUpdateRequest_Settings_DEFAULT + } + return p.Settings +} +func (p *JobUpdateRequest) IsSetTaskConfig() bool { + return p.TaskConfig != nil +} + +func (p *JobUpdateRequest) IsSetSettings() bool { + return p.Settings != nil +} + +func (p *JobUpdateRequest) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobUpdateRequest) readField1(iprot thrift.TProtocol) error { + p.TaskConfig = &TaskConfig{} + if err := p.TaskConfig.Read(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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.InstanceCount = v + } + return nil +} + +func (p *JobUpdateRequest) readField3(iprot thrift.TProtocol) error { + p.Settings = &JobUpdateSettings{} + if err := p.Settings.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Settings), err) + } + return nil +} + +func (p *JobUpdateRequest) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateRequest"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:taskConfig: ", p), err) + } + if err := p.TaskConfig.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TaskConfig), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceCount: ", p), err) + } + if err := oprot.WriteI32(int32(p.InstanceCount)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.instanceCount (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:settings: ", p), err) + } + if err := p.Settings.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Settings), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:settings: ", p), err) + } + return err +} + +func (p *JobUpdateRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateRequest(%+v)", *p) +} + +// Contains a set of restrictions on matching job updates where all restrictions must be met +// (terms are AND'ed together). +// +// Attributes: +// - Role: Job role. +// - Key: Unique identifier for a job update. +// - JobKey: Job key. +// - User: User who created the update. +// - UpdateStatuses: Set of update statuses. +// - Offset: Offset to serve data from. Used by pagination. +// - Limit: Number or records to serve. Used by pagination. +type JobUpdateQuery struct { + // unused field # 1 + Role string `thrift:"role,2" json:"role"` + JobKey *JobKey `thrift:"jobKey,3" json:"jobKey"` + User string `thrift:"user,4" json:"user"` + UpdateStatuses map[JobUpdateStatus]bool `thrift:"updateStatuses,5" json:"updateStatuses"` + Offset int32 `thrift:"offset,6" json:"offset"` + Limit int32 `thrift:"limit,7" json:"limit"` + Key *JobUpdateKey `thrift:"key,8" json:"key"` +} + +func NewJobUpdateQuery() *JobUpdateQuery { + return &JobUpdateQuery{} +} + +func (p *JobUpdateQuery) GetRole() string { + return p.Role +} + +var JobUpdateQuery_Key_DEFAULT *JobUpdateKey + +func (p *JobUpdateQuery) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return JobUpdateQuery_Key_DEFAULT + } + return p.Key +} + +var JobUpdateQuery_JobKey_DEFAULT *JobKey + +func (p *JobUpdateQuery) GetJobKey() *JobKey { + if !p.IsSetJobKey() { + return JobUpdateQuery_JobKey_DEFAULT + } + return p.JobKey +} + +func (p *JobUpdateQuery) GetUser() string { + return p.User +} + +func (p *JobUpdateQuery) GetUpdateStatuses() map[JobUpdateStatus]bool { + return p.UpdateStatuses +} + +func (p *JobUpdateQuery) GetOffset() int32 { + return p.Offset +} + +func (p *JobUpdateQuery) GetLimit() int32 { + return p.Limit +} +func (p *JobUpdateQuery) IsSetKey() bool { + return p.Key != nil +} + +func (p *JobUpdateQuery) IsSetJobKey() bool { + return p.JobKey != nil +} + +func (p *JobUpdateQuery) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 2: ", err) + } else { + p.Role = v + } + return nil +} + +func (p *JobUpdateQuery) readField8(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(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 { + p.JobKey = &JobKey{} + if err := p.JobKey.Read(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 { + return thrift.PrependError("error reading field 4: ", err) + } else { + p.User = v + } + return nil +} + +func (p *JobUpdateQuery) readField5(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[JobUpdateStatus]bool, size) + p.UpdateStatuses = tSet + for i := 0; i < size; i++ { + var _elem30 JobUpdateStatus + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + temp := JobUpdateStatus(v) + _elem30 = temp + } + p.UpdateStatuses[_elem30] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError("error reading field 6: ", err) + } else { + p.Offset = v + } + return nil +} + +func (p *JobUpdateQuery) readField7(iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return thrift.PrependError("error reading field 7: ", err) + } else { + p.Limit = v + } + return nil +} + +func (p *JobUpdateQuery) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobUpdateQuery"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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.writeField7(oprot); err != nil { + return err + } + if err := p.writeField8(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *JobUpdateQuery) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.role (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobKey), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T.user (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.UpdateStatuses { + if err := oprot.WriteI32(int32(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 5:updateStatuses: ", p), err) + } + return err +} + +func (p *JobUpdateQuery) writeField6(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("offset", thrift.I32, 6); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:offset: ", p), err) + } + if err := oprot.WriteI32(int32(p.Offset)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.offset (6) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:offset: ", p), err) + } + return err +} + +func (p *JobUpdateQuery) writeField7(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("limit", thrift.I32, 7); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:limit: ", p), err) + } + if err := oprot.WriteI32(int32(p.Limit)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.limit (7) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 7:limit: ", p), err) + } + return err +} + +func (p *JobUpdateQuery) writeField8(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("key", thrift.STRUCT, 8); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 8:key: ", p), err) + } + return err +} + +func (p *JobUpdateQuery) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobUpdateQuery(%+v)", *p) +} + +// Attributes: +// - Backups +type ListBackupsResult_ struct { + Backups map[string]bool `thrift:"backups,1" json:"backups"` +} + +func NewListBackupsResult_() *ListBackupsResult_ { + return &ListBackupsResult_{} +} + +func (p *ListBackupsResult_) GetBackups() map[string]bool { + return p.Backups +} +func (p *ListBackupsResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[string]bool, size) + p.Backups = tSet + for i := 0; i < size; i++ { + var _elem31 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _elem31 = v + } + p.Backups[_elem31] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Backups { + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:backups: ", p), err) + } + return err +} + +func (p *ListBackupsResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ListBackupsResult_(%+v)", *p) +} + +// Attributes: +// - Statuses +type StartMaintenanceResult_ struct { + Statuses map[*HostStatus]bool `thrift:"statuses,1" json:"statuses"` +} + +func NewStartMaintenanceResult_() *StartMaintenanceResult_ { + return &StartMaintenanceResult_{} +} + +func (p *StartMaintenanceResult_) GetStatuses() map[*HostStatus]bool { + return p.Statuses +} +func (p *StartMaintenanceResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*HostStatus]bool, size) + p.Statuses = tSet + for i := 0; i < size; i++ { + _elem32 := &HostStatus{} + if err := _elem32.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem32), err) + } + p.Statuses[_elem32] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Statuses { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:statuses: ", p), err) + } + return err +} + +func (p *StartMaintenanceResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("StartMaintenanceResult_(%+v)", *p) +} + +// Attributes: +// - Statuses +type DrainHostsResult_ struct { + Statuses map[*HostStatus]bool `thrift:"statuses,1" json:"statuses"` +} + +func NewDrainHostsResult_() *DrainHostsResult_ { + return &DrainHostsResult_{} +} + +func (p *DrainHostsResult_) GetStatuses() map[*HostStatus]bool { + return p.Statuses +} +func (p *DrainHostsResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*HostStatus]bool, size) + p.Statuses = tSet + for i := 0; i < size; i++ { + _elem33 := &HostStatus{} + if err := _elem33.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem33), err) + } + p.Statuses[_elem33] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Statuses { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:statuses: ", p), err) + } + return err +} + +func (p *DrainHostsResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("DrainHostsResult_(%+v)", *p) +} + +// Attributes: +// - Tasks +type QueryRecoveryResult_ struct { + Tasks map[*ScheduledTask]bool `thrift:"tasks,1" json:"tasks"` +} + +func NewQueryRecoveryResult_() *QueryRecoveryResult_ { + return &QueryRecoveryResult_{} +} + +func (p *QueryRecoveryResult_) GetTasks() map[*ScheduledTask]bool { + return p.Tasks +} +func (p *QueryRecoveryResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ScheduledTask]bool, size) + p.Tasks = tSet + for i := 0; i < size; i++ { + _elem34 := &ScheduledTask{} + if err := _elem34.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem34), err) + } + p.Tasks[_elem34] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Tasks { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:tasks: ", p), err) + } + return err +} + +func (p *QueryRecoveryResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("QueryRecoveryResult_(%+v)", *p) +} + +// Attributes: +// - Statuses +type MaintenanceStatusResult_ struct { + Statuses map[*HostStatus]bool `thrift:"statuses,1" json:"statuses"` +} + +func NewMaintenanceStatusResult_() *MaintenanceStatusResult_ { + return &MaintenanceStatusResult_{} +} + +func (p *MaintenanceStatusResult_) GetStatuses() map[*HostStatus]bool { + return p.Statuses +} +func (p *MaintenanceStatusResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*HostStatus]bool, 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) + } + p.Statuses[_elem35] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Statuses { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:statuses: ", p), err) + } + return err +} + +func (p *MaintenanceStatusResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("MaintenanceStatusResult_(%+v)", *p) +} + +// Attributes: +// - Statuses +type EndMaintenanceResult_ struct { + Statuses map[*HostStatus]bool `thrift:"statuses,1" json:"statuses"` +} + +func NewEndMaintenanceResult_() *EndMaintenanceResult_ { + return &EndMaintenanceResult_{} +} + +func (p *EndMaintenanceResult_) GetStatuses() map[*HostStatus]bool { + return p.Statuses +} +func (p *EndMaintenanceResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*HostStatus]bool, size) + p.Statuses = tSet + for i := 0; i < size; i++ { + _elem36 := &HostStatus{} + if err := _elem36.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem36), err) + } + p.Statuses[_elem36] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Statuses { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:statuses: ", p), err) + } + return err +} + +func (p *EndMaintenanceResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EndMaintenanceResult_(%+v)", *p) +} + +// Attributes: +// - Summaries +type RoleSummaryResult_ struct { + Summaries map[*RoleSummary]bool `thrift:"summaries,1" json:"summaries"` +} + +func NewRoleSummaryResult_() *RoleSummaryResult_ { + return &RoleSummaryResult_{} +} + +func (p *RoleSummaryResult_) GetSummaries() map[*RoleSummary]bool { + return p.Summaries +} +func (p *RoleSummaryResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*RoleSummary]bool, size) + p.Summaries = tSet + for i := 0; i < size; i++ { + _elem37 := &RoleSummary{} + if err := _elem37.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem37), err) + } + p.Summaries[_elem37] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Summaries { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summaries: ", p), err) + } + return err +} + +func (p *RoleSummaryResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("RoleSummaryResult_(%+v)", *p) +} + +// Attributes: +// - Summaries +type JobSummaryResult_ struct { + Summaries map[*JobSummary]bool `thrift:"summaries,1" json:"summaries"` +} + +func NewJobSummaryResult_() *JobSummaryResult_ { + return &JobSummaryResult_{} +} + +func (p *JobSummaryResult_) GetSummaries() map[*JobSummary]bool { + return p.Summaries +} +func (p *JobSummaryResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*JobSummary]bool, size) + p.Summaries = tSet + for i := 0; i < size; i++ { + _elem38 := &JobSummary{} + if err := _elem38.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem38), err) + } + p.Summaries[_elem38] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Summaries { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summaries: ", p), err) + } + return err +} + +func (p *JobSummaryResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobSummaryResult_(%+v)", *p) +} + +// Attributes: +// - Summary +type ConfigSummaryResult_ struct { + Summary *ConfigSummary `thrift:"summary,1" json:"summary"` +} + +func NewConfigSummaryResult_() *ConfigSummaryResult_ { + return &ConfigSummaryResult_{} +} + +var ConfigSummaryResult__Summary_DEFAULT *ConfigSummary + +func (p *ConfigSummaryResult_) GetSummary() *ConfigSummary { + if !p.IsSetSummary() { + return ConfigSummaryResult__Summary_DEFAULT + } + return p.Summary +} +func (p *ConfigSummaryResult_) IsSetSummary() bool { + return p.Summary != nil +} + +func (p *ConfigSummaryResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ConfigSummaryResult_) readField1(iprot thrift.TProtocol) error { + p.Summary = &ConfigSummary{} + if err := p.Summary.Read(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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:summary: ", p), err) + } + if err := p.Summary.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Summary), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:summary: ", p), err) + } + return err +} + +func (p *ConfigSummaryResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ConfigSummaryResult_(%+v)", *p) +} + +// Attributes: +// - Reasons +type GetPendingReasonResult_ struct { + Reasons map[*PendingReason]bool `thrift:"reasons,1" json:"reasons"` +} + +func NewGetPendingReasonResult_() *GetPendingReasonResult_ { + return &GetPendingReasonResult_{} +} + +func (p *GetPendingReasonResult_) GetReasons() map[*PendingReason]bool { + return p.Reasons +} +func (p *GetPendingReasonResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*PendingReason]bool, size) + p.Reasons = tSet + for i := 0; i < size; i++ { + _elem39 := &PendingReason{} + if err := _elem39.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem39), err) + } + p.Reasons[_elem39] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Reasons { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:reasons: ", p), err) + } + return err +} + +func (p *GetPendingReasonResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetPendingReasonResult_(%+v)", *p) +} + +// Result of the startUpdate call. +// +// Attributes: +// - Key: Unique identifier for the job update. +type StartJobUpdateResult_ struct { + Key *JobUpdateKey `thrift:"key,1" json:"key"` +} + +func NewStartJobUpdateResult_() *StartJobUpdateResult_ { + return &StartJobUpdateResult_{} +} + +var StartJobUpdateResult__Key_DEFAULT *JobUpdateKey + +func (p *StartJobUpdateResult_) GetKey() *JobUpdateKey { + if !p.IsSetKey() { + return StartJobUpdateResult__Key_DEFAULT + } + return p.Key +} +func (p *StartJobUpdateResult_) IsSetKey() bool { + return p.Key != nil +} + +func (p *StartJobUpdateResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *StartJobUpdateResult_) readField1(iprot thrift.TProtocol) error { + p.Key = &JobUpdateKey{} + if err := p.Key.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Key), err) + } + return nil +} + +func (p *StartJobUpdateResult_) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("StartJobUpdateResult"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) + } + if err := p.Key.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Key), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) + } + return err +} + +func (p *StartJobUpdateResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("StartJobUpdateResult_(%+v)", *p) +} + +// Result of the getJobUpdateSummaries call. +// +// Attributes: +// - UpdateSummaries +type GetJobUpdateSummariesResult_ struct { + UpdateSummaries []*JobUpdateSummary `thrift:"updateSummaries,1" json:"updateSummaries"` +} + +func NewGetJobUpdateSummariesResult_() *GetJobUpdateSummariesResult_ { + return &GetJobUpdateSummariesResult_{} +} + +func (p *GetJobUpdateSummariesResult_) GetUpdateSummaries() []*JobUpdateSummary { + return p.UpdateSummaries +} +func (p *GetJobUpdateSummariesResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + 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++ { + _elem40 := &JobUpdateSummary{} + if err := _elem40.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem40), err) + } + p.UpdateSummaries = append(p.UpdateSummaries, _elem40) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.UpdateSummaries { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:updateSummaries: ", p), err) + } + return err +} + +func (p *GetJobUpdateSummariesResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetJobUpdateSummariesResult_(%+v)", *p) +} + +// Result of the getJobUpdateDetails call. +// +// Attributes: +// - Details +type GetJobUpdateDetailsResult_ struct { + Details *JobUpdateDetails `thrift:"details,1" json:"details"` +} + +func NewGetJobUpdateDetailsResult_() *GetJobUpdateDetailsResult_ { + return &GetJobUpdateDetailsResult_{} +} + +var GetJobUpdateDetailsResult__Details_DEFAULT *JobUpdateDetails + +func (p *GetJobUpdateDetailsResult_) GetDetails() *JobUpdateDetails { + if !p.IsSetDetails() { + return GetJobUpdateDetailsResult__Details_DEFAULT + } + return p.Details +} +func (p *GetJobUpdateDetailsResult_) IsSetDetails() bool { + return p.Details != nil +} + +func (p *GetJobUpdateDetailsResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *GetJobUpdateDetailsResult_) readField1(iprot thrift.TProtocol) error { + p.Details = &JobUpdateDetails{} + if err := p.Details.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Details), err) + } + return nil +} + +func (p *GetJobUpdateDetailsResult_) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("GetJobUpdateDetailsResult"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:details: ", p), err) + } + if err := p.Details.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Details), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:details: ", p), err) + } + return err +} + +func (p *GetJobUpdateDetailsResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetJobUpdateDetailsResult_(%+v)", *p) +} + +// Result of the pulseJobUpdate call. +// +// Attributes: +// - Status +type PulseJobUpdateResult_ struct { + Status JobUpdatePulseStatus `thrift:"status,1" json:"status"` +} + +func NewPulseJobUpdateResult_() *PulseJobUpdateResult_ { + return &PulseJobUpdateResult_{} +} + +func (p *PulseJobUpdateResult_) GetStatus() JobUpdatePulseStatus { + return p.Status +} +func (p *PulseJobUpdateResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + temp := JobUpdatePulseStatus(v) + p.Status = temp + } + return nil +} + +func (p *PulseJobUpdateResult_) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("PulseJobUpdateResult"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:status: ", p), err) + } + if err := oprot.WriteI32(int32(p.Status)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.status (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:status: ", p), err) + } + return err +} + +func (p *PulseJobUpdateResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PulseJobUpdateResult_(%+v)", *p) +} + +// Attributes: +// - Add: Instance addition diff details. +// - Remove: Instance removal diff details. +// - Update: Instance update diff details. +// - Unchanged: Instances unchanged by the update. +type GetJobUpdateDiffResult_ struct { + Add map[*ConfigGroup]bool `thrift:"add,1" json:"add"` + Remove map[*ConfigGroup]bool `thrift:"remove,2" json:"remove"` + Update map[*ConfigGroup]bool `thrift:"update,3" json:"update"` + Unchanged map[*ConfigGroup]bool `thrift:"unchanged,4" json:"unchanged"` +} + +func NewGetJobUpdateDiffResult_() *GetJobUpdateDiffResult_ { + return &GetJobUpdateDiffResult_{} +} + +func (p *GetJobUpdateDiffResult_) GetAdd() map[*ConfigGroup]bool { + return p.Add +} + +func (p *GetJobUpdateDiffResult_) GetRemove() map[*ConfigGroup]bool { + return p.Remove +} + +func (p *GetJobUpdateDiffResult_) GetUpdate() map[*ConfigGroup]bool { + return p.Update +} + +func (p *GetJobUpdateDiffResult_) GetUnchanged() map[*ConfigGroup]bool { + return p.Unchanged +} +func (p *GetJobUpdateDiffResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ConfigGroup]bool, size) + p.Add = tSet + for i := 0; i < size; i++ { + _elem41 := &ConfigGroup{} + if err := _elem41.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem41), err) + } + p.Add[_elem41] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *GetJobUpdateDiffResult_) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ConfigGroup]bool, size) + p.Remove = tSet + for i := 0; i < size; i++ { + _elem42 := &ConfigGroup{} + if err := _elem42.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem42), err) + } + p.Remove[_elem42] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *GetJobUpdateDiffResult_) readField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ConfigGroup]bool, size) + p.Update = tSet + for i := 0; i < size; i++ { + _elem43 := &ConfigGroup{} + if err := _elem43.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem43), err) + } + p.Update[_elem43] = true + } + if err := iprot.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) + } + return nil +} + +func (p *GetJobUpdateDiffResult_) readField4(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*ConfigGroup]bool, size) + p.Unchanged = 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) + } + p.Unchanged[_elem44] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Add { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:add: ", p), err) + } + return err +} + +func (p *GetJobUpdateDiffResult_) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("remove", thrift.SET, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:remove: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Remove)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Remove { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:remove: ", p), err) + } + return err +} + +func (p *GetJobUpdateDiffResult_) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("update", thrift.SET, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:update: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Update)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Update { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:update: ", p), err) + } + return err +} + +func (p *GetJobUpdateDiffResult_) writeField4(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("unchanged", thrift.SET, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:unchanged: ", p), err) + } + if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.Unchanged)); err != nil { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Unchanged { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:unchanged: ", p), err) + } + return err +} + +func (p *GetJobUpdateDiffResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetJobUpdateDiffResult_(%+v)", *p) +} + +// Tier information. +// +// Attributes: +// - Name: Name of tier. +// - Settings: Tier attributes. +type TierConfig struct { + Name string `thrift:"name,1" json:"name"` + Settings map[string]string `thrift:"settings,2" json:"settings"` +} + +func NewTierConfig() *TierConfig { + return &TierConfig{} +} + +func (p *TierConfig) GetName() string { + return p.Name +} + +func (p *TierConfig) GetSettings() map[string]string { + return p.Settings +} +func (p *TierConfig) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Name = v + } + return nil +} + +func (p *TierConfig) readField2(iprot thrift.TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + 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 _key45 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _key45 = v + } + var _val46 string + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 0: ", err) + } else { + _val46 = v + } + p.Settings[_key45] = _val46 + } + if err := iprot.ReadMapEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err) + } + if err := oprot.WriteString(string(p.Name)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing map begin: ", err) + } + for k, v := range p.Settings { + if err := oprot.WriteString(string(k)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:settings: ", p), err) + } + return err +} + +func (p *TierConfig) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TierConfig(%+v)", *p) +} + +// Result of the getTierConfigResult call. +// +// Attributes: +// - DefaultTierName: Name of the default tier. +// - Tiers: Set of tier configurations. +type GetTierConfigResult_ struct { + DefaultTierName string `thrift:"defaultTierName,1" json:"defaultTierName"` + Tiers map[*TierConfig]bool `thrift:"tiers,2" json:"tiers"` +} + +func NewGetTierConfigResult_() *GetTierConfigResult_ { + return &GetTierConfigResult_{} +} + +func (p *GetTierConfigResult_) GetDefaultTierName() string { + return p.DefaultTierName +} + +func (p *GetTierConfigResult_) GetTiers() map[*TierConfig]bool { + return p.Tiers +} +func (p *GetTierConfigResult_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.DefaultTierName = v + } + return nil +} + +func (p *GetTierConfigResult_) readField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return thrift.PrependError("error reading set begin: ", err) + } + tSet := make(map[*TierConfig]bool, size) + p.Tiers = tSet + for i := 0; i < size; i++ { + _elem47 := &TierConfig{} + if err := _elem47.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem47), err) + } + p.Tiers[_elem47] = true + } + if err := iprot.ReadSetEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultTierName: ", p), err) + } + if err := oprot.WriteString(string(p.DefaultTierName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.defaultTierName (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing set begin: ", err) + } + for v, _ := range p.Tiers { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tiers: ", p), err) + } + return err +} + +func (p *GetTierConfigResult_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetTierConfigResult_(%+v)", *p) +} + +// Information about the scheduler. +// +// Attributes: +// - ClusterName +// - StatsUrlPrefix: A url prefix for job container stats. +type ServerInfo struct { + ClusterName string `thrift:"clusterName,1" json:"clusterName"` + // unused field # 2 + StatsUrlPrefix string `thrift:"statsUrlPrefix,3" json:"statsUrlPrefix"` +} + +func NewServerInfo() *ServerInfo { + return &ServerInfo{} +} + +func (p *ServerInfo) GetClusterName() string { + return p.ClusterName +} + +func (p *ServerInfo) GetStatsUrlPrefix() string { + return p.StatsUrlPrefix +} +func (p *ServerInfo) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.ClusterName = v + } + return nil +} + +func (p *ServerInfo) readField3(iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return thrift.PrependError("error reading field 3: ", err) + } else { + p.StatsUrlPrefix = v + } + return nil +} + +func (p *ServerInfo) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("ServerInfo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField3(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:clusterName: ", p), err) + } + if err := oprot.WriteString(string(p.ClusterName)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.clusterName (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:statsUrlPrefix: ", p), err) + } + if err := oprot.WriteString(string(p.StatsUrlPrefix)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.statsUrlPrefix (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:statsUrlPrefix: ", p), err) + } + return err +} + +func (p *ServerInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ServerInfo(%+v)", *p) +} + +// Attributes: +// - PopulateJobResult_ +// - ScheduleStatusResult_ +// - GetJobsResult_ +// - GetQuotaResult_ +// - ListBackupsResult_ +// - StartMaintenanceResult_ +// - DrainHostsResult_ +// - QueryRecoveryResult_ +// - MaintenanceStatusResult_ +// - EndMaintenanceResult_ +// - RoleSummaryResult_ +// - JobSummaryResult_ +// - ConfigSummaryResult_ +// - GetPendingReasonResult_ +// - StartJobUpdateResult_ +// - GetJobUpdateSummariesResult_ +// - GetJobUpdateDetailsResult_ +// - PulseJobUpdateResult_ +// - GetJobUpdateDiffResult_ +// - GetTierConfigResult_ +type Result_ struct { + PopulateJobResult_ *PopulateJobResult_ `thrift:"populateJobResult,1" json:"populateJobResult,omitempty"` + // unused field # 2 + ScheduleStatusResult_ *ScheduleStatusResult_ `thrift:"scheduleStatusResult,3" json:"scheduleStatusResult,omitempty"` + GetJobsResult_ *GetJobsResult_ `thrift:"getJobsResult,4" json:"getJobsResult,omitempty"` + GetQuotaResult_ *GetQuotaResult_ `thrift:"getQuotaResult,5" json:"getQuotaResult,omitempty"` + ListBackupsResult_ *ListBackupsResult_ `thrift:"listBackupsResult,6" json:"listBackupsResult,omitempty"` + StartMaintenanceResult_ *StartMaintenanceResult_ `thrift:"startMaintenanceResult,7" json:"startMaintenanceResult,omitempty"` + DrainHostsResult_ *DrainHostsResult_ `thrift:"drainHostsResult,8" json:"drainHostsResult,omitempty"` + QueryRecoveryResult_ *QueryRecoveryResult_ `thrift:"queryRecoveryResult,9" json:"queryRecoveryResult,omitempty"` + MaintenanceStatusResult_ *MaintenanceStatusResult_ `thrift:"maintenanceStatusResult,10" json:"maintenanceStatusResult,omitempty"` + EndMaintenanceResult_ *EndMaintenanceResult_ `thrift:"endMaintenanceResult,11" json:"endMaintenanceResult,omitempty"` + // unused fields # 12 to 16 + RoleSummaryResult_ *RoleSummaryResult_ `thrift:"roleSummaryResult,17" json:"roleSummaryResult,omitempty"` + JobSummaryResult_ *JobSummaryResult_ `thrift:"jobSummaryResult,18" json:"jobSummaryResult,omitempty"` + // unused field # 19 + ConfigSummaryResult_ *ConfigSummaryResult_ `thrift:"configSummaryResult,20" json:"configSummaryResult,omitempty"` + GetPendingReasonResult_ *GetPendingReasonResult_ `thrift:"getPendingReasonResult,21" json:"getPendingReasonResult,omitempty"` + StartJobUpdateResult_ *StartJobUpdateResult_ `thrift:"startJobUpdateResult,22" json:"startJobUpdateResult,omitempty"` + GetJobUpdateSummariesResult_ *GetJobUpdateSummariesResult_ `thrift:"getJobUpdateSummariesResult,23" json:"getJobUpdateSummariesResult,omitempty"` + GetJobUpdateDetailsResult_ *GetJobUpdateDetailsResult_ `thrift:"getJobUpdateDetailsResult,24" json:"getJobUpdateDetailsResult,omitempty"` + PulseJobUpdateResult_ *PulseJobUpdateResult_ `thrift:"pulseJobUpdateResult,25" json:"pulseJobUpdateResult,omitempty"` + GetJobUpdateDiffResult_ *GetJobUpdateDiffResult_ `thrift:"getJobUpdateDiffResult,26" json:"getJobUpdateDiffResult,omitempty"` + GetTierConfigResult_ *GetTierConfigResult_ `thrift:"getTierConfigResult,27" json:"getTierConfigResult,omitempty"` +} + +func NewResult_() *Result_ { + return &Result_{} +} + +var Result__PopulateJobResult__DEFAULT *PopulateJobResult_ + +func (p *Result_) GetPopulateJobResult_() *PopulateJobResult_ { + if !p.IsSetPopulateJobResult_() { + return Result__PopulateJobResult__DEFAULT + } + return p.PopulateJobResult_ +} + +var Result__ScheduleStatusResult__DEFAULT *ScheduleStatusResult_ + +func (p *Result_) GetScheduleStatusResult_() *ScheduleStatusResult_ { + if !p.IsSetScheduleStatusResult_() { + return Result__ScheduleStatusResult__DEFAULT + } + return p.ScheduleStatusResult_ +} + +var Result__GetJobsResult__DEFAULT *GetJobsResult_ + +func (p *Result_) GetGetJobsResult_() *GetJobsResult_ { + if !p.IsSetGetJobsResult_() { + return Result__GetJobsResult__DEFAULT + } + return p.GetJobsResult_ +} + +var Result__GetQuotaResult__DEFAULT *GetQuotaResult_ + +func (p *Result_) GetGetQuotaResult_() *GetQuotaResult_ { + if !p.IsSetGetQuotaResult_() { + return Result__GetQuotaResult__DEFAULT + } + return p.GetQuotaResult_ +} + +var Result__ListBackupsResult__DEFAULT *ListBackupsResult_ + +func (p *Result_) GetListBackupsResult_() *ListBackupsResult_ { + if !p.IsSetListBackupsResult_() { + return Result__ListBackupsResult__DEFAULT + } + return p.ListBackupsResult_ +} + +var Result__StartMaintenanceResult__DEFAULT *StartMaintenanceResult_ + +func (p *Result_) GetStartMaintenanceResult_() *StartMaintenanceResult_ { + if !p.IsSetStartMaintenanceResult_() { + return Result__StartMaintenanceResult__DEFAULT + } + return p.StartMaintenanceResult_ +} + +var Result__DrainHostsResult__DEFAULT *DrainHostsResult_ + +func (p *Result_) GetDrainHostsResult_() *DrainHostsResult_ { + if !p.IsSetDrainHostsResult_() { + return Result__DrainHostsResult__DEFAULT + } + return p.DrainHostsResult_ +} + +var Result__QueryRecoveryResult__DEFAULT *QueryRecoveryResult_ + +func (p *Result_) GetQueryRecoveryResult_() *QueryRecoveryResult_ { + if !p.IsSetQueryRecoveryResult_() { + return Result__QueryRecoveryResult__DEFAULT + } + return p.QueryRecoveryResult_ +} + +var Result__MaintenanceStatusResult__DEFAULT *MaintenanceStatusResult_ + +func (p *Result_) GetMaintenanceStatusResult_() *MaintenanceStatusResult_ { + if !p.IsSetMaintenanceStatusResult_() { + return Result__MaintenanceStatusResult__DEFAULT + } + return p.MaintenanceStatusResult_ +} + +var Result__EndMaintenanceResult__DEFAULT *EndMaintenanceResult_ + +func (p *Result_) GetEndMaintenanceResult_() *EndMaintenanceResult_ { + if !p.IsSetEndMaintenanceResult_() { + return Result__EndMaintenanceResult__DEFAULT + } + return p.EndMaintenanceResult_ +} + +var Result__RoleSummaryResult__DEFAULT *RoleSummaryResult_ + +func (p *Result_) GetRoleSummaryResult_() *RoleSummaryResult_ { + if !p.IsSetRoleSummaryResult_() { + return Result__RoleSummaryResult__DEFAULT + } + return p.RoleSummaryResult_ +} + +var Result__JobSummaryResult__DEFAULT *JobSummaryResult_ + +func (p *Result_) GetJobSummaryResult_() *JobSummaryResult_ { + if !p.IsSetJobSummaryResult_() { + return Result__JobSummaryResult__DEFAULT + } + return p.JobSummaryResult_ +} + +var Result__ConfigSummaryResult__DEFAULT *ConfigSummaryResult_ + +func (p *Result_) GetConfigSummaryResult_() *ConfigSummaryResult_ { + if !p.IsSetConfigSummaryResult_() { + return Result__ConfigSummaryResult__DEFAULT + } + return p.ConfigSummaryResult_ +} + +var Result__GetPendingReasonResult__DEFAULT *GetPendingReasonResult_ + +func (p *Result_) GetGetPendingReasonResult_() *GetPendingReasonResult_ { + if !p.IsSetGetPendingReasonResult_() { + return Result__GetPendingReasonResult__DEFAULT + } + return p.GetPendingReasonResult_ +} + +var Result__StartJobUpdateResult__DEFAULT *StartJobUpdateResult_ + +func (p *Result_) GetStartJobUpdateResult_() *StartJobUpdateResult_ { + if !p.IsSetStartJobUpdateResult_() { + return Result__StartJobUpdateResult__DEFAULT + } + return p.StartJobUpdateResult_ +} + +var Result__GetJobUpdateSummariesResult__DEFAULT *GetJobUpdateSummariesResult_ + +func (p *Result_) GetGetJobUpdateSummariesResult_() *GetJobUpdateSummariesResult_ { + if !p.IsSetGetJobUpdateSummariesResult_() { + return Result__GetJobUpdateSummariesResult__DEFAULT + } + return p.GetJobUpdateSummariesResult_ +} + +var Result__GetJobUpdateDetailsResult__DEFAULT *GetJobUpdateDetailsResult_ + +func (p *Result_) GetGetJobUpdateDetailsResult_() *GetJobUpdateDetailsResult_ { + if !p.IsSetGetJobUpdateDetailsResult_() { + return Result__GetJobUpdateDetailsResult__DEFAULT + } + return p.GetJobUpdateDetailsResult_ +} + +var Result__PulseJobUpdateResult__DEFAULT *PulseJobUpdateResult_ + +func (p *Result_) GetPulseJobUpdateResult_() *PulseJobUpdateResult_ { + if !p.IsSetPulseJobUpdateResult_() { + return Result__PulseJobUpdateResult__DEFAULT + } + return p.PulseJobUpdateResult_ +} + +var Result__GetJobUpdateDiffResult__DEFAULT *GetJobUpdateDiffResult_ + +func (p *Result_) GetGetJobUpdateDiffResult_() *GetJobUpdateDiffResult_ { + if !p.IsSetGetJobUpdateDiffResult_() { + return Result__GetJobUpdateDiffResult__DEFAULT + } + return p.GetJobUpdateDiffResult_ +} + +var Result__GetTierConfigResult__DEFAULT *GetTierConfigResult_ + +func (p *Result_) GetGetTierConfigResult_() *GetTierConfigResult_ { + if !p.IsSetGetTierConfigResult_() { + return Result__GetTierConfigResult__DEFAULT + } + return p.GetTierConfigResult_ +} +func (p *Result_) CountSetFieldsResult_() int { + count := 0 + if p.IsSetPopulateJobResult_() { + count++ + } + if p.IsSetScheduleStatusResult_() { + count++ + } + if p.IsSetGetJobsResult_() { + count++ + } + if p.IsSetGetQuotaResult_() { + count++ + } + if p.IsSetListBackupsResult_() { + count++ + } + if p.IsSetStartMaintenanceResult_() { + count++ + } + if p.IsSetDrainHostsResult_() { + count++ + } + if p.IsSetQueryRecoveryResult_() { + count++ + } + if p.IsSetMaintenanceStatusResult_() { + count++ + } + if p.IsSetEndMaintenanceResult_() { + count++ + } + if p.IsSetRoleSummaryResult_() { + count++ + } + if p.IsSetJobSummaryResult_() { + count++ + } + if p.IsSetConfigSummaryResult_() { + count++ + } + if p.IsSetGetPendingReasonResult_() { + count++ + } + if p.IsSetStartJobUpdateResult_() { + count++ + } + if p.IsSetGetJobUpdateSummariesResult_() { + count++ + } + if p.IsSetGetJobUpdateDetailsResult_() { + count++ + } + if p.IsSetPulseJobUpdateResult_() { + count++ + } + if p.IsSetGetJobUpdateDiffResult_() { + count++ + } + if p.IsSetGetTierConfigResult_() { + count++ + } + return count + +} + +func (p *Result_) IsSetPopulateJobResult_() bool { + return p.PopulateJobResult_ != nil +} + +func (p *Result_) IsSetScheduleStatusResult_() bool { + return p.ScheduleStatusResult_ != nil +} + +func (p *Result_) IsSetGetJobsResult_() bool { + return p.GetJobsResult_ != nil +} + +func (p *Result_) IsSetGetQuotaResult_() bool { + return p.GetQuotaResult_ != nil +} + +func (p *Result_) IsSetListBackupsResult_() bool { + return p.ListBackupsResult_ != nil +} + +func (p *Result_) IsSetStartMaintenanceResult_() bool { + return p.StartMaintenanceResult_ != nil +} + +func (p *Result_) IsSetDrainHostsResult_() bool { + return p.DrainHostsResult_ != nil +} + +func (p *Result_) IsSetQueryRecoveryResult_() bool { + return p.QueryRecoveryResult_ != nil +} + +func (p *Result_) IsSetMaintenanceStatusResult_() bool { + return p.MaintenanceStatusResult_ != nil +} + +func (p *Result_) IsSetEndMaintenanceResult_() bool { + return p.EndMaintenanceResult_ != nil +} + +func (p *Result_) IsSetRoleSummaryResult_() bool { + return p.RoleSummaryResult_ != nil +} + +func (p *Result_) IsSetJobSummaryResult_() bool { + return p.JobSummaryResult_ != nil +} + +func (p *Result_) IsSetConfigSummaryResult_() bool { + return p.ConfigSummaryResult_ != nil +} + +func (p *Result_) IsSetGetPendingReasonResult_() bool { + return p.GetPendingReasonResult_ != nil +} + +func (p *Result_) IsSetStartJobUpdateResult_() bool { + return p.StartJobUpdateResult_ != nil +} + +func (p *Result_) IsSetGetJobUpdateSummariesResult_() bool { + return p.GetJobUpdateSummariesResult_ != nil +} + +func (p *Result_) IsSetGetJobUpdateDetailsResult_() bool { + return p.GetJobUpdateDetailsResult_ != nil +} + +func (p *Result_) IsSetPulseJobUpdateResult_() bool { + return p.PulseJobUpdateResult_ != nil +} + +func (p *Result_) IsSetGetJobUpdateDiffResult_() bool { + return p.GetJobUpdateDiffResult_ != nil +} + +func (p *Result_) IsSetGetTierConfigResult_() bool { + return p.GetTierConfigResult_ != nil +} + +func (p *Result_) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 10: + if err := p.readField10(iprot); err != nil { + return err + } + case 11: + if err := p.readField11(iprot); err != nil { + return err + } + case 17: + if err := p.readField17(iprot); err != nil { + return err + } + case 18: + if err := p.readField18(iprot); err != nil { + return err + } + case 20: + if err := p.readField20(iprot); err != nil { + return err + } + case 21: + if err := p.readField21(iprot); err != nil { + return err + } + case 22: + if err := p.readField22(iprot); err != nil { + return err + } + case 23: + if err := p.readField23(iprot); err != nil { + return err + } + case 24: + if err := p.readField24(iprot); err != nil { + return err + } + case 25: + if err := p.readField25(iprot); err != nil { + return err + } + case 26: + if err := p.readField26(iprot); err != nil { + return err + } + case 27: + if err := p.readField27(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *Result_) readField1(iprot thrift.TProtocol) error { + p.PopulateJobResult_ = &PopulateJobResult_{} + if err := p.PopulateJobResult_.Read(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 { + p.ScheduleStatusResult_ = &ScheduleStatusResult_{} + if err := p.ScheduleStatusResult_.Read(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 { + p.GetJobsResult_ = &GetJobsResult_{} + if err := p.GetJobsResult_.Read(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 { + p.GetQuotaResult_ = &GetQuotaResult_{} + if err := p.GetQuotaResult_.Read(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 { + p.ListBackupsResult_ = &ListBackupsResult_{} + if err := p.ListBackupsResult_.Read(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 { + p.StartMaintenanceResult_ = &StartMaintenanceResult_{} + if err := p.StartMaintenanceResult_.Read(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 { + p.DrainHostsResult_ = &DrainHostsResult_{} + if err := p.DrainHostsResult_.Read(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 { + p.QueryRecoveryResult_ = &QueryRecoveryResult_{} + if err := p.QueryRecoveryResult_.Read(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 { + p.MaintenanceStatusResult_ = &MaintenanceStatusResult_{} + if err := p.MaintenanceStatusResult_.Read(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 { + p.EndMaintenanceResult_ = &EndMaintenanceResult_{} + if err := p.EndMaintenanceResult_.Read(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 { + p.RoleSummaryResult_ = &RoleSummaryResult_{} + if err := p.RoleSummaryResult_.Read(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 { + p.JobSummaryResult_ = &JobSummaryResult_{} + if err := p.JobSummaryResult_.Read(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 { + p.ConfigSummaryResult_ = &ConfigSummaryResult_{} + if err := p.ConfigSummaryResult_.Read(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 { + p.GetPendingReasonResult_ = &GetPendingReasonResult_{} + if err := p.GetPendingReasonResult_.Read(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 { + p.StartJobUpdateResult_ = &StartJobUpdateResult_{} + if err := p.StartJobUpdateResult_.Read(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 { + p.GetJobUpdateSummariesResult_ = &GetJobUpdateSummariesResult_{} + if err := p.GetJobUpdateSummariesResult_.Read(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 { + p.GetJobUpdateDetailsResult_ = &GetJobUpdateDetailsResult_{} + if err := p.GetJobUpdateDetailsResult_.Read(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 { + p.PulseJobUpdateResult_ = &PulseJobUpdateResult_{} + if err := p.PulseJobUpdateResult_.Read(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 { + p.GetJobUpdateDiffResult_ = &GetJobUpdateDiffResult_{} + if err := p.GetJobUpdateDiffResult_.Read(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 { + p.GetTierConfigResult_ = &GetTierConfigResult_{} + if err := p.GetTierConfigResult_.Read(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 { + 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *Result_) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetPopulateJobResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PopulateJobResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetScheduleStatusResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ScheduleStatusResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetJobsResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobsResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetQuotaResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetQuotaResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetListBackupsResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ListBackupsResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetStartMaintenanceResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartMaintenanceResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetDrainHostsResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DrainHostsResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetQueryRecoveryResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryRecoveryResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetMaintenanceStatusResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MaintenanceStatusResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetEndMaintenanceResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EndMaintenanceResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetRoleSummaryResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RoleSummaryResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetJobSummaryResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobSummaryResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetConfigSummaryResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ConfigSummaryResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetPendingReasonResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetPendingReasonResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetStartJobUpdateResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.StartJobUpdateResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetJobUpdateSummariesResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateSummariesResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetJobUpdateDetailsResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDetailsResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetPulseJobUpdateResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.PulseJobUpdateResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetJobUpdateDiffResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetJobUpdateDiffResult_), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetGetTierConfigResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GetTierConfigResult_), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 27:getTierConfigResult: ", p), err) + } + } + return err +} + +func (p *Result_) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Result_(%+v)", *p) +} + +// Attributes: +// - Message +type ResponseDetail struct { + Message string `thrift:"message,1" json:"message"` +} + +func NewResponseDetail() *ResponseDetail { + return &ResponseDetail{} +} + +func (p *ResponseDetail) GetMessage() string { + return p.Message +} +func (p *ResponseDetail) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + p.Message = v + } + return nil +} + +func (p *ResponseDetail) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("ResponseDetail"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:message: ", p), err) + } + if err := oprot.WriteString(string(p.Message)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.message (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:message: ", p), err) + } + return err +} + +func (p *ResponseDetail) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ResponseDetail(%+v)", *p) +} + +// Attributes: +// - ResponseCode +// - ServerInfo +// - Result_: Payload from the invoked RPC. +// - Details: Messages from the server relevant to the request, such as warnings or use of deprecated +// features. +type Response struct { + ResponseCode ResponseCode `thrift:"responseCode,1" json:"responseCode"` + // unused field # 2 + Result_ *Result_ `thrift:"result,3" json:"result,omitempty"` + // unused field # 4 + ServerInfo *ServerInfo `thrift:"serverInfo,5" json:"serverInfo"` + Details []*ResponseDetail `thrift:"details,6" json:"details"` +} + +func NewResponse() *Response { + return &Response{} +} + +func (p *Response) GetResponseCode() ResponseCode { + return p.ResponseCode +} + +var Response_ServerInfo_DEFAULT *ServerInfo + +func (p *Response) GetServerInfo() *ServerInfo { + if !p.IsSetServerInfo() { + return Response_ServerInfo_DEFAULT + } + return p.ServerInfo +} + +var Response_Result__DEFAULT *Result_ + +func (p *Response) GetResult_() *Result_ { + if !p.IsSetResult_() { + return Response_Result__DEFAULT + } + return p.Result_ +} + +func (p *Response) GetDetails() []*ResponseDetail { + return p.Details +} +func (p *Response) IsSetServerInfo() bool { + return p.ServerInfo != nil +} + +func (p *Response) IsSetResult_() bool { + return p.Result_ != nil +} + +func (p *Response) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); 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 { + return thrift.PrependError("error reading field 1: ", err) + } else { + temp := ResponseCode(v) + p.ResponseCode = temp + } + return nil +} + +func (p *Response) readField5(iprot thrift.TProtocol) error { + p.ServerInfo = &ServerInfo{} + if err := p.ServerInfo.Read(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 { + p.Result_ = &Result_{} + if err := p.Result_.Read(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() + 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++ { + _elem48 := &ResponseDetail{} + if err := _elem48.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem48), err) + } + p.Details = append(p.Details, _elem48) + } + if err := iprot.ReadListEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:responseCode: ", p), err) + } + if err := oprot.WriteI32(int32(p.ResponseCode)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.responseCode (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); 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) { + if p.IsSetResult_() { + if err := oprot.WriteFieldBegin("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 { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Result_), err) + } + if err := oprot.WriteFieldEnd(); 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 { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:serverInfo: ", p), err) + } + if err := p.ServerInfo.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ServerInfo), err) + } + if err := oprot.WriteFieldEnd(); 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 { + 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 { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.Details { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 6:details: ", p), err) + } + return err +} + +func (p *Response) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("Response(%+v)", *p) +} + +// Attributes: +// - InstanceKey: Key for the task to rewrite. +// - OldTask: The original configuration. +// - RewrittenTask: The rewritten configuration. +type InstanceConfigRewrite struct { + InstanceKey *InstanceKey `thrift:"instanceKey,1" json:"instanceKey"` + OldTask *TaskConfig `thrift:"oldTask,2" json:"oldTask"` + RewrittenTask *TaskConfig `thrift:"rewrittenTask,3" json:"rewrittenTask"` +} + +func NewInstanceConfigRewrite() *InstanceConfigRewrite { + return &InstanceConfigRewrite{} +} + +var InstanceConfigRewrite_InstanceKey_DEFAULT *InstanceKey + +func (p *InstanceConfigRewrite) GetInstanceKey() *InstanceKey { + if !p.IsSetInstanceKey() { + return InstanceConfigRewrite_InstanceKey_DEFAULT + } + return p.InstanceKey +} + +var InstanceConfigRewrite_OldTask_DEFAULT *TaskConfig + +func (p *InstanceConfigRewrite) GetOldTask() *TaskConfig { + if !p.IsSetOldTask() { + return InstanceConfigRewrite_OldTask_DEFAULT + } + return p.OldTask +} + +var InstanceConfigRewrite_RewrittenTask_DEFAULT *TaskConfig + +func (p *InstanceConfigRewrite) GetRewrittenTask() *TaskConfig { + if !p.IsSetRewrittenTask() { + return InstanceConfigRewrite_RewrittenTask_DEFAULT + } + return p.RewrittenTask +} +func (p *InstanceConfigRewrite) IsSetInstanceKey() bool { + return p.InstanceKey != nil +} + +func (p *InstanceConfigRewrite) IsSetOldTask() bool { + return p.OldTask != nil +} + +func (p *InstanceConfigRewrite) IsSetRewrittenTask() bool { + return p.RewrittenTask != nil +} + +func (p *InstanceConfigRewrite) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *InstanceConfigRewrite) readField1(iprot thrift.TProtocol) error { + p.InstanceKey = &InstanceKey{} + if err := p.InstanceKey.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.InstanceKey), err) + } + return nil +} + +func (p *InstanceConfigRewrite) readField2(iprot thrift.TProtocol) error { + p.OldTask = &TaskConfig{} + if err := p.OldTask.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OldTask), err) + } + return nil +} + +func (p *InstanceConfigRewrite) readField3(iprot thrift.TProtocol) error { + p.RewrittenTask = &TaskConfig{} + if err := p.RewrittenTask.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RewrittenTask), err) + } + return nil +} + +func (p *InstanceConfigRewrite) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("InstanceConfigRewrite"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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 := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *InstanceConfigRewrite) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("instanceKey", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:instanceKey: ", p), err) + } + if err := p.InstanceKey.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.InstanceKey), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:instanceKey: ", p), err) + } + return err +} + +func (p *InstanceConfigRewrite) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("oldTask", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:oldTask: ", p), err) + } + if err := p.OldTask.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.OldTask), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:oldTask: ", p), err) + } + return err +} + +func (p *InstanceConfigRewrite) writeField3(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("rewrittenTask", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:rewrittenTask: ", p), err) + } + if err := p.RewrittenTask.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RewrittenTask), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:rewrittenTask: ", p), err) + } + return err +} + +func (p *InstanceConfigRewrite) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("InstanceConfigRewrite(%+v)", *p) +} + +// Attributes: +// - OldJob: The original job configuration. +// - RewrittenJob: The rewritten job configuration. +type JobConfigRewrite struct { + OldJob *JobConfiguration `thrift:"oldJob,1" json:"oldJob"` + RewrittenJob *JobConfiguration `thrift:"rewrittenJob,2" json:"rewrittenJob"` +} + +func NewJobConfigRewrite() *JobConfigRewrite { + return &JobConfigRewrite{} +} + +var JobConfigRewrite_OldJob_DEFAULT *JobConfiguration + +func (p *JobConfigRewrite) GetOldJob() *JobConfiguration { + if !p.IsSetOldJob() { + return JobConfigRewrite_OldJob_DEFAULT + } + return p.OldJob +} + +var JobConfigRewrite_RewrittenJob_DEFAULT *JobConfiguration + +func (p *JobConfigRewrite) GetRewrittenJob() *JobConfiguration { + if !p.IsSetRewrittenJob() { + return JobConfigRewrite_RewrittenJob_DEFAULT + } + return p.RewrittenJob +} +func (p *JobConfigRewrite) IsSetOldJob() bool { + return p.OldJob != nil +} + +func (p *JobConfigRewrite) IsSetRewrittenJob() bool { + return p.RewrittenJob != nil +} + +func (p *JobConfigRewrite) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *JobConfigRewrite) readField1(iprot thrift.TProtocol) error { + p.OldJob = &JobConfiguration{} + if err := p.OldJob.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OldJob), err) + } + return nil +} + +func (p *JobConfigRewrite) readField2(iprot thrift.TProtocol) error { + p.RewrittenJob = &JobConfiguration{} + if err := p.RewrittenJob.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RewrittenJob), err) + } + return nil +} + +func (p *JobConfigRewrite) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("JobConfigRewrite"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *JobConfigRewrite) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("oldJob", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:oldJob: ", p), err) + } + if err := p.OldJob.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.OldJob), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:oldJob: ", p), err) + } + return err +} + +func (p *JobConfigRewrite) writeField2(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("rewrittenJob", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:rewrittenJob: ", p), err) + } + if err := p.RewrittenJob.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RewrittenJob), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:rewrittenJob: ", p), err) + } + return err +} + +func (p *JobConfigRewrite) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("JobConfigRewrite(%+v)", *p) +} + +// Attributes: +// - JobRewrite +// - InstanceRewrite +type ConfigRewrite struct { + JobRewrite *JobConfigRewrite `thrift:"jobRewrite,1" json:"jobRewrite,omitempty"` + InstanceRewrite *InstanceConfigRewrite `thrift:"instanceRewrite,2" json:"instanceRewrite,omitempty"` +} + +func NewConfigRewrite() *ConfigRewrite { + return &ConfigRewrite{} +} + +var ConfigRewrite_JobRewrite_DEFAULT *JobConfigRewrite + +func (p *ConfigRewrite) GetJobRewrite() *JobConfigRewrite { + if !p.IsSetJobRewrite() { + return ConfigRewrite_JobRewrite_DEFAULT + } + return p.JobRewrite +} + +var ConfigRewrite_InstanceRewrite_DEFAULT *InstanceConfigRewrite + +func (p *ConfigRewrite) GetInstanceRewrite() *InstanceConfigRewrite { + if !p.IsSetInstanceRewrite() { + return ConfigRewrite_InstanceRewrite_DEFAULT + } + return p.InstanceRewrite +} +func (p *ConfigRewrite) CountSetFieldsConfigRewrite() int { + count := 0 + if p.IsSetJobRewrite() { + count++ + } + if p.IsSetInstanceRewrite() { + count++ + } + return count + +} + +func (p *ConfigRewrite) IsSetJobRewrite() bool { + return p.JobRewrite != nil +} + +func (p *ConfigRewrite) IsSetInstanceRewrite() bool { + return p.InstanceRewrite != nil +} + +func (p *ConfigRewrite) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *ConfigRewrite) readField1(iprot thrift.TProtocol) error { + p.JobRewrite = &JobConfigRewrite{} + if err := p.JobRewrite.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JobRewrite), err) + } + return nil +} + +func (p *ConfigRewrite) readField2(iprot thrift.TProtocol) error { + p.InstanceRewrite = &InstanceConfigRewrite{} + if err := p.InstanceRewrite.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.InstanceRewrite), err) + } + return nil +} + +func (p *ConfigRewrite) Write(oprot thrift.TProtocol) error { + if c := p.CountSetFieldsConfigRewrite(); c != 1 { + return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) + } + if err := oprot.WriteStructBegin("ConfigRewrite"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := p.writeField2(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *ConfigRewrite) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetJobRewrite() { + if err := oprot.WriteFieldBegin("jobRewrite", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:jobRewrite: ", p), err) + } + if err := p.JobRewrite.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JobRewrite), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:jobRewrite: ", p), err) + } + } + return err +} + +func (p *ConfigRewrite) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetInstanceRewrite() { + if err := oprot.WriteFieldBegin("instanceRewrite", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:instanceRewrite: ", p), err) + } + if err := p.InstanceRewrite.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.InstanceRewrite), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:instanceRewrite: ", p), err) + } + } + return err +} + +func (p *ConfigRewrite) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ConfigRewrite(%+v)", *p) +} + +// Attributes: +// - RewriteCommands +type RewriteConfigsRequest struct { + RewriteCommands []*ConfigRewrite `thrift:"rewriteCommands,1" json:"rewriteCommands"` +} + +func NewRewriteConfigsRequest() *RewriteConfigsRequest { + return &RewriteConfigsRequest{} +} + +func (p *RewriteConfigsRequest) GetRewriteCommands() []*ConfigRewrite { + return p.RewriteCommands +} +func (p *RewriteConfigsRequest) Read(iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + 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 err := p.readField1(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *RewriteConfigsRequest) readField1(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]*ConfigRewrite, 0, size) + p.RewriteCommands = tSlice + for i := 0; i < size; i++ { + _elem49 := &ConfigRewrite{} + if err := _elem49.Read(iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem49), err) + } + p.RewriteCommands = append(p.RewriteCommands, _elem49) + } + if err := iprot.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + +func (p *RewriteConfigsRequest) Write(oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin("RewriteConfigsRequest"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + if err := p.writeField1(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return thrift.PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return thrift.PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *RewriteConfigsRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin("rewriteCommands", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:rewriteCommands: ", p), err) + } + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.RewriteCommands)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.RewriteCommands { + if err := v.Write(oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:rewriteCommands: ", p), err) + } + return err +} + +func (p *RewriteConfigsRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("RewriteConfigsRequest(%+v)", *p) +} diff --git a/vendor/git.apache.org/thrift.git/LICENSE b/vendor/git.apache.org/thrift.git/LICENSE new file mode 100644 index 0000000..3b6d7d7 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/LICENSE @@ -0,0 +1,239 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +-------------------------------------------------- +SOFTWARE DISTRIBUTED WITH THRIFT: + +The Apache Thrift software includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +-------------------------------------------------- +Portions of the following files are licensed under the MIT License: + + lib/erl/src/Makefile.am + +Please see doc/otp-base-license.txt for the full terms of this license. + +-------------------------------------------------- +For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 components: + +# Copyright (c) 2007 Thomas Porschberg +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +-------------------------------------------------- +For the lib/nodejs/lib/thrift/json_parse.js: + +/* + json_parse.js + 2015-05-02 + Public Domain. + NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + +*/ +(By Douglas Crockford ) +-------------------------------------------------- diff --git a/vendor/git.apache.org/thrift.git/NOTICE b/vendor/git.apache.org/thrift.git/NOTICE new file mode 100644 index 0000000..c23995a --- /dev/null +++ b/vendor/git.apache.org/thrift.git/NOTICE @@ -0,0 +1,5 @@ +Apache Thrift +Copyright 2006-2010 The Apache Software Foundation. + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception.go new file mode 100644 index 0000000..6655cc5 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception.go @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +const ( + UNKNOWN_APPLICATION_EXCEPTION = 0 + UNKNOWN_METHOD = 1 + INVALID_MESSAGE_TYPE_EXCEPTION = 2 + WRONG_METHOD_NAME = 3 + BAD_SEQUENCE_ID = 4 + MISSING_RESULT = 5 + INTERNAL_ERROR = 6 + PROTOCOL_ERROR = 7 +) + +// Application level Thrift exception +type TApplicationException interface { + TException + TypeId() int32 + Read(iprot TProtocol) (TApplicationException, error) + Write(oprot TProtocol) error +} + +type tApplicationException struct { + message string + type_ int32 +} + +func (e tApplicationException) Error() string { + return e.message +} + +func NewTApplicationException(type_ int32, message string) TApplicationException { + return &tApplicationException{message, type_} +} + +func (p *tApplicationException) TypeId() int32 { + return p.type_ +} + +func (p *tApplicationException) Read(iprot TProtocol) (TApplicationException, error) { + _, err := iprot.ReadStructBegin() + if err != nil { + return nil, err + } + + message := "" + type_ := int32(UNKNOWN_APPLICATION_EXCEPTION) + + for { + _, ttype, id, err := iprot.ReadFieldBegin() + if err != nil { + return nil, err + } + if ttype == STOP { + break + } + switch id { + case 1: + if ttype == STRING { + if message, err = iprot.ReadString(); err != nil { + return nil, err + } + } else { + if err = SkipDefaultDepth(iprot, ttype); err != nil { + return nil, err + } + } + case 2: + if ttype == I32 { + if type_, err = iprot.ReadI32(); err != nil { + return nil, err + } + } else { + if err = SkipDefaultDepth(iprot, ttype); err != nil { + return nil, err + } + } + default: + if err = SkipDefaultDepth(iprot, ttype); err != nil { + return nil, err + } + } + if err = iprot.ReadFieldEnd(); err != nil { + return nil, err + } + } + return NewTApplicationException(type_, message), iprot.ReadStructEnd() +} + +func (p *tApplicationException) Write(oprot TProtocol) (err error) { + err = oprot.WriteStructBegin("TApplicationException") + if len(p.Error()) > 0 { + err = oprot.WriteFieldBegin("message", STRING, 1) + if err != nil { + return + } + err = oprot.WriteString(p.Error()) + if err != nil { + return + } + err = oprot.WriteFieldEnd() + if err != nil { + return + } + } + err = oprot.WriteFieldBegin("type", I32, 2) + if err != nil { + return + } + err = oprot.WriteI32(p.type_) + if err != nil { + return + } + err = oprot.WriteFieldEnd() + if err != nil { + return + } + err = oprot.WriteFieldStop() + if err != nil { + return + } + err = oprot.WriteStructEnd() + return +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception_test.go new file mode 100644 index 0000000..7010f86 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/application_exception_test.go @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestTApplicationException(t *testing.T) { + exc := NewTApplicationException(UNKNOWN_APPLICATION_EXCEPTION, "") + if exc.Error() != "" { + t.Fatalf("Expected empty string for exception but found '%s'", exc.Error()) + } + if exc.TypeId() != UNKNOWN_APPLICATION_EXCEPTION { + t.Fatalf("Expected type UNKNOWN for exception but found '%s'", exc.TypeId()) + } + exc = NewTApplicationException(WRONG_METHOD_NAME, "junk_method") + if exc.Error() != "junk_method" { + t.Fatalf("Expected 'junk_method' for exception but found '%s'", exc.Error()) + } + if exc.TypeId() != WRONG_METHOD_NAME { + t.Fatalf("Expected type WRONG_METHOD_NAME for exception but found '%s'", exc.TypeId()) + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol.go new file mode 100644 index 0000000..690d341 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol.go @@ -0,0 +1,514 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "math" +) + +type TBinaryProtocol struct { + trans TRichTransport + origTransport TTransport + reader io.Reader + writer io.Writer + strictRead bool + strictWrite bool + buffer [64]byte +} + +type TBinaryProtocolFactory struct { + strictRead bool + strictWrite bool +} + +func NewTBinaryProtocolTransport(t TTransport) *TBinaryProtocol { + return NewTBinaryProtocol(t, false, true) +} + +func NewTBinaryProtocol(t TTransport, strictRead, strictWrite bool) *TBinaryProtocol { + p := &TBinaryProtocol{origTransport: t, strictRead: strictRead, strictWrite: strictWrite} + if et, ok := t.(TRichTransport); ok { + p.trans = et + } else { + p.trans = NewTRichTransport(t) + } + p.reader = p.trans + p.writer = p.trans + return p +} + +func NewTBinaryProtocolFactoryDefault() *TBinaryProtocolFactory { + return NewTBinaryProtocolFactory(false, true) +} + +func NewTBinaryProtocolFactory(strictRead, strictWrite bool) *TBinaryProtocolFactory { + return &TBinaryProtocolFactory{strictRead: strictRead, strictWrite: strictWrite} +} + +func (p *TBinaryProtocolFactory) GetProtocol(t TTransport) TProtocol { + return NewTBinaryProtocol(t, p.strictRead, p.strictWrite) +} + +/** + * Writing Methods + */ + +func (p *TBinaryProtocol) WriteMessageBegin(name string, typeId TMessageType, seqId int32) error { + if p.strictWrite { + version := uint32(VERSION_1) | uint32(typeId) + e := p.WriteI32(int32(version)) + if e != nil { + return e + } + e = p.WriteString(name) + if e != nil { + return e + } + e = p.WriteI32(seqId) + return e + } else { + e := p.WriteString(name) + if e != nil { + return e + } + e = p.WriteByte(int8(typeId)) + if e != nil { + return e + } + e = p.WriteI32(seqId) + return e + } + return nil +} + +func (p *TBinaryProtocol) WriteMessageEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteStructBegin(name string) error { + return nil +} + +func (p *TBinaryProtocol) WriteStructEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteFieldBegin(name string, typeId TType, id int16) error { + e := p.WriteByte(int8(typeId)) + if e != nil { + return e + } + e = p.WriteI16(id) + return e +} + +func (p *TBinaryProtocol) WriteFieldEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteFieldStop() error { + e := p.WriteByte(STOP) + return e +} + +func (p *TBinaryProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error { + e := p.WriteByte(int8(keyType)) + if e != nil { + return e + } + e = p.WriteByte(int8(valueType)) + if e != nil { + return e + } + e = p.WriteI32(int32(size)) + return e +} + +func (p *TBinaryProtocol) WriteMapEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteListBegin(elemType TType, size int) error { + e := p.WriteByte(int8(elemType)) + if e != nil { + return e + } + e = p.WriteI32(int32(size)) + return e +} + +func (p *TBinaryProtocol) WriteListEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteSetBegin(elemType TType, size int) error { + e := p.WriteByte(int8(elemType)) + if e != nil { + return e + } + e = p.WriteI32(int32(size)) + return e +} + +func (p *TBinaryProtocol) WriteSetEnd() error { + return nil +} + +func (p *TBinaryProtocol) WriteBool(value bool) error { + if value { + return p.WriteByte(1) + } + return p.WriteByte(0) +} + +func (p *TBinaryProtocol) WriteByte(value int8) error { + e := p.trans.WriteByte(byte(value)) + return NewTProtocolException(e) +} + +func (p *TBinaryProtocol) WriteI16(value int16) error { + v := p.buffer[0:2] + binary.BigEndian.PutUint16(v, uint16(value)) + _, e := p.writer.Write(v) + return NewTProtocolException(e) +} + +func (p *TBinaryProtocol) WriteI32(value int32) error { + v := p.buffer[0:4] + binary.BigEndian.PutUint32(v, uint32(value)) + _, e := p.writer.Write(v) + return NewTProtocolException(e) +} + +func (p *TBinaryProtocol) WriteI64(value int64) error { + v := p.buffer[0:8] + binary.BigEndian.PutUint64(v, uint64(value)) + _, err := p.writer.Write(v) + return NewTProtocolException(err) +} + +func (p *TBinaryProtocol) WriteDouble(value float64) error { + return p.WriteI64(int64(math.Float64bits(value))) +} + +func (p *TBinaryProtocol) WriteString(value string) error { + e := p.WriteI32(int32(len(value))) + if e != nil { + return e + } + _, err := p.trans.WriteString(value) + return NewTProtocolException(err) +} + +func (p *TBinaryProtocol) WriteBinary(value []byte) error { + e := p.WriteI32(int32(len(value))) + if e != nil { + return e + } + _, err := p.writer.Write(value) + return NewTProtocolException(err) +} + +/** + * Reading methods + */ + +func (p *TBinaryProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error) { + size, e := p.ReadI32() + if e != nil { + return "", typeId, 0, NewTProtocolException(e) + } + if size < 0 { + typeId = TMessageType(size & 0x0ff) + version := int64(int64(size) & VERSION_MASK) + if version != VERSION_1 { + return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Bad version in ReadMessageBegin")) + } + name, e = p.ReadString() + if e != nil { + return name, typeId, seqId, NewTProtocolException(e) + } + seqId, e = p.ReadI32() + if e != nil { + return name, typeId, seqId, NewTProtocolException(e) + } + return name, typeId, seqId, nil + } + if p.strictRead { + return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Missing version in ReadMessageBegin")) + } + name, e2 := p.readStringBody(size) + if e2 != nil { + return name, typeId, seqId, e2 + } + b, e3 := p.ReadByte() + if e3 != nil { + return name, typeId, seqId, e3 + } + typeId = TMessageType(b) + seqId, e4 := p.ReadI32() + if e4 != nil { + return name, typeId, seqId, e4 + } + return name, typeId, seqId, nil +} + +func (p *TBinaryProtocol) ReadMessageEnd() error { + return nil +} + +func (p *TBinaryProtocol) ReadStructBegin() (name string, err error) { + return +} + +func (p *TBinaryProtocol) ReadStructEnd() error { + return nil +} + +func (p *TBinaryProtocol) ReadFieldBegin() (name string, typeId TType, seqId int16, err error) { + t, err := p.ReadByte() + typeId = TType(t) + if err != nil { + return name, typeId, seqId, err + } + if t != STOP { + seqId, err = p.ReadI16() + } + return name, typeId, seqId, err +} + +func (p *TBinaryProtocol) ReadFieldEnd() error { + return nil +} + +var invalidDataLength = NewTProtocolExceptionWithType(INVALID_DATA, errors.New("Invalid data length")) + +func (p *TBinaryProtocol) ReadMapBegin() (kType, vType TType, size int, err error) { + k, e := p.ReadByte() + if e != nil { + err = NewTProtocolException(e) + return + } + kType = TType(k) + v, e := p.ReadByte() + if e != nil { + err = NewTProtocolException(e) + return + } + vType = TType(v) + size32, e := p.ReadI32() + if e != nil { + err = NewTProtocolException(e) + return + } + if size32 < 0 { + err = invalidDataLength + return + } + size = int(size32) + return kType, vType, size, nil +} + +func (p *TBinaryProtocol) ReadMapEnd() error { + return nil +} + +func (p *TBinaryProtocol) ReadListBegin() (elemType TType, size int, err error) { + b, e := p.ReadByte() + if e != nil { + err = NewTProtocolException(e) + return + } + elemType = TType(b) + size32, e := p.ReadI32() + if e != nil { + err = NewTProtocolException(e) + return + } + if size32 < 0 { + err = invalidDataLength + return + } + size = int(size32) + + return +} + +func (p *TBinaryProtocol) ReadListEnd() error { + return nil +} + +func (p *TBinaryProtocol) ReadSetBegin() (elemType TType, size int, err error) { + b, e := p.ReadByte() + if e != nil { + err = NewTProtocolException(e) + return + } + elemType = TType(b) + size32, e := p.ReadI32() + if e != nil { + err = NewTProtocolException(e) + return + } + if size32 < 0 { + err = invalidDataLength + return + } + size = int(size32) + return elemType, size, nil +} + +func (p *TBinaryProtocol) ReadSetEnd() error { + return nil +} + +func (p *TBinaryProtocol) ReadBool() (bool, error) { + b, e := p.ReadByte() + v := true + if b != 1 { + v = false + } + return v, e +} + +func (p *TBinaryProtocol) ReadByte() (int8, error) { + v, err := p.trans.ReadByte() + return int8(v), err +} + +func (p *TBinaryProtocol) ReadI16() (value int16, err error) { + buf := p.buffer[0:2] + err = p.readAll(buf) + value = int16(binary.BigEndian.Uint16(buf)) + return value, err +} + +func (p *TBinaryProtocol) ReadI32() (value int32, err error) { + buf := p.buffer[0:4] + err = p.readAll(buf) + value = int32(binary.BigEndian.Uint32(buf)) + return value, err +} + +func (p *TBinaryProtocol) ReadI64() (value int64, err error) { + buf := p.buffer[0:8] + err = p.readAll(buf) + value = int64(binary.BigEndian.Uint64(buf)) + return value, err +} + +func (p *TBinaryProtocol) ReadDouble() (value float64, err error) { + buf := p.buffer[0:8] + err = p.readAll(buf) + value = math.Float64frombits(binary.BigEndian.Uint64(buf)) + return value, err +} + +func (p *TBinaryProtocol) ReadString() (value string, err error) { + size, e := p.ReadI32() + if e != nil { + return "", e + } + if size < 0 { + err = invalidDataLength + return + } + + return p.readStringBody(size) +} + +func (p *TBinaryProtocol) ReadBinary() ([]byte, error) { + size, e := p.ReadI32() + if e != nil { + return nil, e + } + if size < 0 { + return nil, invalidDataLength + } + if uint64(size) > p.trans.RemainingBytes() { + return nil, invalidDataLength + } + + isize := int(size) + buf := make([]byte, isize) + _, err := io.ReadFull(p.trans, buf) + return buf, NewTProtocolException(err) +} + +func (p *TBinaryProtocol) Flush() (err error) { + return NewTProtocolException(p.trans.Flush()) +} + +func (p *TBinaryProtocol) Skip(fieldType TType) (err error) { + return SkipDefaultDepth(p, fieldType) +} + +func (p *TBinaryProtocol) Transport() TTransport { + return p.origTransport +} + +func (p *TBinaryProtocol) readAll(buf []byte) error { + _, err := io.ReadFull(p.reader, buf) + return NewTProtocolException(err) +} + +const readLimit = 32768 + +func (p *TBinaryProtocol) readStringBody(size int32) (value string, err error) { + if size < 0 { + return "", nil + } + if uint64(size) > p.trans.RemainingBytes() { + return "", invalidDataLength + } + + var ( + buf bytes.Buffer + e error + b []byte + ) + + switch { + case int(size) <= len(p.buffer): + b = p.buffer[:size] // avoids allocation for small reads + case int(size) < readLimit: + b = make([]byte, size) + default: + b = make([]byte, readLimit) + } + + for size > 0 { + _, e = io.ReadFull(p.trans, b) + buf.Write(b) + if e != nil { + break + } + size -= readLimit + if size < readLimit && size > 0 { + b = b[:size] + } + } + return buf.String(), NewTProtocolException(e) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol_test.go new file mode 100644 index 0000000..0462cc7 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/binary_protocol_test.go @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestReadWriteBinaryProtocol(t *testing.T) { + ReadWriteProtocolTest(t, NewTBinaryProtocolFactoryDefault()) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go new file mode 100644 index 0000000..f73a98b --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport.go @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bufio" +) + +type TBufferedTransportFactory struct { + size int +} + +type TBufferedTransport struct { + bufio.ReadWriter + tp TTransport +} + +func (p *TBufferedTransportFactory) GetTransport(trans TTransport) TTransport { + return NewTBufferedTransport(trans, p.size) +} + +func NewTBufferedTransportFactory(bufferSize int) *TBufferedTransportFactory { + return &TBufferedTransportFactory{size: bufferSize} +} + +func NewTBufferedTransport(trans TTransport, bufferSize int) *TBufferedTransport { + return &TBufferedTransport{ + ReadWriter: bufio.ReadWriter{ + Reader: bufio.NewReaderSize(trans, bufferSize), + Writer: bufio.NewWriterSize(trans, bufferSize), + }, + tp: trans, + } +} + +func (p *TBufferedTransport) IsOpen() bool { + return p.tp.IsOpen() +} + +func (p *TBufferedTransport) Open() (err error) { + return p.tp.Open() +} + +func (p *TBufferedTransport) Close() (err error) { + return p.tp.Close() +} + +func (p *TBufferedTransport) Read(b []byte) (int, error) { + n, err := p.ReadWriter.Read(b) + if err != nil { + p.ReadWriter.Reader.Reset(p.tp) + } + return n, err +} + +func (p *TBufferedTransport) Write(b []byte) (int, error) { + n, err := p.ReadWriter.Write(b) + if err != nil { + p.ReadWriter.Writer.Reset(p.tp) + } + return n, err +} + +func (p *TBufferedTransport) Flush() error { + if err := p.ReadWriter.Flush(); err != nil { + p.ReadWriter.Writer.Reset(p.tp) + return err + } + return p.tp.Flush() +} + +func (p *TBufferedTransport) RemainingBytes() (num_bytes uint64) { + return p.tp.RemainingBytes() +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport_test.go new file mode 100644 index 0000000..95ec0cb --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/buffered_transport_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestBufferedTransport(t *testing.T) { + trans := NewTBufferedTransport(NewTMemoryBuffer(), 10240) + TransportTest(t, trans, trans) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol.go new file mode 100644 index 0000000..0bc5fdd --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol.go @@ -0,0 +1,815 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "encoding/binary" + "fmt" + "io" + "math" +) + +const ( + COMPACT_PROTOCOL_ID = 0x082 + COMPACT_VERSION = 1 + COMPACT_VERSION_MASK = 0x1f + COMPACT_TYPE_MASK = 0x0E0 + COMPACT_TYPE_BITS = 0x07 + COMPACT_TYPE_SHIFT_AMOUNT = 5 +) + +type tCompactType byte + +const ( + COMPACT_BOOLEAN_TRUE = 0x01 + COMPACT_BOOLEAN_FALSE = 0x02 + COMPACT_BYTE = 0x03 + COMPACT_I16 = 0x04 + COMPACT_I32 = 0x05 + COMPACT_I64 = 0x06 + COMPACT_DOUBLE = 0x07 + COMPACT_BINARY = 0x08 + COMPACT_LIST = 0x09 + COMPACT_SET = 0x0A + COMPACT_MAP = 0x0B + COMPACT_STRUCT = 0x0C +) + +var ( + ttypeToCompactType map[TType]tCompactType +) + +func init() { + ttypeToCompactType = map[TType]tCompactType{ + STOP: STOP, + BOOL: COMPACT_BOOLEAN_TRUE, + BYTE: COMPACT_BYTE, + I16: COMPACT_I16, + I32: COMPACT_I32, + I64: COMPACT_I64, + DOUBLE: COMPACT_DOUBLE, + STRING: COMPACT_BINARY, + LIST: COMPACT_LIST, + SET: COMPACT_SET, + MAP: COMPACT_MAP, + STRUCT: COMPACT_STRUCT, + } +} + +type TCompactProtocolFactory struct{} + +func NewTCompactProtocolFactory() *TCompactProtocolFactory { + return &TCompactProtocolFactory{} +} + +func (p *TCompactProtocolFactory) GetProtocol(trans TTransport) TProtocol { + return NewTCompactProtocol(trans) +} + +type TCompactProtocol struct { + trans TRichTransport + origTransport TTransport + + // Used to keep track of the last field for the current and previous structs, + // so we can do the delta stuff. + lastField []int + lastFieldId int + + // If we encounter a boolean field begin, save the TField here so it can + // have the value incorporated. + booleanFieldName string + booleanFieldId int16 + booleanFieldPending bool + + // If we read a field header, and it's a boolean field, save the boolean + // value here so that readBool can use it. + boolValue bool + boolValueIsNotNull bool + buffer [64]byte +} + +// Create a TCompactProtocol given a TTransport +func NewTCompactProtocol(trans TTransport) *TCompactProtocol { + p := &TCompactProtocol{origTransport: trans, lastField: []int{}} + if et, ok := trans.(TRichTransport); ok { + p.trans = et + } else { + p.trans = NewTRichTransport(trans) + } + + return p + +} + +// +// Public Writing methods. +// + +// Write a message header to the wire. Compact Protocol messages contain the +// protocol version so we can migrate forwards in the future if need be. +func (p *TCompactProtocol) WriteMessageBegin(name string, typeId TMessageType, seqid int32) error { + err := p.writeByteDirect(COMPACT_PROTOCOL_ID) + if err != nil { + return NewTProtocolException(err) + } + err = p.writeByteDirect((COMPACT_VERSION & COMPACT_VERSION_MASK) | ((byte(typeId) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK)) + if err != nil { + return NewTProtocolException(err) + } + _, err = p.writeVarint32(seqid) + if err != nil { + return NewTProtocolException(err) + } + e := p.WriteString(name) + return e + +} + +func (p *TCompactProtocol) WriteMessageEnd() error { return nil } + +// Write a struct begin. This doesn't actually put anything on the wire. We +// use it as an opportunity to put special placeholder markers on the field +// stack so we can get the field id deltas correct. +func (p *TCompactProtocol) WriteStructBegin(name string) error { + p.lastField = append(p.lastField, p.lastFieldId) + p.lastFieldId = 0 + return nil +} + +// Write a struct end. This doesn't actually put anything on the wire. We use +// this as an opportunity to pop the last field from the current struct off +// of the field stack. +func (p *TCompactProtocol) WriteStructEnd() error { + p.lastFieldId = p.lastField[len(p.lastField)-1] + p.lastField = p.lastField[:len(p.lastField)-1] + return nil +} + +func (p *TCompactProtocol) WriteFieldBegin(name string, typeId TType, id int16) error { + if typeId == BOOL { + // we want to possibly include the value, so we'll wait. + p.booleanFieldName, p.booleanFieldId, p.booleanFieldPending = name, id, true + return nil + } + _, err := p.writeFieldBeginInternal(name, typeId, id, 0xFF) + return NewTProtocolException(err) +} + +// The workhorse of writeFieldBegin. It has the option of doing a +// 'type override' of the type header. This is used specifically in the +// boolean field case. +func (p *TCompactProtocol) writeFieldBeginInternal(name string, typeId TType, id int16, typeOverride byte) (int, error) { + // short lastField = lastField_.pop(); + + // if there's a type override, use that. + var typeToWrite byte + if typeOverride == 0xFF { + typeToWrite = byte(p.getCompactType(typeId)) + } else { + typeToWrite = typeOverride + } + // check if we can use delta encoding for the field id + fieldId := int(id) + written := 0 + if fieldId > p.lastFieldId && fieldId-p.lastFieldId <= 15 { + // write them together + err := p.writeByteDirect(byte((fieldId-p.lastFieldId)<<4) | typeToWrite) + if err != nil { + return 0, err + } + } else { + // write them separate + err := p.writeByteDirect(typeToWrite) + if err != nil { + return 0, err + } + err = p.WriteI16(id) + written = 1 + 2 + if err != nil { + return 0, err + } + } + + p.lastFieldId = fieldId + // p.lastField.Push(field.id); + return written, nil +} + +func (p *TCompactProtocol) WriteFieldEnd() error { return nil } + +func (p *TCompactProtocol) WriteFieldStop() error { + err := p.writeByteDirect(STOP) + return NewTProtocolException(err) +} + +func (p *TCompactProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error { + if size == 0 { + err := p.writeByteDirect(0) + return NewTProtocolException(err) + } + _, err := p.writeVarint32(int32(size)) + if err != nil { + return NewTProtocolException(err) + } + err = p.writeByteDirect(byte(p.getCompactType(keyType))<<4 | byte(p.getCompactType(valueType))) + return NewTProtocolException(err) +} + +func (p *TCompactProtocol) WriteMapEnd() error { return nil } + +// Write a list header. +func (p *TCompactProtocol) WriteListBegin(elemType TType, size int) error { + _, err := p.writeCollectionBegin(elemType, size) + return NewTProtocolException(err) +} + +func (p *TCompactProtocol) WriteListEnd() error { return nil } + +// Write a set header. +func (p *TCompactProtocol) WriteSetBegin(elemType TType, size int) error { + _, err := p.writeCollectionBegin(elemType, size) + return NewTProtocolException(err) +} + +func (p *TCompactProtocol) WriteSetEnd() error { return nil } + +func (p *TCompactProtocol) WriteBool(value bool) error { + v := byte(COMPACT_BOOLEAN_FALSE) + if value { + v = byte(COMPACT_BOOLEAN_TRUE) + } + if p.booleanFieldPending { + // we haven't written the field header yet + _, err := p.writeFieldBeginInternal(p.booleanFieldName, BOOL, p.booleanFieldId, v) + p.booleanFieldPending = false + return NewTProtocolException(err) + } + // we're not part of a field, so just write the value. + err := p.writeByteDirect(v) + return NewTProtocolException(err) +} + +// Write a byte. Nothing to see here! +func (p *TCompactProtocol) WriteByte(value int8) error { + err := p.writeByteDirect(byte(value)) + return NewTProtocolException(err) +} + +// Write an I16 as a zigzag varint. +func (p *TCompactProtocol) WriteI16(value int16) error { + _, err := p.writeVarint32(p.int32ToZigzag(int32(value))) + return NewTProtocolException(err) +} + +// Write an i32 as a zigzag varint. +func (p *TCompactProtocol) WriteI32(value int32) error { + _, err := p.writeVarint32(p.int32ToZigzag(value)) + return NewTProtocolException(err) +} + +// Write an i64 as a zigzag varint. +func (p *TCompactProtocol) WriteI64(value int64) error { + _, err := p.writeVarint64(p.int64ToZigzag(value)) + return NewTProtocolException(err) +} + +// Write a double to the wire as 8 bytes. +func (p *TCompactProtocol) WriteDouble(value float64) error { + buf := p.buffer[0:8] + binary.LittleEndian.PutUint64(buf, math.Float64bits(value)) + _, err := p.trans.Write(buf) + return NewTProtocolException(err) +} + +// Write a string to the wire with a varint size preceding. +func (p *TCompactProtocol) WriteString(value string) error { + _, e := p.writeVarint32(int32(len(value))) + if e != nil { + return NewTProtocolException(e) + } + if len(value) > 0 { + } + _, e = p.trans.WriteString(value) + return e +} + +// Write a byte array, using a varint for the size. +func (p *TCompactProtocol) WriteBinary(bin []byte) error { + _, e := p.writeVarint32(int32(len(bin))) + if e != nil { + return NewTProtocolException(e) + } + if len(bin) > 0 { + _, e = p.trans.Write(bin) + return NewTProtocolException(e) + } + return nil +} + +// +// Reading methods. +// + +// Read a message header. +func (p *TCompactProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error) { + + protocolId, err := p.readByteDirect() + if err != nil { + return + } + + if protocolId != COMPACT_PROTOCOL_ID { + e := fmt.Errorf("Expected protocol id %02x but got %02x", COMPACT_PROTOCOL_ID, protocolId) + return "", typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, e) + } + + versionAndType, err := p.readByteDirect() + if err != nil { + return + } + + version := versionAndType & COMPACT_VERSION_MASK + typeId = TMessageType((versionAndType >> COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_BITS) + if version != COMPACT_VERSION { + e := fmt.Errorf("Expected version %02x but got %02x", COMPACT_VERSION, version) + err = NewTProtocolExceptionWithType(BAD_VERSION, e) + return + } + seqId, e := p.readVarint32() + if e != nil { + err = NewTProtocolException(e) + return + } + name, err = p.ReadString() + return +} + +func (p *TCompactProtocol) ReadMessageEnd() error { return nil } + +// Read a struct begin. There's nothing on the wire for this, but it is our +// opportunity to push a new struct begin marker onto the field stack. +func (p *TCompactProtocol) ReadStructBegin() (name string, err error) { + p.lastField = append(p.lastField, p.lastFieldId) + p.lastFieldId = 0 + return +} + +// Doesn't actually consume any wire data, just removes the last field for +// this struct from the field stack. +func (p *TCompactProtocol) ReadStructEnd() error { + // consume the last field we read off the wire. + p.lastFieldId = p.lastField[len(p.lastField)-1] + p.lastField = p.lastField[:len(p.lastField)-1] + return nil +} + +// Read a field header off the wire. +func (p *TCompactProtocol) ReadFieldBegin() (name string, typeId TType, id int16, err error) { + t, err := p.readByteDirect() + if err != nil { + return + } + + // if it's a stop, then we can return immediately, as the struct is over. + if (t & 0x0f) == STOP { + return "", STOP, 0, nil + } + + // mask off the 4 MSB of the type header. it could contain a field id delta. + modifier := int16((t & 0xf0) >> 4) + if modifier == 0 { + // not a delta. look ahead for the zigzag varint field id. + id, err = p.ReadI16() + if err != nil { + return + } + } else { + // has a delta. add the delta to the last read field id. + id = int16(p.lastFieldId) + modifier + } + typeId, e := p.getTType(tCompactType(t & 0x0f)) + if e != nil { + err = NewTProtocolException(e) + return + } + + // if this happens to be a boolean field, the value is encoded in the type + if p.isBoolType(t) { + // save the boolean value in a special instance variable. + p.boolValue = (byte(t)&0x0f == COMPACT_BOOLEAN_TRUE) + p.boolValueIsNotNull = true + } + + // push the new field onto the field stack so we can keep the deltas going. + p.lastFieldId = int(id) + return +} + +func (p *TCompactProtocol) ReadFieldEnd() error { return nil } + +// Read a map header off the wire. If the size is zero, skip reading the key +// and value type. This means that 0-length maps will yield TMaps without the +// "correct" types. +func (p *TCompactProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, err error) { + size32, e := p.readVarint32() + if e != nil { + err = NewTProtocolException(e) + return + } + if size32 < 0 { + err = invalidDataLength + return + } + size = int(size32) + + keyAndValueType := byte(STOP) + if size != 0 { + keyAndValueType, err = p.readByteDirect() + if err != nil { + return + } + } + keyType, _ = p.getTType(tCompactType(keyAndValueType >> 4)) + valueType, _ = p.getTType(tCompactType(keyAndValueType & 0xf)) + return +} + +func (p *TCompactProtocol) ReadMapEnd() error { return nil } + +// Read a list header off the wire. If the list size is 0-14, the size will +// be packed into the element type header. If it's a longer list, the 4 MSB +// of the element type header will be 0xF, and a varint will follow with the +// true size. +func (p *TCompactProtocol) ReadListBegin() (elemType TType, size int, err error) { + size_and_type, err := p.readByteDirect() + if err != nil { + return + } + size = int((size_and_type >> 4) & 0x0f) + if size == 15 { + size2, e := p.readVarint32() + if e != nil { + err = NewTProtocolException(e) + return + } + if size2 < 0 { + err = invalidDataLength + return + } + size = int(size2) + } + elemType, e := p.getTType(tCompactType(size_and_type)) + if e != nil { + err = NewTProtocolException(e) + return + } + return +} + +func (p *TCompactProtocol) ReadListEnd() error { return nil } + +// Read a set header off the wire. If the set size is 0-14, the size will +// be packed into the element type header. If it's a longer set, the 4 MSB +// of the element type header will be 0xF, and a varint will follow with the +// true size. +func (p *TCompactProtocol) ReadSetBegin() (elemType TType, size int, err error) { + return p.ReadListBegin() +} + +func (p *TCompactProtocol) ReadSetEnd() error { return nil } + +// Read a boolean off the wire. If this is a boolean field, the value should +// already have been read during readFieldBegin, so we'll just consume the +// pre-stored value. Otherwise, read a byte. +func (p *TCompactProtocol) ReadBool() (value bool, err error) { + if p.boolValueIsNotNull { + p.boolValueIsNotNull = false + return p.boolValue, nil + } + v, err := p.readByteDirect() + return v == COMPACT_BOOLEAN_TRUE, err +} + +// Read a single byte off the wire. Nothing interesting here. +func (p *TCompactProtocol) ReadByte() (int8, error) { + v, err := p.readByteDirect() + if err != nil { + return 0, NewTProtocolException(err) + } + return int8(v), err +} + +// Read an i16 from the wire as a zigzag varint. +func (p *TCompactProtocol) ReadI16() (value int16, err error) { + v, err := p.ReadI32() + return int16(v), err +} + +// Read an i32 from the wire as a zigzag varint. +func (p *TCompactProtocol) ReadI32() (value int32, err error) { + v, e := p.readVarint32() + if e != nil { + return 0, NewTProtocolException(e) + } + value = p.zigzagToInt32(v) + return value, nil +} + +// Read an i64 from the wire as a zigzag varint. +func (p *TCompactProtocol) ReadI64() (value int64, err error) { + v, e := p.readVarint64() + if e != nil { + return 0, NewTProtocolException(e) + } + value = p.zigzagToInt64(v) + return value, nil +} + +// No magic here - just read a double off the wire. +func (p *TCompactProtocol) ReadDouble() (value float64, err error) { + longBits := p.buffer[0:8] + _, e := io.ReadFull(p.trans, longBits) + if e != nil { + return 0.0, NewTProtocolException(e) + } + return math.Float64frombits(p.bytesToUint64(longBits)), nil +} + +// Reads a []byte (via readBinary), and then UTF-8 decodes it. +func (p *TCompactProtocol) ReadString() (value string, err error) { + length, e := p.readVarint32() + if e != nil { + return "", NewTProtocolException(e) + } + if length < 0 { + return "", invalidDataLength + } + if uint64(length) > p.trans.RemainingBytes() { + return "", invalidDataLength + } + + if length == 0 { + return "", nil + } + var buf []byte + if length <= int32(len(p.buffer)) { + buf = p.buffer[0:length] + } else { + buf = make([]byte, length) + } + _, e = io.ReadFull(p.trans, buf) + return string(buf), NewTProtocolException(e) +} + +// Read a []byte from the wire. +func (p *TCompactProtocol) ReadBinary() (value []byte, err error) { + length, e := p.readVarint32() + if e != nil { + return nil, NewTProtocolException(e) + } + if length == 0 { + return []byte{}, nil + } + if length < 0 { + return nil, invalidDataLength + } + if uint64(length) > p.trans.RemainingBytes() { + return nil, invalidDataLength + } + + buf := make([]byte, length) + _, e = io.ReadFull(p.trans, buf) + return buf, NewTProtocolException(e) +} + +func (p *TCompactProtocol) Flush() (err error) { + return NewTProtocolException(p.trans.Flush()) +} + +func (p *TCompactProtocol) Skip(fieldType TType) (err error) { + return SkipDefaultDepth(p, fieldType) +} + +func (p *TCompactProtocol) Transport() TTransport { + return p.origTransport +} + +// +// Internal writing methods +// + +// Abstract method for writing the start of lists and sets. List and sets on +// the wire differ only by the type indicator. +func (p *TCompactProtocol) writeCollectionBegin(elemType TType, size int) (int, error) { + if size <= 14 { + return 1, p.writeByteDirect(byte(int32(size<<4) | int32(p.getCompactType(elemType)))) + } + err := p.writeByteDirect(0xf0 | byte(p.getCompactType(elemType))) + if err != nil { + return 0, err + } + m, err := p.writeVarint32(int32(size)) + return 1 + m, err +} + +// Write an i32 as a varint. Results in 1-5 bytes on the wire. +// TODO(pomack): make a permanent buffer like writeVarint64? +func (p *TCompactProtocol) writeVarint32(n int32) (int, error) { + i32buf := p.buffer[0:5] + idx := 0 + for { + if (n & ^0x7F) == 0 { + i32buf[idx] = byte(n) + idx++ + // p.writeByteDirect(byte(n)); + break + // return; + } else { + i32buf[idx] = byte((n & 0x7F) | 0x80) + idx++ + // p.writeByteDirect(byte(((n & 0x7F) | 0x80))); + u := uint32(n) + n = int32(u >> 7) + } + } + return p.trans.Write(i32buf[0:idx]) +} + +// Write an i64 as a varint. Results in 1-10 bytes on the wire. +func (p *TCompactProtocol) writeVarint64(n int64) (int, error) { + varint64out := p.buffer[0:10] + idx := 0 + for { + if (n & ^0x7F) == 0 { + varint64out[idx] = byte(n) + idx++ + break + } else { + varint64out[idx] = byte((n & 0x7F) | 0x80) + idx++ + u := uint64(n) + n = int64(u >> 7) + } + } + return p.trans.Write(varint64out[0:idx]) +} + +// Convert l into a zigzag long. This allows negative numbers to be +// represented compactly as a varint. +func (p *TCompactProtocol) int64ToZigzag(l int64) int64 { + return (l << 1) ^ (l >> 63) +} + +// Convert l into a zigzag long. This allows negative numbers to be +// represented compactly as a varint. +func (p *TCompactProtocol) int32ToZigzag(n int32) int32 { + return (n << 1) ^ (n >> 31) +} + +func (p *TCompactProtocol) fixedUint64ToBytes(n uint64, buf []byte) { + binary.LittleEndian.PutUint64(buf, n) +} + +func (p *TCompactProtocol) fixedInt64ToBytes(n int64, buf []byte) { + binary.LittleEndian.PutUint64(buf, uint64(n)) +} + +// Writes a byte without any possibility of all that field header nonsense. +// Used internally by other writing methods that know they need to write a byte. +func (p *TCompactProtocol) writeByteDirect(b byte) error { + return p.trans.WriteByte(b) +} + +// Writes a byte without any possibility of all that field header nonsense. +func (p *TCompactProtocol) writeIntAsByteDirect(n int) (int, error) { + return 1, p.writeByteDirect(byte(n)) +} + +// +// Internal reading methods +// + +// Read an i32 from the wire as a varint. The MSB of each byte is set +// if there is another byte to follow. This can read up to 5 bytes. +func (p *TCompactProtocol) readVarint32() (int32, error) { + // if the wire contains the right stuff, this will just truncate the i64 we + // read and get us the right sign. + v, err := p.readVarint64() + return int32(v), err +} + +// Read an i64 from the wire as a proper varint. The MSB of each byte is set +// if there is another byte to follow. This can read up to 10 bytes. +func (p *TCompactProtocol) readVarint64() (int64, error) { + shift := uint(0) + result := int64(0) + for { + b, err := p.readByteDirect() + if err != nil { + return 0, err + } + result |= int64(b&0x7f) << shift + if (b & 0x80) != 0x80 { + break + } + shift += 7 + } + return result, nil +} + +// Read a byte, unlike ReadByte that reads Thrift-byte that is i8. +func (p *TCompactProtocol) readByteDirect() (byte, error) { + return p.trans.ReadByte() +} + +// +// encoding helpers +// + +// Convert from zigzag int to int. +func (p *TCompactProtocol) zigzagToInt32(n int32) int32 { + u := uint32(n) + return int32(u>>1) ^ -(n & 1) +} + +// Convert from zigzag long to long. +func (p *TCompactProtocol) zigzagToInt64(n int64) int64 { + u := uint64(n) + return int64(u>>1) ^ -(n & 1) +} + +// Note that it's important that the mask bytes are long literals, +// otherwise they'll default to ints, and when you shift an int left 56 bits, +// you just get a messed up int. +func (p *TCompactProtocol) bytesToInt64(b []byte) int64 { + return int64(binary.LittleEndian.Uint64(b)) +} + +// Note that it's important that the mask bytes are long literals, +// otherwise they'll default to ints, and when you shift an int left 56 bits, +// you just get a messed up int. +func (p *TCompactProtocol) bytesToUint64(b []byte) uint64 { + return binary.LittleEndian.Uint64(b) +} + +// +// type testing and converting +// + +func (p *TCompactProtocol) isBoolType(b byte) bool { + return (b&0x0f) == COMPACT_BOOLEAN_TRUE || (b&0x0f) == COMPACT_BOOLEAN_FALSE +} + +// Given a tCompactType constant, convert it to its corresponding +// TType value. +func (p *TCompactProtocol) getTType(t tCompactType) (TType, error) { + switch byte(t) & 0x0f { + case STOP: + return STOP, nil + case COMPACT_BOOLEAN_FALSE, COMPACT_BOOLEAN_TRUE: + return BOOL, nil + case COMPACT_BYTE: + return BYTE, nil + case COMPACT_I16: + return I16, nil + case COMPACT_I32: + return I32, nil + case COMPACT_I64: + return I64, nil + case COMPACT_DOUBLE: + return DOUBLE, nil + case COMPACT_BINARY: + return STRING, nil + case COMPACT_LIST: + return LIST, nil + case COMPACT_SET: + return SET, nil + case COMPACT_MAP: + return MAP, nil + case COMPACT_STRUCT: + return STRUCT, nil + } + return STOP, TException(fmt.Errorf("don't know what type: %s", t&0x0f)) +} + +// Given a TType value, find the appropriate TCompactProtocol.Types constant. +func (p *TCompactProtocol) getCompactType(t TType) tCompactType { + return ttypeToCompactType[t] +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol_test.go new file mode 100644 index 0000000..72812f9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/compact_protocol_test.go @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "testing" +) + +func TestReadWriteCompactProtocol(t *testing.T) { + ReadWriteProtocolTest(t, NewTCompactProtocolFactory()) + transports := []TTransport{ + NewTMemoryBuffer(), + NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 16384))), + NewTFramedTransport(NewTMemoryBuffer()), + } + for _, trans := range transports { + p := NewTCompactProtocol(trans); + ReadWriteBool(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteByte(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI16(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI32(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteI64(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteDouble(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteString(t, p, trans); + p = NewTCompactProtocol(trans); + ReadWriteBinary(t, p, trans); + trans.Close(); + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/debug_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/debug_protocol.go new file mode 100644 index 0000000..d37252c --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/debug_protocol.go @@ -0,0 +1,269 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "log" +) + +type TDebugProtocol struct { + Delegate TProtocol + LogPrefix string +} + +type TDebugProtocolFactory struct { + Underlying TProtocolFactory + LogPrefix string +} + +func NewTDebugProtocolFactory(underlying TProtocolFactory, logPrefix string) *TDebugProtocolFactory { + return &TDebugProtocolFactory{ + Underlying: underlying, + LogPrefix: logPrefix, + } +} + +func (t *TDebugProtocolFactory) GetProtocol(trans TTransport) TProtocol { + return &TDebugProtocol{ + Delegate: t.Underlying.GetProtocol(trans), + LogPrefix: t.LogPrefix, + } +} + +func (tdp *TDebugProtocol) WriteMessageBegin(name string, typeId TMessageType, seqid int32) error { + err := tdp.Delegate.WriteMessageBegin(name, typeId, seqid) + log.Printf("%sWriteMessageBegin(name=%#v, typeId=%#v, seqid=%#v) => %#v", tdp.LogPrefix, name, typeId, seqid, err) + return err +} +func (tdp *TDebugProtocol) WriteMessageEnd() error { + err := tdp.Delegate.WriteMessageEnd() + log.Printf("%sWriteMessageEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteStructBegin(name string) error { + err := tdp.Delegate.WriteStructBegin(name) + log.Printf("%sWriteStructBegin(name=%#v) => %#v", tdp.LogPrefix, name, err) + return err +} +func (tdp *TDebugProtocol) WriteStructEnd() error { + err := tdp.Delegate.WriteStructEnd() + log.Printf("%sWriteStructEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteFieldBegin(name string, typeId TType, id int16) error { + err := tdp.Delegate.WriteFieldBegin(name, typeId, id) + log.Printf("%sWriteFieldBegin(name=%#v, typeId=%#v, id%#v) => %#v", tdp.LogPrefix, name, typeId, id, err) + return err +} +func (tdp *TDebugProtocol) WriteFieldEnd() error { + err := tdp.Delegate.WriteFieldEnd() + log.Printf("%sWriteFieldEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteFieldStop() error { + err := tdp.Delegate.WriteFieldStop() + log.Printf("%sWriteFieldStop() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error { + err := tdp.Delegate.WriteMapBegin(keyType, valueType, size) + log.Printf("%sWriteMapBegin(keyType=%#v, valueType=%#v, size=%#v) => %#v", tdp.LogPrefix, keyType, valueType, size, err) + return err +} +func (tdp *TDebugProtocol) WriteMapEnd() error { + err := tdp.Delegate.WriteMapEnd() + log.Printf("%sWriteMapEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteListBegin(elemType TType, size int) error { + err := tdp.Delegate.WriteListBegin(elemType, size) + log.Printf("%sWriteListBegin(elemType=%#v, size=%#v) => %#v", tdp.LogPrefix, elemType, size, err) + return err +} +func (tdp *TDebugProtocol) WriteListEnd() error { + err := tdp.Delegate.WriteListEnd() + log.Printf("%sWriteListEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteSetBegin(elemType TType, size int) error { + err := tdp.Delegate.WriteSetBegin(elemType, size) + log.Printf("%sWriteSetBegin(elemType=%#v, size=%#v) => %#v", tdp.LogPrefix, elemType, size, err) + return err +} +func (tdp *TDebugProtocol) WriteSetEnd() error { + err := tdp.Delegate.WriteSetEnd() + log.Printf("%sWriteSetEnd() => %#v", tdp.LogPrefix, err) + return err +} +func (tdp *TDebugProtocol) WriteBool(value bool) error { + err := tdp.Delegate.WriteBool(value) + log.Printf("%sWriteBool(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteByte(value int8) error { + err := tdp.Delegate.WriteByte(value) + log.Printf("%sWriteByte(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteI16(value int16) error { + err := tdp.Delegate.WriteI16(value) + log.Printf("%sWriteI16(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteI32(value int32) error { + err := tdp.Delegate.WriteI32(value) + log.Printf("%sWriteI32(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteI64(value int64) error { + err := tdp.Delegate.WriteI64(value) + log.Printf("%sWriteI64(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteDouble(value float64) error { + err := tdp.Delegate.WriteDouble(value) + log.Printf("%sWriteDouble(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteString(value string) error { + err := tdp.Delegate.WriteString(value) + log.Printf("%sWriteString(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} +func (tdp *TDebugProtocol) WriteBinary(value []byte) error { + err := tdp.Delegate.WriteBinary(value) + log.Printf("%sWriteBinary(value=%#v) => %#v", tdp.LogPrefix, value, err) + return err +} + +func (tdp *TDebugProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqid int32, err error) { + name, typeId, seqid, err = tdp.Delegate.ReadMessageBegin() + log.Printf("%sReadMessageBegin() (name=%#v, typeId=%#v, seqid=%#v, err=%#v)", tdp.LogPrefix, name, typeId, seqid, err) + return +} +func (tdp *TDebugProtocol) ReadMessageEnd() (err error) { + err = tdp.Delegate.ReadMessageEnd() + log.Printf("%sReadMessageEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadStructBegin() (name string, err error) { + name, err = tdp.Delegate.ReadStructBegin() + log.Printf("%sReadStructBegin() (name%#v, err=%#v)", tdp.LogPrefix, name, err) + return +} +func (tdp *TDebugProtocol) ReadStructEnd() (err error) { + err = tdp.Delegate.ReadStructEnd() + log.Printf("%sReadStructEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadFieldBegin() (name string, typeId TType, id int16, err error) { + name, typeId, id, err = tdp.Delegate.ReadFieldBegin() + log.Printf("%sReadFieldBegin() (name=%#v, typeId=%#v, id=%#v, err=%#v)", tdp.LogPrefix, name, typeId, id, err) + return +} +func (tdp *TDebugProtocol) ReadFieldEnd() (err error) { + err = tdp.Delegate.ReadFieldEnd() + log.Printf("%sReadFieldEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, err error) { + keyType, valueType, size, err = tdp.Delegate.ReadMapBegin() + log.Printf("%sReadMapBegin() (keyType=%#v, valueType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, keyType, valueType, size, err) + return +} +func (tdp *TDebugProtocol) ReadMapEnd() (err error) { + err = tdp.Delegate.ReadMapEnd() + log.Printf("%sReadMapEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadListBegin() (elemType TType, size int, err error) { + elemType, size, err = tdp.Delegate.ReadListBegin() + log.Printf("%sReadListBegin() (elemType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, elemType, size, err) + return +} +func (tdp *TDebugProtocol) ReadListEnd() (err error) { + err = tdp.Delegate.ReadListEnd() + log.Printf("%sReadListEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadSetBegin() (elemType TType, size int, err error) { + elemType, size, err = tdp.Delegate.ReadSetBegin() + log.Printf("%sReadSetBegin() (elemType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, elemType, size, err) + return +} +func (tdp *TDebugProtocol) ReadSetEnd() (err error) { + err = tdp.Delegate.ReadSetEnd() + log.Printf("%sReadSetEnd() err=%#v", tdp.LogPrefix, err) + return +} +func (tdp *TDebugProtocol) ReadBool() (value bool, err error) { + value, err = tdp.Delegate.ReadBool() + log.Printf("%sReadBool() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadByte() (value int8, err error) { + value, err = tdp.Delegate.ReadByte() + log.Printf("%sReadByte() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadI16() (value int16, err error) { + value, err = tdp.Delegate.ReadI16() + log.Printf("%sReadI16() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadI32() (value int32, err error) { + value, err = tdp.Delegate.ReadI32() + log.Printf("%sReadI32() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadI64() (value int64, err error) { + value, err = tdp.Delegate.ReadI64() + log.Printf("%sReadI64() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadDouble() (value float64, err error) { + value, err = tdp.Delegate.ReadDouble() + log.Printf("%sReadDouble() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadString() (value string, err error) { + value, err = tdp.Delegate.ReadString() + log.Printf("%sReadString() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) ReadBinary() (value []byte, err error) { + value, err = tdp.Delegate.ReadBinary() + log.Printf("%sReadBinary() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) + return +} +func (tdp *TDebugProtocol) Skip(fieldType TType) (err error) { + err = tdp.Delegate.Skip(fieldType) + log.Printf("%sSkip(fieldType=%#v) (err=%#v)", tdp.LogPrefix, fieldType, err) + return +} +func (tdp *TDebugProtocol) Flush() (err error) { + err = tdp.Delegate.Flush() + log.Printf("%sFlush() (err=%#v)", tdp.LogPrefix, err) + return +} + +func (tdp *TDebugProtocol) Transport() TTransport { + return tdp.Delegate.Transport() +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/deserializer.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/deserializer.go new file mode 100644 index 0000000..91a0983 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/deserializer.go @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +type TDeserializer struct { + Transport TTransport + Protocol TProtocol +} + +func NewTDeserializer() *TDeserializer { + var transport TTransport + transport = NewTMemoryBufferLen(1024) + + protocol := NewTBinaryProtocolFactoryDefault().GetProtocol(transport) + + return &TDeserializer{ + transport, + protocol} +} + +func (t *TDeserializer) ReadString(msg TStruct, s string) (err error) { + err = nil + if _, err = t.Transport.Write([]byte(s)); err != nil { + return + } + if err = msg.Read(t.Protocol); err != nil { + return + } + return +} + +func (t *TDeserializer) Read(msg TStruct, b []byte) (err error) { + err = nil + if _, err = t.Transport.Write(b); err != nil { + return + } + if err = msg.Read(t.Protocol); err != nil { + return + } + return +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/exception.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/exception.go new file mode 100644 index 0000000..ea8d6f6 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/exception.go @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" +) + +// Generic Thrift exception +type TException interface { + error +} + +// Prepends additional information to an error without losing the Thrift exception interface +func PrependError(prepend string, err error) error { + if t, ok := err.(TTransportException); ok { + return NewTTransportException(t.TypeId(), prepend+t.Error()) + } + if t, ok := err.(TProtocolException); ok { + return NewTProtocolExceptionWithType(t.TypeId(), errors.New(prepend+err.Error())) + } + if t, ok := err.(TApplicationException); ok { + return NewTApplicationException(t.TypeId(), prepend+t.Error()) + } + + return errors.New(prepend + err.Error()) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/exception_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/exception_test.go new file mode 100644 index 0000000..71f5e2c --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/exception_test.go @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" + "testing" +) + +func TestPrependError(t *testing.T) { + err := NewTApplicationException(INTERNAL_ERROR, "original error") + err2, ok := PrependError("Prepend: ", err).(TApplicationException) + if !ok { + t.Fatal("Couldn't cast error TApplicationException") + } + if err2.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err2.TypeId() != INTERNAL_ERROR { + t.Fatal("Unexpected type error") + } + + err3 := NewTProtocolExceptionWithType(INVALID_DATA, errors.New("original error")) + err4, ok := PrependError("Prepend: ", err3).(TProtocolException) + if !ok { + t.Fatal("Couldn't cast error TProtocolException") + } + if err4.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err4.TypeId() != INVALID_DATA { + t.Fatal("Unexpected type error") + } + + err5 := NewTTransportException(TIMED_OUT, "original error") + err6, ok := PrependError("Prepend: ", err5).(TTransportException) + if !ok { + t.Fatal("Couldn't cast error TTransportException") + } + if err6.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } + if err6.TypeId() != TIMED_OUT { + t.Fatal("Unexpected type error") + } + + err7 := errors.New("original error") + err8 := PrependError("Prepend: ", err7) + if err8.Error() != "Prepend: original error" { + t.Fatal("Unexpected error string") + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/field.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/field.go new file mode 100644 index 0000000..9d66525 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/field.go @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Helper class that encapsulates field metadata. +type field struct { + name string + typeId TType + id int +} + +func newField(n string, t TType, i int) *field { + return &field{name: n, typeId: t, id: i} +} + +func (p *field) Name() string { + if p == nil { + return "" + } + return p.name +} + +func (p *field) TypeId() TType { + if p == nil { + return TType(VOID) + } + return p.typeId +} + +func (p *field) Id() int { + if p == nil { + return -1 + } + return p.id +} + +func (p *field) String() string { + if p == nil { + return "" + } + return "" +} + +var ANONYMOUS_FIELD *field + +type fieldSlice []field + +func (p fieldSlice) Len() int { + return len(p) +} + +func (p fieldSlice) Less(i, j int) bool { + return p[i].Id() < p[j].Id() +} + +func (p fieldSlice) Swap(i, j int) { + p[i], p[j] = p[j], p[i] +} + +func init() { + ANONYMOUS_FIELD = newField("", STOP, 0) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport.go new file mode 100644 index 0000000..d0bae21 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport.go @@ -0,0 +1,167 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bufio" + "bytes" + "encoding/binary" + "fmt" + "io" +) + +const DEFAULT_MAX_LENGTH = 16384000 + +type TFramedTransport struct { + transport TTransport + buf bytes.Buffer + reader *bufio.Reader + frameSize uint32 //Current remaining size of the frame. if ==0 read next frame header + buffer [4]byte + maxLength uint32 +} + +type tFramedTransportFactory struct { + factory TTransportFactory + maxLength uint32 +} + +func NewTFramedTransportFactory(factory TTransportFactory) TTransportFactory { + return &tFramedTransportFactory{factory: factory, maxLength: DEFAULT_MAX_LENGTH} +} + +func NewTFramedTransportFactoryMaxLength(factory TTransportFactory, maxLength uint32) TTransportFactory { + return &tFramedTransportFactory{factory: factory, maxLength: maxLength} +} + +func (p *tFramedTransportFactory) GetTransport(base TTransport) TTransport { + return NewTFramedTransportMaxLength(p.factory.GetTransport(base), p.maxLength) +} + +func NewTFramedTransport(transport TTransport) *TFramedTransport { + return &TFramedTransport{transport: transport, reader: bufio.NewReader(transport), maxLength: DEFAULT_MAX_LENGTH} +} + +func NewTFramedTransportMaxLength(transport TTransport, maxLength uint32) *TFramedTransport { + return &TFramedTransport{transport: transport, reader: bufio.NewReader(transport), maxLength: maxLength} +} + +func (p *TFramedTransport) Open() error { + return p.transport.Open() +} + +func (p *TFramedTransport) IsOpen() bool { + return p.transport.IsOpen() +} + +func (p *TFramedTransport) Close() error { + return p.transport.Close() +} + +func (p *TFramedTransport) Read(buf []byte) (l int, err error) { + if p.frameSize == 0 { + p.frameSize, err = p.readFrameHeader() + if err != nil { + return + } + } + if p.frameSize < uint32(len(buf)) { + frameSize := p.frameSize + tmp := make([]byte, p.frameSize) + l, err = p.Read(tmp) + copy(buf, tmp) + if err == nil { + err = NewTTransportExceptionFromError(fmt.Errorf("Not enough frame size %d to read %d bytes", frameSize, len(buf))) + return + } + } + got, err := p.reader.Read(buf) + p.frameSize = p.frameSize - uint32(got) + //sanity check + if p.frameSize < 0 { + return 0, NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "Negative frame size") + } + return got, NewTTransportExceptionFromError(err) +} + +func (p *TFramedTransport) ReadByte() (c byte, err error) { + if p.frameSize == 0 { + p.frameSize, err = p.readFrameHeader() + if err != nil { + return + } + } + if p.frameSize < 1 { + return 0, NewTTransportExceptionFromError(fmt.Errorf("Not enough frame size %d to read %d bytes", p.frameSize, 1)) + } + c, err = p.reader.ReadByte() + if err == nil { + p.frameSize-- + } + return +} + +func (p *TFramedTransport) Write(buf []byte) (int, error) { + n, err := p.buf.Write(buf) + return n, NewTTransportExceptionFromError(err) +} + +func (p *TFramedTransport) WriteByte(c byte) error { + return p.buf.WriteByte(c) +} + +func (p *TFramedTransport) WriteString(s string) (n int, err error) { + return p.buf.WriteString(s) +} + +func (p *TFramedTransport) Flush() error { + size := p.buf.Len() + buf := p.buffer[:4] + binary.BigEndian.PutUint32(buf, uint32(size)) + _, err := p.transport.Write(buf) + if err != nil { + return NewTTransportExceptionFromError(err) + } + if size > 0 { + if n, err := p.buf.WriteTo(p.transport); err != nil { + print("Error while flushing write buffer of size ", size, " to transport, only wrote ", n, " bytes: ", err.Error(), "\n") + return NewTTransportExceptionFromError(err) + } + } + err = p.transport.Flush() + return NewTTransportExceptionFromError(err) +} + +func (p *TFramedTransport) readFrameHeader() (uint32, error) { + buf := p.buffer[:4] + if _, err := io.ReadFull(p.reader, buf); err != nil { + return 0, err + } + size := binary.BigEndian.Uint32(buf) + if size < 0 || size > p.maxLength { + return 0, NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, fmt.Sprintf("Incorrect frame size (%d)", size)) + } + return size, nil +} + +func (p *TFramedTransport) RemainingBytes() (num_bytes uint64) { + return uint64(p.frameSize) +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport_test.go new file mode 100644 index 0000000..8f683ef --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/framed_transport_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestFramedTransport(t *testing.T) { + trans := NewTFramedTransport(NewTMemoryBuffer()) + TransportTest(t, trans, trans) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client.go new file mode 100644 index 0000000..88eb2c1 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client.go @@ -0,0 +1,258 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "net/url" + "strconv" +) + +// Default to using the shared http client. Library users are +// free to change this global client or specify one through +// THttpClientOptions. +var DefaultHttpClient *http.Client = http.DefaultClient + +type THttpClient struct { + client *http.Client + response *http.Response + url *url.URL + requestBuffer *bytes.Buffer + header http.Header + nsecConnectTimeout int64 + nsecReadTimeout int64 +} + +type THttpClientTransportFactory struct { + options THttpClientOptions + url string + isPost bool +} + +func (p *THttpClientTransportFactory) GetTransport(trans TTransport) TTransport { + if trans != nil { + t, ok := trans.(*THttpClient) + if ok && t.url != nil { + if t.requestBuffer != nil { + t2, _ := NewTHttpPostClientWithOptions(t.url.String(), p.options) + return t2 + } + t2, _ := NewTHttpClientWithOptions(t.url.String(), p.options) + return t2 + } + } + if p.isPost { + s, _ := NewTHttpPostClientWithOptions(p.url, p.options) + return s + } + s, _ := NewTHttpClientWithOptions(p.url, p.options) + return s +} + +type THttpClientOptions struct { + // If nil, DefaultHttpClient is used + Client *http.Client +} + +func NewTHttpClientTransportFactory(url string) *THttpClientTransportFactory { + return NewTHttpClientTransportFactoryWithOptions(url, THttpClientOptions{}) +} + +func NewTHttpClientTransportFactoryWithOptions(url string, options THttpClientOptions) *THttpClientTransportFactory { + return &THttpClientTransportFactory{url: url, isPost: false, options: options} +} + +func NewTHttpPostClientTransportFactory(url string) *THttpClientTransportFactory { + return NewTHttpPostClientTransportFactoryWithOptions(url, THttpClientOptions{}) +} + +func NewTHttpPostClientTransportFactoryWithOptions(url string, options THttpClientOptions) *THttpClientTransportFactory { + return &THttpClientTransportFactory{url: url, isPost: true, options: options} +} + +func NewTHttpClientWithOptions(urlstr string, options THttpClientOptions) (TTransport, error) { + parsedURL, err := url.Parse(urlstr) + if err != nil { + return nil, err + } + response, err := http.Get(urlstr) + if err != nil { + return nil, err + } + client := options.Client + if client == nil { + client = DefaultHttpClient + } + httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}} + return &THttpClient{client: client, response: response, url: parsedURL, header: httpHeader}, nil +} + +func NewTHttpClient(urlstr string) (TTransport, error) { + return NewTHttpClientWithOptions(urlstr, THttpClientOptions{}) +} + +func NewTHttpPostClientWithOptions(urlstr string, options THttpClientOptions) (TTransport, error) { + parsedURL, err := url.Parse(urlstr) + if err != nil { + return nil, err + } + buf := make([]byte, 0, 1024) + client := options.Client + if client == nil { + client = DefaultHttpClient + } + httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}} + return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: httpHeader}, nil +} + +func NewTHttpPostClient(urlstr string) (TTransport, error) { + return NewTHttpPostClientWithOptions(urlstr, THttpClientOptions{}) +} + +// Set the HTTP Header for this specific Thrift Transport +// It is important that you first assert the TTransport as a THttpClient type +// like so: +// +// httpTrans := trans.(THttpClient) +// httpTrans.SetHeader("User-Agent","Thrift Client 1.0") +func (p *THttpClient) SetHeader(key string, value string) { + p.header.Add(key, value) +} + +// Get the HTTP Header represented by the supplied Header Key for this specific Thrift Transport +// It is important that you first assert the TTransport as a THttpClient type +// like so: +// +// httpTrans := trans.(THttpClient) +// hdrValue := httpTrans.GetHeader("User-Agent") +func (p *THttpClient) GetHeader(key string) string { + return p.header.Get(key) +} + +// Deletes the HTTP Header given a Header Key for this specific Thrift Transport +// It is important that you first assert the TTransport as a THttpClient type +// like so: +// +// httpTrans := trans.(THttpClient) +// httpTrans.DelHeader("User-Agent") +func (p *THttpClient) DelHeader(key string) { + p.header.Del(key) +} + +func (p *THttpClient) Open() error { + // do nothing + return nil +} + +func (p *THttpClient) IsOpen() bool { + return p.response != nil || p.requestBuffer != nil +} + +func (p *THttpClient) closeResponse() error { + var err error + if p.response != nil && p.response.Body != nil { + // The docs specify that if keepalive is enabled and the response body is not + // read to completion the connection will never be returned to the pool and + // reused. Errors are being ignored here because if the connection is invalid + // and this fails for some reason, the Close() method will do any remaining + // cleanup. + io.Copy(ioutil.Discard, p.response.Body) + + err = p.response.Body.Close() + } + + p.response = nil + return err +} + +func (p *THttpClient) Close() error { + if p.requestBuffer != nil { + p.requestBuffer.Reset() + p.requestBuffer = nil + } + return p.closeResponse() +} + +func (p *THttpClient) Read(buf []byte) (int, error) { + if p.response == nil { + return 0, NewTTransportException(NOT_OPEN, "Response buffer is empty, no request.") + } + n, err := p.response.Body.Read(buf) + if n > 0 && (err == nil || err == io.EOF) { + return n, nil + } + return n, NewTTransportExceptionFromError(err) +} + +func (p *THttpClient) ReadByte() (c byte, err error) { + return readByte(p.response.Body) +} + +func (p *THttpClient) Write(buf []byte) (int, error) { + n, err := p.requestBuffer.Write(buf) + return n, err +} + +func (p *THttpClient) WriteByte(c byte) error { + return p.requestBuffer.WriteByte(c) +} + +func (p *THttpClient) WriteString(s string) (n int, err error) { + return p.requestBuffer.WriteString(s) +} + +func (p *THttpClient) Flush() error { + // Close any previous response body to avoid leaking connections. + p.closeResponse() + + req, err := http.NewRequest("POST", p.url.String(), p.requestBuffer) + if err != nil { + return NewTTransportExceptionFromError(err) + } + req.Header = p.header + response, err := p.client.Do(req) + if err != nil { + return NewTTransportExceptionFromError(err) + } + if response.StatusCode != http.StatusOK { + // Close the response to avoid leaking file descriptors. closeResponse does + // more than just call Close(), so temporarily assign it and reuse the logic. + p.response = response + p.closeResponse() + + // TODO(pomack) log bad response + return NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "HTTP Response code: "+strconv.Itoa(response.StatusCode)) + } + p.response = response + return nil +} + +func (p *THttpClient) RemainingBytes() (num_bytes uint64) { + len := p.response.ContentLength + if len >= 0 { + return uint64(len) + } + + const maxSize = ^uint64(0) + return maxSize // the thruth is, we just don't know unless framed is used +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client_test.go new file mode 100644 index 0000000..453680a --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_client_test.go @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "net/http" + "testing" +) + +func TestHttpClient(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportTest(t, trans, trans) +} + +func TestHttpClientHeaders(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) +} + +func TestHttpCustomClient(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + + httpTransport := &customHttpTransport{} + + trans, err := NewTHttpPostClientWithOptions("http://"+addr.String(), THttpClientOptions{ + Client: &http.Client{ + Transport: httpTransport, + }, + }) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) + + if !httpTransport.hit { + t.Fatalf("Custom client was not used") + } +} + +func TestHttpCustomClientPackageScope(t *testing.T) { + l, addr := HttpClientSetupForTest(t) + if l != nil { + defer l.Close() + } + httpTransport := &customHttpTransport{} + DefaultHttpClient = &http.Client{ + Transport: httpTransport, + } + + trans, err := NewTHttpPostClient("http://" + addr.String()) + if err != nil { + l.Close() + t.Fatalf("Unable to connect to %s: %s", addr.String(), err) + } + TransportHeaderTest(t, trans, trans) + + if !httpTransport.hit { + t.Fatalf("Custom client was not used") + } +} + +type customHttpTransport struct { + hit bool +} + +func (c *customHttpTransport) RoundTrip(req *http.Request) (*http.Response, error) { + c.hit = true + return http.DefaultTransport.RoundTrip(req) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/http_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_transport.go new file mode 100644 index 0000000..f6d7458 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/http_transport.go @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import "net/http" + +// NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function +func NewThriftHandlerFunc(processor TProcessor, + inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) { + + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Content-Type", "application/x-thrift") + + transport := NewStreamTransport(r.Body, w) + processor.Process(inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport)) + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport.go new file mode 100644 index 0000000..794872f --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport.go @@ -0,0 +1,214 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bufio" + "io" +) + +// StreamTransport is a Transport made of an io.Reader and/or an io.Writer +type StreamTransport struct { + io.Reader + io.Writer + isReadWriter bool + closed bool +} + +type StreamTransportFactory struct { + Reader io.Reader + Writer io.Writer + isReadWriter bool +} + +func (p *StreamTransportFactory) GetTransport(trans TTransport) TTransport { + if trans != nil { + t, ok := trans.(*StreamTransport) + if ok { + if t.isReadWriter { + return NewStreamTransportRW(t.Reader.(io.ReadWriter)) + } + if t.Reader != nil && t.Writer != nil { + return NewStreamTransport(t.Reader, t.Writer) + } + if t.Reader != nil && t.Writer == nil { + return NewStreamTransportR(t.Reader) + } + if t.Reader == nil && t.Writer != nil { + return NewStreamTransportW(t.Writer) + } + return &StreamTransport{} + } + } + if p.isReadWriter { + return NewStreamTransportRW(p.Reader.(io.ReadWriter)) + } + if p.Reader != nil && p.Writer != nil { + return NewStreamTransport(p.Reader, p.Writer) + } + if p.Reader != nil && p.Writer == nil { + return NewStreamTransportR(p.Reader) + } + if p.Reader == nil && p.Writer != nil { + return NewStreamTransportW(p.Writer) + } + return &StreamTransport{} +} + +func NewStreamTransportFactory(reader io.Reader, writer io.Writer, isReadWriter bool) *StreamTransportFactory { + return &StreamTransportFactory{Reader: reader, Writer: writer, isReadWriter: isReadWriter} +} + +func NewStreamTransport(r io.Reader, w io.Writer) *StreamTransport { + return &StreamTransport{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)} +} + +func NewStreamTransportR(r io.Reader) *StreamTransport { + return &StreamTransport{Reader: bufio.NewReader(r)} +} + +func NewStreamTransportW(w io.Writer) *StreamTransport { + return &StreamTransport{Writer: bufio.NewWriter(w)} +} + +func NewStreamTransportRW(rw io.ReadWriter) *StreamTransport { + bufrw := bufio.NewReadWriter(bufio.NewReader(rw), bufio.NewWriter(rw)) + return &StreamTransport{Reader: bufrw, Writer: bufrw, isReadWriter: true} +} + +func (p *StreamTransport) IsOpen() bool { + return !p.closed +} + +// implicitly opened on creation, can't be reopened once closed +func (p *StreamTransport) Open() error { + if !p.closed { + return NewTTransportException(ALREADY_OPEN, "StreamTransport already open.") + } else { + return NewTTransportException(NOT_OPEN, "cannot reopen StreamTransport.") + } +} + +// Closes both the input and output streams. +func (p *StreamTransport) Close() error { + if p.closed { + return NewTTransportException(NOT_OPEN, "StreamTransport already closed.") + } + p.closed = true + closedReader := false + if p.Reader != nil { + c, ok := p.Reader.(io.Closer) + if ok { + e := c.Close() + closedReader = true + if e != nil { + return e + } + } + p.Reader = nil + } + if p.Writer != nil && (!closedReader || !p.isReadWriter) { + c, ok := p.Writer.(io.Closer) + if ok { + e := c.Close() + if e != nil { + return e + } + } + p.Writer = nil + } + return nil +} + +// Flushes the underlying output stream if not null. +func (p *StreamTransport) Flush() error { + if p.Writer == nil { + return NewTTransportException(NOT_OPEN, "Cannot flush null outputStream") + } + f, ok := p.Writer.(Flusher) + if ok { + err := f.Flush() + if err != nil { + return NewTTransportExceptionFromError(err) + } + } + return nil +} + +func (p *StreamTransport) Read(c []byte) (n int, err error) { + n, err = p.Reader.Read(c) + if err != nil { + err = NewTTransportExceptionFromError(err) + } + return +} + +func (p *StreamTransport) ReadByte() (c byte, err error) { + f, ok := p.Reader.(io.ByteReader) + if ok { + c, err = f.ReadByte() + } else { + c, err = readByte(p.Reader) + } + if err != nil { + err = NewTTransportExceptionFromError(err) + } + return +} + +func (p *StreamTransport) Write(c []byte) (n int, err error) { + n, err = p.Writer.Write(c) + if err != nil { + err = NewTTransportExceptionFromError(err) + } + return +} + +func (p *StreamTransport) WriteByte(c byte) (err error) { + f, ok := p.Writer.(io.ByteWriter) + if ok { + err = f.WriteByte(c) + } else { + err = writeByte(p.Writer, c) + } + if err != nil { + err = NewTTransportExceptionFromError(err) + } + return +} + +func (p *StreamTransport) WriteString(s string) (n int, err error) { + f, ok := p.Writer.(stringWriter) + if ok { + n, err = f.WriteString(s) + } else { + n, err = p.Writer.Write([]byte(s)) + } + if err != nil { + err = NewTTransportExceptionFromError(err) + } + return +} + +func (p *StreamTransport) RemainingBytes() (num_bytes uint64) { + const maxSize = ^uint64(0) + return maxSize // the thruth is, we just don't know unless framed is used +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport_test.go new file mode 100644 index 0000000..15a6116 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/iostream_transport_test.go @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "testing" +) + +func TestStreamTransport(t *testing.T) { + trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024))) + TransportTest(t, trans, trans) +} + +func TestStreamTransportOpenClose(t *testing.T) { + trans := NewStreamTransportRW(bytes.NewBuffer(make([]byte, 0, 1024))) + if !trans.IsOpen() { + t.Fatal("StreamTransport should be already open") + } + if trans.Open() == nil { + t.Fatal("StreamTransport should return error when open twice") + } + if trans.Close() != nil { + t.Fatal("StreamTransport should not return error when closing open transport") + } + if trans.IsOpen() { + t.Fatal("StreamTransport should not be open after close") + } + if trans.Close() == nil { + t.Fatal("StreamTransport should return error when closing a non open transport") + } + if trans.Open() == nil { + t.Fatal("StreamTransport should not be able to reopen") + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol.go new file mode 100644 index 0000000..442fa91 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol.go @@ -0,0 +1,583 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "encoding/base64" + "fmt" +) + +const ( + THRIFT_JSON_PROTOCOL_VERSION = 1 +) + +// for references to _ParseContext see tsimplejson_protocol.go + +// JSON protocol implementation for thrift. +// +// This protocol produces/consumes a simple output format +// suitable for parsing by scripting languages. It should not be +// confused with the full-featured TJSONProtocol. +// +type TJSONProtocol struct { + *TSimpleJSONProtocol +} + +// Constructor +func NewTJSONProtocol(t TTransport) *TJSONProtocol { + v := &TJSONProtocol{TSimpleJSONProtocol: NewTSimpleJSONProtocol(t)} + v.parseContextStack = append(v.parseContextStack, int(_CONTEXT_IN_TOPLEVEL)) + v.dumpContext = append(v.dumpContext, int(_CONTEXT_IN_TOPLEVEL)) + return v +} + +// Factory +type TJSONProtocolFactory struct{} + +func (p *TJSONProtocolFactory) GetProtocol(trans TTransport) TProtocol { + return NewTJSONProtocol(trans) +} + +func NewTJSONProtocolFactory() *TJSONProtocolFactory { + return &TJSONProtocolFactory{} +} + +func (p *TJSONProtocol) WriteMessageBegin(name string, typeId TMessageType, seqId int32) error { + p.resetContextStack() // THRIFT-3735 + if e := p.OutputListBegin(); e != nil { + return e + } + if e := p.WriteI32(THRIFT_JSON_PROTOCOL_VERSION); e != nil { + return e + } + if e := p.WriteString(name); e != nil { + return e + } + if e := p.WriteByte(int8(typeId)); e != nil { + return e + } + if e := p.WriteI32(seqId); e != nil { + return e + } + return nil +} + +func (p *TJSONProtocol) WriteMessageEnd() error { + return p.OutputListEnd() +} + +func (p *TJSONProtocol) WriteStructBegin(name string) error { + if e := p.OutputObjectBegin(); e != nil { + return e + } + return nil +} + +func (p *TJSONProtocol) WriteStructEnd() error { + return p.OutputObjectEnd() +} + +func (p *TJSONProtocol) WriteFieldBegin(name string, typeId TType, id int16) error { + if e := p.WriteI16(id); e != nil { + return e + } + if e := p.OutputObjectBegin(); e != nil { + return e + } + s, e1 := p.TypeIdToString(typeId) + if e1 != nil { + return e1 + } + if e := p.WriteString(s); e != nil { + return e + } + return nil +} + +func (p *TJSONProtocol) WriteFieldEnd() error { + return p.OutputObjectEnd() +} + +func (p *TJSONProtocol) WriteFieldStop() error { return nil } + +func (p *TJSONProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error { + if e := p.OutputListBegin(); e != nil { + return e + } + s, e1 := p.TypeIdToString(keyType) + if e1 != nil { + return e1 + } + if e := p.WriteString(s); e != nil { + return e + } + s, e1 = p.TypeIdToString(valueType) + if e1 != nil { + return e1 + } + if e := p.WriteString(s); e != nil { + return e + } + if e := p.WriteI64(int64(size)); e != nil { + return e + } + return p.OutputObjectBegin() +} + +func (p *TJSONProtocol) WriteMapEnd() error { + if e := p.OutputObjectEnd(); e != nil { + return e + } + return p.OutputListEnd() +} + +func (p *TJSONProtocol) WriteListBegin(elemType TType, size int) error { + return p.OutputElemListBegin(elemType, size) +} + +func (p *TJSONProtocol) WriteListEnd() error { + return p.OutputListEnd() +} + +func (p *TJSONProtocol) WriteSetBegin(elemType TType, size int) error { + return p.OutputElemListBegin(elemType, size) +} + +func (p *TJSONProtocol) WriteSetEnd() error { + return p.OutputListEnd() +} + +func (p *TJSONProtocol) WriteBool(b bool) error { + if b { + return p.WriteI32(1) + } + return p.WriteI32(0) +} + +func (p *TJSONProtocol) WriteByte(b int8) error { + return p.WriteI32(int32(b)) +} + +func (p *TJSONProtocol) WriteI16(v int16) error { + return p.WriteI32(int32(v)) +} + +func (p *TJSONProtocol) WriteI32(v int32) error { + return p.OutputI64(int64(v)) +} + +func (p *TJSONProtocol) WriteI64(v int64) error { + return p.OutputI64(int64(v)) +} + +func (p *TJSONProtocol) WriteDouble(v float64) error { + return p.OutputF64(v) +} + +func (p *TJSONProtocol) WriteString(v string) error { + return p.OutputString(v) +} + +func (p *TJSONProtocol) WriteBinary(v []byte) error { + // JSON library only takes in a string, + // not an arbitrary byte array, to ensure bytes are transmitted + // efficiently we must convert this into a valid JSON string + // therefore we use base64 encoding to avoid excessive escaping/quoting + if e := p.OutputPreValue(); e != nil { + return e + } + if _, e := p.write(JSON_QUOTE_BYTES); e != nil { + return NewTProtocolException(e) + } + writer := base64.NewEncoder(base64.StdEncoding, p.writer) + if _, e := writer.Write(v); e != nil { + p.writer.Reset(p.trans) // THRIFT-3735 + return NewTProtocolException(e) + } + if e := writer.Close(); e != nil { + return NewTProtocolException(e) + } + if _, e := p.write(JSON_QUOTE_BYTES); e != nil { + return NewTProtocolException(e) + } + return p.OutputPostValue() +} + +// Reading methods. +func (p *TJSONProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error) { + p.resetContextStack() // THRIFT-3735 + if isNull, err := p.ParseListBegin(); isNull || err != nil { + return name, typeId, seqId, err + } + version, err := p.ReadI32() + if err != nil { + return name, typeId, seqId, err + } + if version != THRIFT_JSON_PROTOCOL_VERSION { + e := fmt.Errorf("Unknown Protocol version %d, expected version %d", version, THRIFT_JSON_PROTOCOL_VERSION) + return name, typeId, seqId, NewTProtocolExceptionWithType(INVALID_DATA, e) + + } + if name, err = p.ReadString(); err != nil { + return name, typeId, seqId, err + } + bTypeId, err := p.ReadByte() + typeId = TMessageType(bTypeId) + if err != nil { + return name, typeId, seqId, err + } + if seqId, err = p.ReadI32(); err != nil { + return name, typeId, seqId, err + } + return name, typeId, seqId, nil +} + +func (p *TJSONProtocol) ReadMessageEnd() error { + err := p.ParseListEnd() + return err +} + +func (p *TJSONProtocol) ReadStructBegin() (name string, err error) { + _, err = p.ParseObjectStart() + return "", err +} + +func (p *TJSONProtocol) ReadStructEnd() error { + return p.ParseObjectEnd() +} + +func (p *TJSONProtocol) ReadFieldBegin() (string, TType, int16, error) { + b, _ := p.reader.Peek(1) + if len(b) < 1 || b[0] == JSON_RBRACE[0] || b[0] == JSON_RBRACKET[0] { + return "", STOP, -1, nil + } + fieldId, err := p.ReadI16() + if err != nil { + return "", STOP, fieldId, err + } + if _, err = p.ParseObjectStart(); err != nil { + return "", STOP, fieldId, err + } + sType, err := p.ReadString() + if err != nil { + return "", STOP, fieldId, err + } + fType, err := p.StringToTypeId(sType) + return "", fType, fieldId, err +} + +func (p *TJSONProtocol) ReadFieldEnd() error { + return p.ParseObjectEnd() +} + +func (p *TJSONProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, e error) { + if isNull, e := p.ParseListBegin(); isNull || e != nil { + return VOID, VOID, 0, e + } + + // read keyType + sKeyType, e := p.ReadString() + if e != nil { + return keyType, valueType, size, e + } + keyType, e = p.StringToTypeId(sKeyType) + if e != nil { + return keyType, valueType, size, e + } + + // read valueType + sValueType, e := p.ReadString() + if e != nil { + return keyType, valueType, size, e + } + valueType, e = p.StringToTypeId(sValueType) + if e != nil { + return keyType, valueType, size, e + } + + // read size + iSize, e := p.ReadI64() + if e != nil { + return keyType, valueType, size, e + } + size = int(iSize) + + _, e = p.ParseObjectStart() + return keyType, valueType, size, e +} + +func (p *TJSONProtocol) ReadMapEnd() error { + e := p.ParseObjectEnd() + if e != nil { + return e + } + return p.ParseListEnd() +} + +func (p *TJSONProtocol) ReadListBegin() (elemType TType, size int, e error) { + return p.ParseElemListBegin() +} + +func (p *TJSONProtocol) ReadListEnd() error { + return p.ParseListEnd() +} + +func (p *TJSONProtocol) ReadSetBegin() (elemType TType, size int, e error) { + return p.ParseElemListBegin() +} + +func (p *TJSONProtocol) ReadSetEnd() error { + return p.ParseListEnd() +} + +func (p *TJSONProtocol) ReadBool() (bool, error) { + value, err := p.ReadI32() + return (value != 0), err +} + +func (p *TJSONProtocol) ReadByte() (int8, error) { + v, err := p.ReadI64() + return int8(v), err +} + +func (p *TJSONProtocol) ReadI16() (int16, error) { + v, err := p.ReadI64() + return int16(v), err +} + +func (p *TJSONProtocol) ReadI32() (int32, error) { + v, err := p.ReadI64() + return int32(v), err +} + +func (p *TJSONProtocol) ReadI64() (int64, error) { + v, _, err := p.ParseI64() + return v, err +} + +func (p *TJSONProtocol) ReadDouble() (float64, error) { + v, _, err := p.ParseF64() + return v, err +} + +func (p *TJSONProtocol) ReadString() (string, error) { + var v string + if err := p.ParsePreValue(); err != nil { + return v, err + } + f, _ := p.reader.Peek(1) + if len(f) > 0 && f[0] == JSON_QUOTE { + p.reader.ReadByte() + value, err := p.ParseStringBody() + v = value + if err != nil { + return v, err + } + } else if len(f) > 0 && f[0] == JSON_NULL[0] { + b := make([]byte, len(JSON_NULL)) + _, err := p.reader.Read(b) + if err != nil { + return v, NewTProtocolException(err) + } + if string(b) != string(JSON_NULL) { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } else { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return v, p.ParsePostValue() +} + +func (p *TJSONProtocol) ReadBinary() ([]byte, error) { + var v []byte + if err := p.ParsePreValue(); err != nil { + return nil, err + } + f, _ := p.reader.Peek(1) + if len(f) > 0 && f[0] == JSON_QUOTE { + p.reader.ReadByte() + value, err := p.ParseBase64EncodedBody() + v = value + if err != nil { + return v, err + } + } else if len(f) > 0 && f[0] == JSON_NULL[0] { + b := make([]byte, len(JSON_NULL)) + _, err := p.reader.Read(b) + if err != nil { + return v, NewTProtocolException(err) + } + if string(b) != string(JSON_NULL) { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } else { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + + return v, p.ParsePostValue() +} + +func (p *TJSONProtocol) Flush() (err error) { + err = p.writer.Flush() + if err == nil { + err = p.trans.Flush() + } + return NewTProtocolException(err) +} + +func (p *TJSONProtocol) Skip(fieldType TType) (err error) { + return SkipDefaultDepth(p, fieldType) +} + +func (p *TJSONProtocol) Transport() TTransport { + return p.trans +} + +func (p *TJSONProtocol) OutputElemListBegin(elemType TType, size int) error { + if e := p.OutputListBegin(); e != nil { + return e + } + s, e1 := p.TypeIdToString(elemType) + if e1 != nil { + return e1 + } + if e := p.WriteString(s); e != nil { + return e + } + if e := p.WriteI64(int64(size)); e != nil { + return e + } + return nil +} + +func (p *TJSONProtocol) ParseElemListBegin() (elemType TType, size int, e error) { + if isNull, e := p.ParseListBegin(); isNull || e != nil { + return VOID, 0, e + } + sElemType, err := p.ReadString() + if err != nil { + return VOID, size, err + } + elemType, err = p.StringToTypeId(sElemType) + if err != nil { + return elemType, size, err + } + nSize, err2 := p.ReadI64() + size = int(nSize) + return elemType, size, err2 +} + +func (p *TJSONProtocol) readElemListBegin() (elemType TType, size int, e error) { + if isNull, e := p.ParseListBegin(); isNull || e != nil { + return VOID, 0, e + } + sElemType, err := p.ReadString() + if err != nil { + return VOID, size, err + } + elemType, err = p.StringToTypeId(sElemType) + if err != nil { + return elemType, size, err + } + nSize, err2 := p.ReadI64() + size = int(nSize) + return elemType, size, err2 +} + +func (p *TJSONProtocol) writeElemListBegin(elemType TType, size int) error { + if e := p.OutputListBegin(); e != nil { + return e + } + s, e1 := p.TypeIdToString(elemType) + if e1 != nil { + return e1 + } + if e := p.OutputString(s); e != nil { + return e + } + if e := p.OutputI64(int64(size)); e != nil { + return e + } + return nil +} + +func (p *TJSONProtocol) TypeIdToString(fieldType TType) (string, error) { + switch byte(fieldType) { + case BOOL: + return "tf", nil + case BYTE: + return "i8", nil + case I16: + return "i16", nil + case I32: + return "i32", nil + case I64: + return "i64", nil + case DOUBLE: + return "dbl", nil + case STRING: + return "str", nil + case STRUCT: + return "rec", nil + case MAP: + return "map", nil + case SET: + return "set", nil + case LIST: + return "lst", nil + } + + e := fmt.Errorf("Unknown fieldType: %d", int(fieldType)) + return "", NewTProtocolExceptionWithType(INVALID_DATA, e) +} + +func (p *TJSONProtocol) StringToTypeId(fieldType string) (TType, error) { + switch fieldType { + case "tf": + return TType(BOOL), nil + case "i8": + return TType(BYTE), nil + case "i16": + return TType(I16), nil + case "i32": + return TType(I32), nil + case "i64": + return TType(I64), nil + case "dbl": + return TType(DOUBLE), nil + case "str": + return TType(STRING), nil + case "rec": + return TType(STRUCT), nil + case "map": + return TType(MAP), nil + case "set": + return TType(SET), nil + case "lst": + return TType(LIST), nil + } + + e := fmt.Errorf("Unknown type identifier: %s", fieldType) + return TType(STOP), NewTProtocolExceptionWithType(INVALID_DATA, e) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol_test.go new file mode 100644 index 0000000..7104ce3 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/json_protocol_test.go @@ -0,0 +1,649 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "math" + "strconv" + "testing" +) + +func TestWriteJSONProtocolBool(t *testing.T) { + thetype := "boolean" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range BOOL_VALUES { + if e := p.WriteBool(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + expected := "" + if value { + expected = "1" + } else { + expected = "0" + } + if s != expected { + t.Fatalf("Bad value for %s %v: %s expected", thetype, value, s) + } + v := -1 + if err := json.Unmarshal([]byte(s), &v); err != nil || (v != 0) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolBool(t *testing.T) { + thetype := "boolean" + for _, value := range BOOL_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + if value { + trans.Write([]byte{'1'}) // not JSON_TRUE + } else { + trans.Write([]byte{'0'}) // not JSON_FALSE + } + trans.Flush() + s := trans.String() + v, e := p.ReadBool() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + vv := -1 + if err := json.Unmarshal([]byte(s), &vv); err != nil || (vv != 0) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, vv) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolByte(t *testing.T) { + thetype := "byte" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range BYTE_VALUES { + if e := p.WriteByte(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int8(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolByte(t *testing.T) { + thetype := "byte" + for _, value := range BYTE_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadByte() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI16(t *testing.T) { + thetype := "int16" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT16_VALUES { + if e := p.WriteI16(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int16(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI16(t *testing.T) { + thetype := "int16" + for _, value := range INT16_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI16() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI32(t *testing.T) { + thetype := "int32" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT32_VALUES { + if e := p.WriteI32(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int32(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI32(t *testing.T) { + thetype := "int32" + for _, value := range INT32_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolI64(t *testing.T) { + thetype := "int64" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range INT64_VALUES { + if e := p.WriteI64(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolI64(t *testing.T) { + thetype := "int64" + for _, value := range INT64_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(strconv.FormatInt(value, 10)) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolDouble(t *testing.T) { + thetype := "double" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, -1) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN)) + } + } else { + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolDouble(t *testing.T) { + thetype := "double" + for _, value := range DOUBLE_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + n := NewNumericFromDouble(value) + trans.WriteString(n.String()) + trans.Flush() + s := trans.String() + v, e := p.ReadDouble() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if math.IsInf(value, 1) { + if !math.IsInf(v, 1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsInf(value, -1) { + if !math.IsInf(v, -1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsNaN(value) { + if !math.IsNaN(v) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else { + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolString(t *testing.T) { + thetype := "string" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + for _, value := range STRING_VALUES { + if e := p.WriteString(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s[0] != '"' || s[len(s)-1] != '"' { + t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\"")) + } + v := new(string) + if err := json.Unmarshal([]byte(s), v); err != nil || *v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadJSONProtocolString(t *testing.T) { + thetype := "string" + for _, value := range STRING_VALUES { + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(jsonQuote(value)) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + if e := p.WriteBinary(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + expectedString := fmt.Sprint("\"", b64String, "\"") + if s != expectedString { + t.Fatalf("Bad value for %s %v\n wrote: \"%v\"\nexpected: \"%v\"", thetype, value, s, expectedString) + } + v1, err := p.ReadBinary() + if err != nil { + t.Fatalf("Unable to read binary: %s", err.Error()) + } + if len(v1) != len(value) { + t.Fatalf("Invalid value for binary\nexpected: \"%v\"\n read: \"%v\"", value, v1) + } + for k, v := range value { + if v1[k] != v { + t.Fatalf("Invalid value for binary at %v\nexpected: \"%v\"\n read: \"%v\"", k, v, v1[k]) + } + } + trans.Close() +} + +func TestReadJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + trans.WriteString(jsonQuote(b64String)) + trans.Flush() + s := trans.String() + v, e := p.ReadBinary() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if len(v) != len(value) { + t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v)) + } + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i]) + } + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() +} + +func TestWriteJSONProtocolList(t *testing.T) { + thetype := "list" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteListEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("List must be at least of length two to include metadata") + } + if l[0] != "dbl" { + t.Fatal("Invalid type for list, expected: ", STRING, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteJSONProtocolSet(t *testing.T) { + thetype := "set" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteSetEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("Set must be at least of length two to include metadata") + } + if l[0] != "dbl" { + t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteJSONProtocolMap(t *testing.T) { + thetype := "map" + trans := NewTMemoryBuffer() + p := NewTJSONProtocol(trans) + p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES)) + for k, value := range DOUBLE_VALUES { + if e := p.WriteI32(int32(k)); e != nil { + t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error()) + } + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteMapEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + if str[0] != '[' || str[len(str)-1] != ']' { + t.Fatalf("Bad value for %s, wrote: %q, in go: %q", thetype, str, DOUBLE_VALUES) + } + expectedKeyType, expectedValueType, expectedSize, err := p.ReadMapBegin() + if err != nil { + t.Fatalf("Error while reading map begin: %s", err.Error()) + } + if expectedKeyType != I32 { + t.Fatal("Expected map key type ", I32, ", but was ", expectedKeyType) + } + if expectedValueType != DOUBLE { + t.Fatal("Expected map value type ", DOUBLE, ", but was ", expectedValueType) + } + if expectedSize != len(DOUBLE_VALUES) { + t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", expectedSize) + } + for k, value := range DOUBLE_VALUES { + ik, err := p.ReadI32() + if err != nil { + t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, ik, string(k), err.Error()) + } + if int(ik) != k { + t.Fatalf("Bad key for %s index %v, wrote: %v, expected: %v", thetype, k, ik, k) + } + dv, err := p.ReadDouble() + if err != nil { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, dv, value, err.Error()) + } + s := strconv.FormatFloat(dv, 'g', 10, 64) + if math.IsInf(value, 1) { + if !math.IsInf(dv, 1) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, 0) { + if !math.IsInf(dv, 0) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if !math.IsNaN(dv) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN)) + } + } else { + expected := strconv.FormatFloat(value, 'g', 10, 64) + if s != expected { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + } + err = p.ReadMapEnd() + if err != nil { + t.Fatalf("Error while reading map end: %s", err.Error()) + } + trans.Close() +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/lowlevel_benchmarks_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/lowlevel_benchmarks_test.go new file mode 100644 index 0000000..a5094ae --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/lowlevel_benchmarks_test.go @@ -0,0 +1,396 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "testing" +) + +var binaryProtoF = NewTBinaryProtocolFactoryDefault() +var compactProtoF = NewTCompactProtocolFactory() + +var buf = bytes.NewBuffer(make([]byte, 0, 1024)) + +var tfv = []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), +} + +func BenchmarkBinaryBool_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkBinaryBool_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkBinaryBool_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkBinaryByte_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkBinaryI16_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkBinaryI32_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkBinaryI64_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkBinaryDouble_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkBinaryString_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkBinaryBinary_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := binaryProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary0(b *testing.B) { + trans := tfv[0].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary1(b *testing.B) { + trans := tfv[1].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} + +func BenchmarkCompactBool_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBool(b, p, trans) + } +} + +func BenchmarkCompactByte_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteByte(b, p, trans) + } +} + +func BenchmarkCompactI16_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI16(b, p, trans) + } +} + +func BenchmarkCompactI32_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI32(b, p, trans) + } +} +func BenchmarkCompactI64_2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteI64(b, p, trans) + } +} +func BenchmarkCompactDouble2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteDouble(b, p, trans) + } +} +func BenchmarkCompactString2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteString(b, p, trans) + } +} +func BenchmarkCompactBinary2(b *testing.B) { + trans := tfv[2].GetTransport(nil) + p := compactProtoF.GetProtocol(trans) + for i := 0; i < b.N; i++ { + ReadWriteBinary(b, p, trans) + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer.go new file mode 100644 index 0000000..b62fd56 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer.go @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" +) + +// Memory buffer-based implementation of the TTransport interface. +type TMemoryBuffer struct { + *bytes.Buffer + size int +} + +type TMemoryBufferTransportFactory struct { + size int +} + +func (p *TMemoryBufferTransportFactory) GetTransport(trans TTransport) TTransport { + if trans != nil { + t, ok := trans.(*TMemoryBuffer) + if ok && t.size > 0 { + return NewTMemoryBufferLen(t.size) + } + } + return NewTMemoryBufferLen(p.size) +} + +func NewTMemoryBufferTransportFactory(size int) *TMemoryBufferTransportFactory { + return &TMemoryBufferTransportFactory{size: size} +} + +func NewTMemoryBuffer() *TMemoryBuffer { + return &TMemoryBuffer{Buffer: &bytes.Buffer{}, size: 0} +} + +func NewTMemoryBufferLen(size int) *TMemoryBuffer { + buf := make([]byte, 0, size) + return &TMemoryBuffer{Buffer: bytes.NewBuffer(buf), size: size} +} + +func (p *TMemoryBuffer) IsOpen() bool { + return true +} + +func (p *TMemoryBuffer) Open() error { + return nil +} + +func (p *TMemoryBuffer) Close() error { + p.Buffer.Reset() + return nil +} + +// Flushing a memory buffer is a no-op +func (p *TMemoryBuffer) Flush() error { + return nil +} + +func (p *TMemoryBuffer) RemainingBytes() (num_bytes uint64) { + return uint64(p.Buffer.Len()) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer_test.go new file mode 100644 index 0000000..af2e8bf --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/memory_buffer_test.go @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestMemoryBuffer(t *testing.T) { + trans := NewTMemoryBufferLen(1024) + TransportTest(t, trans, trans) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/messagetype.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/messagetype.go new file mode 100644 index 0000000..25ab2e9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/messagetype.go @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Message type constants in the Thrift protocol. +type TMessageType int32 + +const ( + INVALID_TMESSAGE_TYPE TMessageType = 0 + CALL TMessageType = 1 + REPLY TMessageType = 2 + EXCEPTION TMessageType = 3 + ONEWAY TMessageType = 4 +) diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/multiplexed_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/multiplexed_protocol.go new file mode 100644 index 0000000..3157e0d --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/multiplexed_protocol.go @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "fmt" + "strings" +) + +/* +TMultiplexedProtocol is a protocol-independent concrete decorator +that allows a Thrift client to communicate with a multiplexing Thrift server, +by prepending the service name to the function name during function calls. + +NOTE: THIS IS NOT USED BY SERVERS. On the server, use TMultiplexedProcessor to handle request +from a multiplexing client. + +This example uses a single socket transport to invoke two services: + +socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT) +transport := thrift.NewTFramedTransport(socket) +protocol := thrift.NewTBinaryProtocolTransport(transport) + +mp := thrift.NewTMultiplexedProtocol(protocol, "Calculator") +service := Calculator.NewCalculatorClient(mp) + +mp2 := thrift.NewTMultiplexedProtocol(protocol, "WeatherReport") +service2 := WeatherReport.NewWeatherReportClient(mp2) + +err := transport.Open() +if err != nil { + t.Fatal("Unable to open client socket", err) +} + +fmt.Println(service.Add(2,2)) +fmt.Println(service2.GetTemperature()) +*/ + +type TMultiplexedProtocol struct { + TProtocol + serviceName string +} + +const MULTIPLEXED_SEPARATOR = ":" + +func NewTMultiplexedProtocol(protocol TProtocol, serviceName string) *TMultiplexedProtocol { + return &TMultiplexedProtocol{ + TProtocol: protocol, + serviceName: serviceName, + } +} + +func (t *TMultiplexedProtocol) WriteMessageBegin(name string, typeId TMessageType, seqid int32) error { + if typeId == CALL || typeId == ONEWAY { + return t.TProtocol.WriteMessageBegin(t.serviceName+MULTIPLEXED_SEPARATOR+name, typeId, seqid) + } else { + return t.TProtocol.WriteMessageBegin(name, typeId, seqid) + } +} + +/* +TMultiplexedProcessor is a TProcessor allowing +a single TServer to provide multiple services. + +To do so, you instantiate the processor and then register additional +processors with it, as shown in the following example: + +var processor = thrift.NewTMultiplexedProcessor() + +firstProcessor := +processor.RegisterProcessor("FirstService", firstProcessor) + +processor.registerProcessor( + "Calculator", + Calculator.NewCalculatorProcessor(&CalculatorHandler{}), +) + +processor.registerProcessor( + "WeatherReport", + WeatherReport.NewWeatherReportProcessor(&WeatherReportHandler{}), +) + +serverTransport, err := thrift.NewTServerSocketTimeout(addr, TIMEOUT) +if err != nil { + t.Fatal("Unable to create server socket", err) +} +server := thrift.NewTSimpleServer2(processor, serverTransport) +server.Serve(); +*/ + +type TMultiplexedProcessor struct { + serviceProcessorMap map[string]TProcessor + DefaultProcessor TProcessor +} + +func NewTMultiplexedProcessor() *TMultiplexedProcessor { + return &TMultiplexedProcessor{ + serviceProcessorMap: make(map[string]TProcessor), + } +} + +func (t *TMultiplexedProcessor) RegisterDefault(processor TProcessor) { + t.DefaultProcessor = processor +} + +func (t *TMultiplexedProcessor) RegisterProcessor(name string, processor TProcessor) { + if t.serviceProcessorMap == nil { + t.serviceProcessorMap = make(map[string]TProcessor) + } + t.serviceProcessorMap[name] = processor +} + +func (t *TMultiplexedProcessor) Process(in, out TProtocol) (bool, TException) { + name, typeId, seqid, err := in.ReadMessageBegin() + if err != nil { + return false, err + } + if typeId != CALL && typeId != ONEWAY { + return false, fmt.Errorf("Unexpected message type %v", typeId) + } + //extract the service name + v := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2) + if len(v) != 2 { + if t.DefaultProcessor != nil { + smb := NewStoredMessageProtocol(in, name, typeId, seqid) + return t.DefaultProcessor.Process(smb, out) + } + return false, fmt.Errorf("Service name not found in message name: %s. Did you forget to use a TMultiplexProtocol in your client?", name) + } + actualProcessor, ok := t.serviceProcessorMap[v[0]] + if !ok { + return false, fmt.Errorf("Service name not found: %s. Did you forget to call registerProcessor()?", v[0]) + } + smb := NewStoredMessageProtocol(in, v[1], typeId, seqid) + return actualProcessor.Process(smb, out) +} + +//Protocol that use stored message for ReadMessageBegin +type storedMessageProtocol struct { + TProtocol + name string + typeId TMessageType + seqid int32 +} + +func NewStoredMessageProtocol(protocol TProtocol, name string, typeId TMessageType, seqid int32) *storedMessageProtocol { + return &storedMessageProtocol{protocol, name, typeId, seqid} +} + +func (s *storedMessageProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqid int32, err error) { + return s.name, s.typeId, s.seqid, nil +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/numeric.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/numeric.go new file mode 100644 index 0000000..aa8daa9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/numeric.go @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "math" + "strconv" +) + +type Numeric interface { + Int64() int64 + Int32() int32 + Int16() int16 + Byte() byte + Int() int + Float64() float64 + Float32() float32 + String() string + isNull() bool +} + +type numeric struct { + iValue int64 + dValue float64 + sValue string + isNil bool +} + +var ( + INFINITY Numeric + NEGATIVE_INFINITY Numeric + NAN Numeric + ZERO Numeric + NUMERIC_NULL Numeric +) + +func NewNumericFromDouble(dValue float64) Numeric { + if math.IsInf(dValue, 1) { + return INFINITY + } + if math.IsInf(dValue, -1) { + return NEGATIVE_INFINITY + } + if math.IsNaN(dValue) { + return NAN + } + iValue := int64(dValue) + sValue := strconv.FormatFloat(dValue, 'g', 10, 64) + isNil := false + return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} +} + +func NewNumericFromI64(iValue int64) Numeric { + dValue := float64(iValue) + sValue := string(iValue) + isNil := false + return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} +} + +func NewNumericFromI32(iValue int32) Numeric { + dValue := float64(iValue) + sValue := string(iValue) + isNil := false + return &numeric{iValue: int64(iValue), dValue: dValue, sValue: sValue, isNil: isNil} +} + +func NewNumericFromString(sValue string) Numeric { + if sValue == INFINITY.String() { + return INFINITY + } + if sValue == NEGATIVE_INFINITY.String() { + return NEGATIVE_INFINITY + } + if sValue == NAN.String() { + return NAN + } + iValue, _ := strconv.ParseInt(sValue, 10, 64) + dValue, _ := strconv.ParseFloat(sValue, 64) + isNil := len(sValue) == 0 + return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} +} + +func NewNumericFromJSONString(sValue string, isNull bool) Numeric { + if isNull { + return NewNullNumeric() + } + if sValue == JSON_INFINITY { + return INFINITY + } + if sValue == JSON_NEGATIVE_INFINITY { + return NEGATIVE_INFINITY + } + if sValue == JSON_NAN { + return NAN + } + iValue, _ := strconv.ParseInt(sValue, 10, 64) + dValue, _ := strconv.ParseFloat(sValue, 64) + return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNull} +} + +func NewNullNumeric() Numeric { + return &numeric{iValue: 0, dValue: 0.0, sValue: "", isNil: true} +} + +func (p *numeric) Int64() int64 { + return p.iValue +} + +func (p *numeric) Int32() int32 { + return int32(p.iValue) +} + +func (p *numeric) Int16() int16 { + return int16(p.iValue) +} + +func (p *numeric) Byte() byte { + return byte(p.iValue) +} + +func (p *numeric) Int() int { + return int(p.iValue) +} + +func (p *numeric) Float64() float64 { + return p.dValue +} + +func (p *numeric) Float32() float32 { + return float32(p.dValue) +} + +func (p *numeric) String() string { + return p.sValue +} + +func (p *numeric) isNull() bool { + return p.isNil +} + +func init() { + INFINITY = &numeric{iValue: 0, dValue: math.Inf(1), sValue: "Infinity", isNil: false} + NEGATIVE_INFINITY = &numeric{iValue: 0, dValue: math.Inf(-1), sValue: "-Infinity", isNil: false} + NAN = &numeric{iValue: 0, dValue: math.NaN(), sValue: "NaN", isNil: false} + ZERO = &numeric{iValue: 0, dValue: 0, sValue: "0", isNil: false} + NUMERIC_NULL = &numeric{iValue: 0, dValue: 0, sValue: "0", isNil: true} +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/pointerize.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/pointerize.go new file mode 100644 index 0000000..8d6b2c2 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/pointerize.go @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +/////////////////////////////////////////////////////////////////////////////// +// This file is home to helpers that convert from various base types to +// respective pointer types. This is necessary because Go does not permit +// references to constants, nor can a pointer type to base type be allocated +// and initialized in a single expression. +// +// E.g., this is not allowed: +// +// var ip *int = &5 +// +// But this *is* allowed: +// +// func IntPtr(i int) *int { return &i } +// var ip *int = IntPtr(5) +// +// Since pointers to base types are commonplace as [optional] fields in +// exported thrift structs, we factor such helpers here. +/////////////////////////////////////////////////////////////////////////////// + +func Float32Ptr(v float32) *float32 { return &v } +func Float64Ptr(v float64) *float64 { return &v } +func IntPtr(v int) *int { return &v } +func Int32Ptr(v int32) *int32 { return &v } +func Int64Ptr(v int64) *int64 { return &v } +func StringPtr(v string) *string { return &v } +func Uint32Ptr(v uint32) *uint32 { return &v } +func Uint64Ptr(v uint64) *uint64 { return &v } +func BoolPtr(v bool) *bool { return &v } +func ByteSlicePtr(v []byte) *[]byte { return &v } diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/processor.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/processor.go new file mode 100644 index 0000000..ca0d3fa --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/processor.go @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// A processor is a generic object which operates upon an input stream and +// writes to some output stream. +type TProcessor interface { + Process(in, out TProtocol) (bool, TException) +} + +type TProcessorFunction interface { + Process(seqId int32, in, out TProtocol) (bool, TException) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/processor_factory.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/processor_factory.go new file mode 100644 index 0000000..9d645df --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/processor_factory.go @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// The default processor factory just returns a singleton +// instance. +type TProcessorFactory interface { + GetProcessor(trans TTransport) TProcessor +} + +type tProcessorFactory struct { + processor TProcessor +} + +func NewTProcessorFactory(p TProcessor) TProcessorFactory { + return &tProcessorFactory{processor: p} +} + +func (p *tProcessorFactory) GetProcessor(trans TTransport) TProcessor { + return p.processor +} + +/** + * The default processor factory just returns a singleton + * instance. + */ +type TProcessorFunctionFactory interface { + GetProcessorFunction(trans TTransport) TProcessorFunction +} + +type tProcessorFunctionFactory struct { + processor TProcessorFunction +} + +func NewTProcessorFunctionFactory(p TProcessorFunction) TProcessorFunctionFactory { + return &tProcessorFunctionFactory{processor: p} +} + +func (p *tProcessorFunctionFactory) GetProcessorFunction(trans TTransport) TProcessorFunction { + return p.processor +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol.go new file mode 100644 index 0000000..45fa202 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol.go @@ -0,0 +1,175 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" +) + +const ( + VERSION_MASK = 0xffff0000 + VERSION_1 = 0x80010000 +) + +type TProtocol interface { + WriteMessageBegin(name string, typeId TMessageType, seqid int32) error + WriteMessageEnd() error + WriteStructBegin(name string) error + WriteStructEnd() error + WriteFieldBegin(name string, typeId TType, id int16) error + WriteFieldEnd() error + WriteFieldStop() error + WriteMapBegin(keyType TType, valueType TType, size int) error + WriteMapEnd() error + WriteListBegin(elemType TType, size int) error + WriteListEnd() error + WriteSetBegin(elemType TType, size int) error + WriteSetEnd() error + WriteBool(value bool) error + WriteByte(value int8) error + WriteI16(value int16) error + WriteI32(value int32) error + WriteI64(value int64) error + WriteDouble(value float64) error + WriteString(value string) error + WriteBinary(value []byte) error + + ReadMessageBegin() (name string, typeId TMessageType, seqid int32, err error) + ReadMessageEnd() error + ReadStructBegin() (name string, err error) + ReadStructEnd() error + ReadFieldBegin() (name string, typeId TType, id int16, err error) + ReadFieldEnd() error + ReadMapBegin() (keyType TType, valueType TType, size int, err error) + ReadMapEnd() error + ReadListBegin() (elemType TType, size int, err error) + ReadListEnd() error + ReadSetBegin() (elemType TType, size int, err error) + ReadSetEnd() error + ReadBool() (value bool, err error) + ReadByte() (value int8, err error) + ReadI16() (value int16, err error) + ReadI32() (value int32, err error) + ReadI64() (value int64, err error) + ReadDouble() (value float64, err error) + ReadString() (value string, err error) + ReadBinary() (value []byte, err error) + + Skip(fieldType TType) (err error) + Flush() (err error) + + Transport() TTransport +} + +// The maximum recursive depth the skip() function will traverse +const DEFAULT_RECURSION_DEPTH = 64 + +// Skips over the next data element from the provided input TProtocol object. +func SkipDefaultDepth(prot TProtocol, typeId TType) (err error) { + return Skip(prot, typeId, DEFAULT_RECURSION_DEPTH) +} + +// Skips over the next data element from the provided input TProtocol object. +func Skip(self TProtocol, fieldType TType, maxDepth int) (err error) { + + if maxDepth <= 0 { + return NewTProtocolExceptionWithType( DEPTH_LIMIT, errors.New("Depth limit exceeded")) + } + + switch fieldType { + case STOP: + return + case BOOL: + _, err = self.ReadBool() + return + case BYTE: + _, err = self.ReadByte() + return + case I16: + _, err = self.ReadI16() + return + case I32: + _, err = self.ReadI32() + return + case I64: + _, err = self.ReadI64() + return + case DOUBLE: + _, err = self.ReadDouble() + return + case STRING: + _, err = self.ReadString() + return + case STRUCT: + if _, err = self.ReadStructBegin(); err != nil { + return err + } + for { + _, typeId, _, _ := self.ReadFieldBegin() + if typeId == STOP { + break + } + err := Skip(self, typeId, maxDepth-1) + if err != nil { + return err + } + self.ReadFieldEnd() + } + return self.ReadStructEnd() + case MAP: + keyType, valueType, size, err := self.ReadMapBegin() + if err != nil { + return err + } + for i := 0; i < size; i++ { + err := Skip(self, keyType, maxDepth-1) + if err != nil { + return err + } + self.Skip(valueType) + } + return self.ReadMapEnd() + case SET: + elemType, size, err := self.ReadSetBegin() + if err != nil { + return err + } + for i := 0; i < size; i++ { + err := Skip(self, elemType, maxDepth-1) + if err != nil { + return err + } + } + return self.ReadSetEnd() + case LIST: + elemType, size, err := self.ReadListBegin() + if err != nil { + return err + } + for i := 0; i < size; i++ { + err := Skip(self, elemType, maxDepth-1) + if err != nil { + return err + } + } + return self.ReadListEnd() + } + return nil +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_exception.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_exception.go new file mode 100644 index 0000000..6e357ee --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_exception.go @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "encoding/base64" +) + +// Thrift Protocol exception +type TProtocolException interface { + TException + TypeId() int +} + +const ( + UNKNOWN_PROTOCOL_EXCEPTION = 0 + INVALID_DATA = 1 + NEGATIVE_SIZE = 2 + SIZE_LIMIT = 3 + BAD_VERSION = 4 + NOT_IMPLEMENTED = 5 + DEPTH_LIMIT = 6 +) + +type tProtocolException struct { + typeId int + message string +} + +func (p *tProtocolException) TypeId() int { + return p.typeId +} + +func (p *tProtocolException) String() string { + return p.message +} + +func (p *tProtocolException) Error() string { + return p.message +} + +func NewTProtocolException(err error) TProtocolException { + if err == nil { + return nil + } + if e,ok := err.(TProtocolException); ok { + return e + } + if _, ok := err.(base64.CorruptInputError); ok { + return &tProtocolException{INVALID_DATA, err.Error()} + } + return &tProtocolException{UNKNOWN_PROTOCOL_EXCEPTION, err.Error()} +} + +func NewTProtocolExceptionWithType(errType int, err error) TProtocolException { + if err == nil { + return nil + } + return &tProtocolException{errType, err.Error()} +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_factory.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_factory.go new file mode 100644 index 0000000..c40f796 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_factory.go @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Factory interface for constructing protocol instances. +type TProtocolFactory interface { + GetProtocol(trans TTransport) TProtocol +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_test.go new file mode 100644 index 0000000..613eae6 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/protocol_test.go @@ -0,0 +1,479 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "io/ioutil" + "math" + "net" + "net/http" + "testing" +) + +const PROTOCOL_BINARY_DATA_SIZE = 155 + +var ( + data string // test data for writing + protocol_bdata []byte // test data for writing; same as data + BOOL_VALUES []bool + BYTE_VALUES []int8 + INT16_VALUES []int16 + INT32_VALUES []int32 + INT64_VALUES []int64 + DOUBLE_VALUES []float64 + STRING_VALUES []string +) + +func init() { + protocol_bdata = make([]byte, PROTOCOL_BINARY_DATA_SIZE) + for i := 0; i < PROTOCOL_BINARY_DATA_SIZE; i++ { + protocol_bdata[i] = byte((i + 'a') % 255) + } + data = string(protocol_bdata) + BOOL_VALUES = []bool{false, true, false, false, true} + BYTE_VALUES = []int8{117, 0, 1, 32, 127, -128, -1} + INT16_VALUES = []int16{459, 0, 1, -1, -128, 127, 32767, -32768} + INT32_VALUES = []int32{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535} + INT64_VALUES = []int64{459, 0, 1, -1, -128, 127, 32767, 2147483647, -2147483535, 34359738481, -35184372088719, -9223372036854775808, 9223372036854775807} + DOUBLE_VALUES = []float64{459.3, 0.0, -1.0, 1.0, 0.5, 0.3333, 3.14159, 1.537e-38, 1.673e25, 6.02214179e23, -6.02214179e23, INFINITY.Float64(), NEGATIVE_INFINITY.Float64(), NAN.Float64()} + STRING_VALUES = []string{"", "a", "st[uf]f", "st,u:ff with spaces", "stuff\twith\nescape\\characters'...\"lots{of}fun"} +} + +type HTTPEchoServer struct{} +type HTTPHeaderEchoServer struct{} + +func (p *HTTPEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + w.Write(buf) + } else { + w.WriteHeader(http.StatusOK) + w.Write(buf) + } +} + +func (p *HTTPHeaderEchoServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + w.Write(buf) + } else { + w.WriteHeader(http.StatusOK) + w.Write(buf) + } +} + +func HttpClientSetupForTest(t *testing.T) (net.Listener, net.Addr) { + addr, err := FindAvailableTCPServerPort(40000) + if err != nil { + t.Fatalf("Unable to find available tcp port addr: %s", err) + return nil, addr + } + l, err := net.Listen(addr.Network(), addr.String()) + if err != nil { + t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err) + return l, addr + } + go http.Serve(l, &HTTPEchoServer{}) + return l, addr +} + +func HttpClientSetupForHeaderTest(t *testing.T) (net.Listener, net.Addr) { + addr, err := FindAvailableTCPServerPort(40000) + if err != nil { + t.Fatalf("Unable to find available tcp port addr: %s", err) + return nil, addr + } + l, err := net.Listen(addr.Network(), addr.String()) + if err != nil { + t.Fatalf("Unable to setup tcp listener on %s: %s", addr.String(), err) + return l, addr + } + go http.Serve(l, &HTTPHeaderEchoServer{}) + return l, addr +} + +func ReadWriteProtocolTest(t *testing.T, protocolFactory TProtocolFactory) { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + l, addr := HttpClientSetupForTest(t) + defer l.Close() + transports := []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), + NewTHttpPostClientTransportFactory("http://" + addr.String()), + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteBool(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteByte(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI16(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI32(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI64(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteDouble(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteString(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteBinary(t, p, trans) + trans.Close() + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + p := protocolFactory.GetProtocol(trans) + ReadWriteI64(t, p, trans) + ReadWriteDouble(t, p, trans) + ReadWriteBinary(t, p, trans) + ReadWriteByte(t, p, trans) + trans.Close() + } +} + +func ReadWriteBool(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(BOOL) + thelen := len(BOOL_VALUES) + err := p.WriteListBegin(thetype, thelen) + if err != nil { + t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteBool", p, trans, err, thetype) + } + for k, v := range BOOL_VALUES { + err = p.WriteBool(v) + if err != nil { + t.Errorf("%s: %T %T %q Error writing bool in list at index %d: %q", "ReadWriteBool", p, trans, err, k, v) + } + } + p.WriteListEnd() + if err != nil { + t.Errorf("%s: %T %T %q Error writing list end: %q", "ReadWriteBool", p, trans, err, BOOL_VALUES) + } + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteBool", p, trans, err, BOOL_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteBool", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteBool", p, trans, thelen, thelen2) + } + } + for k, v := range BOOL_VALUES { + value, err := p.ReadBool() + if err != nil { + t.Errorf("%s: %T %T %q Error reading bool at index %d: %q", "ReadWriteBool", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: index %d %q %q %q != %q", "ReadWriteBool", k, p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteBool", p, trans, err) + } +} + +func ReadWriteByte(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(BYTE) + thelen := len(BYTE_VALUES) + err := p.WriteListBegin(thetype, thelen) + if err != nil { + t.Errorf("%s: %T %T %q Error writing list begin: %q", "ReadWriteByte", p, trans, err, thetype) + } + for k, v := range BYTE_VALUES { + err = p.WriteByte(v) + if err != nil { + t.Errorf("%s: %T %T %q Error writing byte in list at index %d: %q", "ReadWriteByte", p, trans, err, k, v) + } + } + err = p.WriteListEnd() + if err != nil { + t.Errorf("%s: %T %T %q Error writing list end: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + err = p.Flush() + if err != nil { + t.Errorf("%s: %T %T %q Error flushing list of bytes: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteByte", p, trans, err, BYTE_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteByte", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteByte", p, trans, thelen, thelen2) + } + } + for k, v := range BYTE_VALUES { + value, err := p.ReadByte() + if err != nil { + t.Errorf("%s: %T %T %q Error reading byte at index %d: %q", "ReadWriteByte", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteByte", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteByte", p, trans, err) + } +} + +func ReadWriteI16(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I16) + thelen := len(INT16_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT16_VALUES { + p.WriteI16(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI16", p, trans, err, INT16_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI16", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI16", p, trans, thelen, thelen2) + } + } + for k, v := range INT16_VALUES { + value, err := p.ReadI16() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int16 at index %d: %q", "ReadWriteI16", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteI16", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI16", p, trans, err) + } +} + +func ReadWriteI32(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I32) + thelen := len(INT32_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT32_VALUES { + p.WriteI32(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI32", p, trans, err, INT32_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI32", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI32", p, trans, thelen, thelen2) + } + } + for k, v := range INT32_VALUES { + value, err := p.ReadI32() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int32 at index %d: %q", "ReadWriteI32", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteI32", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI32", p, trans, err) + } +} + +func ReadWriteI64(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(I64) + thelen := len(INT64_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range INT64_VALUES { + p.WriteI64(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteI64", p, trans, err, INT64_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteI64", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteI64", p, trans, thelen, thelen2) + } + } + for k, v := range INT64_VALUES { + value, err := p.ReadI64() + if err != nil { + t.Errorf("%s: %T %T %q Error reading int64 at index %d: %q", "ReadWriteI64", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %q != %q", "ReadWriteI64", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteI64", p, trans, err) + } +} + +func ReadWriteDouble(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(DOUBLE) + thelen := len(DOUBLE_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range DOUBLE_VALUES { + p.WriteDouble(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteDouble", p, trans, err, DOUBLE_VALUES) + } + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteDouble", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteDouble", p, trans, thelen, thelen2) + } + for k, v := range DOUBLE_VALUES { + value, err := p.ReadDouble() + if err != nil { + t.Errorf("%s: %T %T %q Error reading double at index %d: %q", "ReadWriteDouble", p, trans, err, k, v) + } + if math.IsNaN(v) { + if !math.IsNaN(value) { + t.Errorf("%s: %T %T math.IsNaN(%q) != math.IsNaN(%q)", "ReadWriteDouble", p, trans, v, value) + } + } else if v != value { + t.Errorf("%s: %T %T %v != %q", "ReadWriteDouble", p, trans, v, value) + } + } + err = p.ReadListEnd() + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteDouble", p, trans, err) + } +} + +func ReadWriteString(t testing.TB, p TProtocol, trans TTransport) { + thetype := TType(STRING) + thelen := len(STRING_VALUES) + p.WriteListBegin(thetype, thelen) + for _, v := range STRING_VALUES { + p.WriteString(v) + } + p.WriteListEnd() + p.Flush() + thetype2, thelen2, err := p.ReadListBegin() + if err != nil { + t.Errorf("%s: %T %T %q Error reading list: %q", "ReadWriteString", p, trans, err, STRING_VALUES) + } + _, ok := p.(*TSimpleJSONProtocol) + if !ok { + if thetype != thetype2 { + t.Errorf("%s: %T %T type %s != type %s", "ReadWriteString", p, trans, thetype, thetype2) + } + if thelen != thelen2 { + t.Errorf("%s: %T %T len %s != len %s", "ReadWriteString", p, trans, thelen, thelen2) + } + } + for k, v := range STRING_VALUES { + value, err := p.ReadString() + if err != nil { + t.Errorf("%s: %T %T %q Error reading string at index %d: %q", "ReadWriteString", p, trans, err, k, v) + } + if v != value { + t.Errorf("%s: %T %T %d != %d", "ReadWriteString", p, trans, v, value) + } + } + if err != nil { + t.Errorf("%s: %T %T Unable to read list end: %q", "ReadWriteString", p, trans, err) + } +} + +func ReadWriteBinary(t testing.TB, p TProtocol, trans TTransport) { + v := protocol_bdata + p.WriteBinary(v) + p.Flush() + value, err := p.ReadBinary() + if err != nil { + t.Errorf("%s: %T %T Unable to read binary: %s", "ReadWriteBinary", p, trans, err.Error()) + } + if len(v) != len(value) { + t.Errorf("%s: %T %T len(v) != len(value)... %d != %d", "ReadWriteBinary", p, trans, len(v), len(value)) + } else { + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Errorf("%s: %T %T %s != %s", "ReadWriteBinary", p, trans, v, value) + } + } + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport.go new file mode 100644 index 0000000..8e296a9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport.go @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import "io" + +type RichTransport struct { + TTransport +} + +// Wraps Transport to provide TRichTransport interface +func NewTRichTransport(trans TTransport) *RichTransport { + return &RichTransport{trans} +} + +func (r *RichTransport) ReadByte() (c byte, err error) { + return readByte(r.TTransport) +} + +func (r *RichTransport) WriteByte(c byte) error { + return writeByte(r.TTransport, c) +} + +func (r *RichTransport) WriteString(s string) (n int, err error) { + return r.Write([]byte(s)) +} + +func (r *RichTransport) RemainingBytes() (num_bytes uint64) { + return r.TTransport.RemainingBytes() +} + +func readByte(r io.Reader) (c byte, err error) { + v := [1]byte{0} + n, err := r.Read(v[0:1]) + if n > 0 && (err == nil || err == io.EOF) { + return v[0], nil + } + if n > 0 && err != nil { + return v[0], err + } + if err != nil { + return 0, err + } + return v[0], nil +} + +func writeByte(w io.Writer, c byte) error { + v := [1]byte{c} + _, err := w.Write(v[0:1]) + return err +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport_test.go new file mode 100644 index 0000000..41513f8 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/rich_transport_test.go @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bytes" + "errors" + "io" + "reflect" + "testing" +) + +func TestEnsureTransportsAreRich(t *testing.T) { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + transports := []TTransportFactory{ + NewTMemoryBufferTransportFactory(1024), + NewStreamTransportFactory(buf, buf, true), + NewTFramedTransportFactory(NewTMemoryBufferTransportFactory(1024)), + NewTHttpPostClientTransportFactory("http://127.0.0.1"), + } + for _, tf := range transports { + trans := tf.GetTransport(nil) + _, ok := trans.(TRichTransport) + if !ok { + t.Errorf("Transport %s does not implement TRichTransport interface", reflect.ValueOf(trans)) + } + } +} + +// TestReadByte tests whether readByte handles error cases correctly. +func TestReadByte(t *testing.T) { + for i, test := range readByteTests { + v, err := readByte(test.r) + if v != test.v { + t.Fatalf("TestReadByte %d: value differs. Expected %d, got %d", i, test.v, test.r.v) + } + if err != test.err { + t.Fatalf("TestReadByte %d: error differs. Expected %s, got %s", i, test.err, test.r.err) + } + } +} + +var someError = errors.New("Some error") +var readByteTests = []struct { + r *mockReader + v byte + err error +}{ + {&mockReader{0, 55, io.EOF}, 0, io.EOF}, // reader sends EOF w/o data + {&mockReader{0, 55, someError}, 0, someError}, // reader sends some other error + {&mockReader{1, 55, nil}, 55, nil}, // reader sends data w/o error + {&mockReader{1, 55, io.EOF}, 55, nil}, // reader sends data with EOF + {&mockReader{1, 55, someError}, 55, someError}, // reader sends data withsome error +} + +type mockReader struct { + n int + v byte + err error +} + +func (r *mockReader) Read(p []byte) (n int, err error) { + if r.n > 0 { + p[0] = r.v + } + return r.n, r.err +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer.go new file mode 100644 index 0000000..7712229 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer.go @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +type TSerializer struct { + Transport *TMemoryBuffer + Protocol TProtocol +} + +type TStruct interface { + Write(p TProtocol) error + Read(p TProtocol) error +} + +func NewTSerializer() *TSerializer { + transport := NewTMemoryBufferLen(1024) + protocol := NewTBinaryProtocolFactoryDefault().GetProtocol(transport) + + return &TSerializer{ + transport, + protocol} +} + +func (t *TSerializer) WriteString(msg TStruct) (s string, err error) { + t.Transport.Reset() + + if err = msg.Write(t.Protocol); err != nil { + return + } + + if err = t.Protocol.Flush(); err != nil { + return + } + if err = t.Transport.Flush(); err != nil { + return + } + + return t.Transport.String(), nil +} + +func (t *TSerializer) Write(msg TStruct) (b []byte, err error) { + t.Transport.Reset() + + if err = msg.Write(t.Protocol); err != nil { + return + } + + if err = t.Protocol.Flush(); err != nil { + return + } + + if err = t.Transport.Flush(); err != nil { + return + } + + b = append(b, t.Transport.Bytes()...) + return +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_test.go new file mode 100644 index 0000000..06d27a1 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_test.go @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" + "fmt" + "testing" +) + +type ProtocolFactory interface { + GetProtocol(t TTransport) TProtocol +} + +func compareStructs(m, m1 MyTestStruct) (bool, error) { + switch { + case m.On != m1.On: + return false, errors.New("Boolean not equal") + case m.B != m1.B: + return false, errors.New("Byte not equal") + case m.Int16 != m1.Int16: + return false, errors.New("Int16 not equal") + case m.Int32 != m1.Int32: + return false, errors.New("Int32 not equal") + case m.Int64 != m1.Int64: + return false, errors.New("Int64 not equal") + case m.D != m1.D: + return false, errors.New("Double not equal") + case m.St != m1.St: + return false, errors.New("String not equal") + + case len(m.Bin) != len(m1.Bin): + return false, errors.New("Binary size not equal") + case len(m.Bin) == len(m1.Bin): + for i := range m.Bin { + if m.Bin[i] != m1.Bin[i] { + return false, errors.New("Binary not equal") + } + } + case len(m.StringMap) != len(m1.StringMap): + return false, errors.New("StringMap size not equal") + case len(m.StringList) != len(m1.StringList): + return false, errors.New("StringList size not equal") + case len(m.StringSet) != len(m1.StringSet): + return false, errors.New("StringSet size not equal") + + case m.E != m1.E: + return false, errors.New("MyTestEnum not equal") + + default: + return true, nil + + } + return true, nil +} + +func ProtocolTest1(test *testing.T, pf ProtocolFactory) (bool, error) { + t := NewTSerializer() + t.Protocol = pf.GetProtocol(t.Transport) + var m = MyTestStruct{} + m.On = true + m.B = int8(0) + m.Int16 = 1 + m.Int32 = 2 + m.Int64 = 3 + m.D = 4.1 + m.St = "Test" + m.Bin = make([]byte, 10) + m.StringMap = make(map[string]string, 5) + m.StringList = make([]string, 5) + m.StringSet = make(map[string]struct{}, 5) + m.E = 2 + + s, err := t.WriteString(&m) + if err != nil { + return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err)) + } + + t1 := NewTDeserializer() + t1.Protocol = pf.GetProtocol(t1.Transport) + var m1 = MyTestStruct{} + if err = t1.ReadString(&m1, s); err != nil { + return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err)) + + } + + return compareStructs(m, m1) + +} + +func ProtocolTest2(test *testing.T, pf ProtocolFactory) (bool, error) { + t := NewTSerializer() + t.Protocol = pf.GetProtocol(t.Transport) + var m = MyTestStruct{} + m.On = false + m.B = int8(0) + m.Int16 = 1 + m.Int32 = 2 + m.Int64 = 3 + m.D = 4.1 + m.St = "Test" + m.Bin = make([]byte, 10) + m.StringMap = make(map[string]string, 5) + m.StringList = make([]string, 5) + m.StringSet = make(map[string]struct{}, 5) + m.E = 2 + + s, err := t.WriteString(&m) + if err != nil { + return false, errors.New(fmt.Sprintf("Unable to Serialize struct\n\t %s", err)) + + } + + t1 := NewTDeserializer() + t1.Protocol = pf.GetProtocol(t1.Transport) + var m1 = MyTestStruct{} + if err = t1.ReadString(&m1, s); err != nil { + return false, errors.New(fmt.Sprintf("Unable to Deserialize struct\n\t %s", err)) + + } + + return compareStructs(m, m1) + +} + +func TestSerializer(t *testing.T) { + + var protocol_factories map[string]ProtocolFactory + protocol_factories = make(map[string]ProtocolFactory) + protocol_factories["Binary"] = NewTBinaryProtocolFactoryDefault() + protocol_factories["Compact"] = NewTCompactProtocolFactory() + //protocol_factories["SimpleJSON"] = NewTSimpleJSONProtocolFactory() - write only, can't be read back by design + protocol_factories["JSON"] = NewTJSONProtocolFactory() + + var tests map[string]func(*testing.T, ProtocolFactory) (bool, error) + tests = make(map[string]func(*testing.T, ProtocolFactory) (bool, error)) + tests["Test 1"] = ProtocolTest1 + tests["Test 2"] = ProtocolTest2 + //tests["Test 3"] = ProtocolTest3 // Example of how to add additional tests + + for name, pf := range protocol_factories { + + for test, f := range tests { + + if s, err := f(t, pf); !s || err != nil { + t.Errorf("%s Failed for %s protocol\n\t %s", test, name, err) + } + + } + } + +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_types_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_types_test.go new file mode 100644 index 0000000..38ab8d6 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_types_test.go @@ -0,0 +1,633 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Autogenerated by Thrift Compiler (1.0.0-dev) +// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS + +enum MyTestEnum { + FIRST = 1, + SECOND = 2, + THIRD = 3, + FOURTH = 4, +} + +struct MyTestStruct { + 1: bool on, + 2: byte b, + 3: i16 int16, + 4: i32 int32, + 5: i64 int64, + 6: double d, + 7: string st, + 8: binary bin, + 9: map stringMap, + 10: list stringList, + 11: set stringSet, + 12: MyTestEnum e, +} +*/ + +import ( + "fmt" +) + +// (needed to ensure safety because of naive import list construction.) +var _ = ZERO +var _ = fmt.Printf + +var GoUnusedProtection__ int + +type MyTestEnum int64 + +const ( + MyTestEnum_FIRST MyTestEnum = 1 + MyTestEnum_SECOND MyTestEnum = 2 + MyTestEnum_THIRD MyTestEnum = 3 + MyTestEnum_FOURTH MyTestEnum = 4 +) + +func (p MyTestEnum) String() string { + switch p { + case MyTestEnum_FIRST: + return "FIRST" + case MyTestEnum_SECOND: + return "SECOND" + case MyTestEnum_THIRD: + return "THIRD" + case MyTestEnum_FOURTH: + return "FOURTH" + } + return "" +} + +func MyTestEnumFromString(s string) (MyTestEnum, error) { + switch s { + case "FIRST": + return MyTestEnum_FIRST, nil + case "SECOND": + return MyTestEnum_SECOND, nil + case "THIRD": + return MyTestEnum_THIRD, nil + case "FOURTH": + return MyTestEnum_FOURTH, nil + } + return MyTestEnum(0), fmt.Errorf("not a valid MyTestEnum string") +} + +func MyTestEnumPtr(v MyTestEnum) *MyTestEnum { return &v } + +type MyTestStruct struct { + On bool `thrift:"on,1" json:"on"` + B int8 `thrift:"b,2" json:"b"` + Int16 int16 `thrift:"int16,3" json:"int16"` + Int32 int32 `thrift:"int32,4" json:"int32"` + Int64 int64 `thrift:"int64,5" json:"int64"` + D float64 `thrift:"d,6" json:"d"` + St string `thrift:"st,7" json:"st"` + Bin []byte `thrift:"bin,8" json:"bin"` + StringMap map[string]string `thrift:"stringMap,9" json:"stringMap"` + StringList []string `thrift:"stringList,10" json:"stringList"` + StringSet map[string]struct{} `thrift:"stringSet,11" json:"stringSet"` + E MyTestEnum `thrift:"e,12" json:"e"` +} + +func NewMyTestStruct() *MyTestStruct { + return &MyTestStruct{} +} + +func (p *MyTestStruct) GetOn() bool { + return p.On +} + +func (p *MyTestStruct) GetB() int8 { + return p.B +} + +func (p *MyTestStruct) GetInt16() int16 { + return p.Int16 +} + +func (p *MyTestStruct) GetInt32() int32 { + return p.Int32 +} + +func (p *MyTestStruct) GetInt64() int64 { + return p.Int64 +} + +func (p *MyTestStruct) GetD() float64 { + return p.D +} + +func (p *MyTestStruct) GetSt() string { + return p.St +} + +func (p *MyTestStruct) GetBin() []byte { + return p.Bin +} + +func (p *MyTestStruct) GetStringMap() map[string]string { + return p.StringMap +} + +func (p *MyTestStruct) GetStringList() []string { + return p.StringList +} + +func (p *MyTestStruct) GetStringSet() map[string]struct{} { + return p.StringSet +} + +func (p *MyTestStruct) GetE() MyTestEnum { + return p.E +} +func (p *MyTestStruct) Read(iprot TProtocol) error { + if _, err := iprot.ReadStructBegin(); err != nil { + return PrependError(fmt.Sprintf("%T read error: ", p), err) + } + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + if err != nil { + return PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == STOP { + break + } + switch fieldId { + case 1: + if err := p.readField1(iprot); err != nil { + return err + } + case 2: + if err := p.readField2(iprot); err != nil { + return err + } + case 3: + if err := p.readField3(iprot); err != nil { + return err + } + case 4: + if err := p.readField4(iprot); err != nil { + return err + } + case 5: + if err := p.readField5(iprot); err != nil { + return err + } + case 6: + if err := p.readField6(iprot); err != nil { + return err + } + case 7: + if err := p.readField7(iprot); err != nil { + return err + } + case 8: + if err := p.readField8(iprot); err != nil { + return err + } + case 9: + if err := p.readField9(iprot); err != nil { + return err + } + case 10: + if err := p.readField10(iprot); err != nil { + return err + } + case 11: + if err := p.readField11(iprot); err != nil { + return err + } + case 12: + if err := p.readField12(iprot); err != nil { + return err + } + default: + if err := iprot.Skip(fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(); err != nil { + return PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + return nil +} + +func (p *MyTestStruct) readField1(iprot TProtocol) error { + if v, err := iprot.ReadBool(); err != nil { + return PrependError("error reading field 1: ", err) + } else { + p.On = v + } + return nil +} + +func (p *MyTestStruct) readField2(iprot TProtocol) error { + if v, err := iprot.ReadByte(); err != nil { + return PrependError("error reading field 2: ", err) + } else { + temp := int8(v) + p.B = temp + } + return nil +} + +func (p *MyTestStruct) readField3(iprot TProtocol) error { + if v, err := iprot.ReadI16(); err != nil { + return PrependError("error reading field 3: ", err) + } else { + p.Int16 = v + } + return nil +} + +func (p *MyTestStruct) readField4(iprot TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return PrependError("error reading field 4: ", err) + } else { + p.Int32 = v + } + return nil +} + +func (p *MyTestStruct) readField5(iprot TProtocol) error { + if v, err := iprot.ReadI64(); err != nil { + return PrependError("error reading field 5: ", err) + } else { + p.Int64 = v + } + return nil +} + +func (p *MyTestStruct) readField6(iprot TProtocol) error { + if v, err := iprot.ReadDouble(); err != nil { + return PrependError("error reading field 6: ", err) + } else { + p.D = v + } + return nil +} + +func (p *MyTestStruct) readField7(iprot TProtocol) error { + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 7: ", err) + } else { + p.St = v + } + return nil +} + +func (p *MyTestStruct) readField8(iprot TProtocol) error { + if v, err := iprot.ReadBinary(); err != nil { + return PrependError("error reading field 8: ", err) + } else { + p.Bin = v + } + return nil +} + +func (p *MyTestStruct) readField9(iprot TProtocol) error { + _, _, size, err := iprot.ReadMapBegin() + if err != nil { + return PrependError("error reading map begin: ", err) + } + tMap := make(map[string]string, size) + p.StringMap = tMap + for i := 0; i < size; i++ { + var _key0 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _key0 = v + } + var _val1 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _val1 = v + } + p.StringMap[_key0] = _val1 + } + if err := iprot.ReadMapEnd(); err != nil { + return PrependError("error reading map end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField10(iprot TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.StringList = tSlice + for i := 0; i < size; i++ { + var _elem2 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _elem2 = v + } + p.StringList = append(p.StringList, _elem2) + } + if err := iprot.ReadListEnd(); err != nil { + return PrependError("error reading list end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField11(iprot TProtocol) error { + _, size, err := iprot.ReadSetBegin() + if err != nil { + return PrependError("error reading set begin: ", err) + } + tSet := make(map[string]struct{}, size) + p.StringSet = tSet + for i := 0; i < size; i++ { + var _elem3 string + if v, err := iprot.ReadString(); err != nil { + return PrependError("error reading field 0: ", err) + } else { + _elem3 = v + } + p.StringSet[_elem3] = struct{}{} + } + if err := iprot.ReadSetEnd(); err != nil { + return PrependError("error reading set end: ", err) + } + return nil +} + +func (p *MyTestStruct) readField12(iprot TProtocol) error { + if v, err := iprot.ReadI32(); err != nil { + return PrependError("error reading field 12: ", err) + } else { + temp := MyTestEnum(v) + p.E = temp + } + return nil +} + +func (p *MyTestStruct) Write(oprot TProtocol) error { + if err := oprot.WriteStructBegin("MyTestStruct"); err != nil { + return PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) + } + 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.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.writeField12(oprot); err != nil { + return err + } + if err := oprot.WriteFieldStop(); err != nil { + return PrependError("write field stop error: ", err) + } + if err := oprot.WriteStructEnd(); err != nil { + return PrependError("write struct stop error: ", err) + } + return nil +} + +func (p *MyTestStruct) writeField1(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("on", BOOL, 1); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 1:on: ", p), err) + } + if err := oprot.WriteBool(bool(p.On)); err != nil { + return PrependError(fmt.Sprintf("%T.on (1) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 1:on: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField2(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("b", BYTE, 2); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err) + } + if err := oprot.WriteByte(int8(p.B)); err != nil { + return PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField3(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int16", I16, 3); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 3:int16: ", p), err) + } + if err := oprot.WriteI16(int16(p.Int16)); err != nil { + return PrependError(fmt.Sprintf("%T.int16 (3) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 3:int16: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField4(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int32", I32, 4); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 4:int32: ", p), err) + } + if err := oprot.WriteI32(int32(p.Int32)); err != nil { + return PrependError(fmt.Sprintf("%T.int32 (4) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 4:int32: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField5(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("int64", I64, 5); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 5:int64: ", p), err) + } + if err := oprot.WriteI64(int64(p.Int64)); err != nil { + return PrependError(fmt.Sprintf("%T.int64 (5) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 5:int64: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField6(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("d", DOUBLE, 6); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 6:d: ", p), err) + } + if err := oprot.WriteDouble(float64(p.D)); err != nil { + return PrependError(fmt.Sprintf("%T.d (6) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 6:d: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField7(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("st", STRING, 7); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 7:st: ", p), err) + } + if err := oprot.WriteString(string(p.St)); err != nil { + return PrependError(fmt.Sprintf("%T.st (7) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 7:st: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField8(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("bin", STRING, 8); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 8:bin: ", p), err) + } + if err := oprot.WriteBinary(p.Bin); err != nil { + return PrependError(fmt.Sprintf("%T.bin (8) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 8:bin: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField9(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringMap", MAP, 9); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 9:stringMap: ", p), err) + } + if err := oprot.WriteMapBegin(STRING, STRING, len(p.StringMap)); err != nil { + return PrependError("error writing map begin: ", err) + } + for k, v := range p.StringMap { + if err := oprot.WriteString(string(k)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteMapEnd(); err != nil { + return PrependError("error writing map end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 9:stringMap: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField10(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringList", LIST, 10); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 10:stringList: ", p), err) + } + if err := oprot.WriteListBegin(STRING, len(p.StringList)); err != nil { + return PrependError("error writing list begin: ", err) + } + for _, v := range p.StringList { + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteListEnd(); err != nil { + return PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 10:stringList: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField11(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("stringSet", SET, 11); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 11:stringSet: ", p), err) + } + if err := oprot.WriteSetBegin(STRING, len(p.StringSet)); err != nil { + return PrependError("error writing set begin: ", err) + } + for v, _ := range p.StringSet { + if err := oprot.WriteString(string(v)); err != nil { + return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) + } + } + if err := oprot.WriteSetEnd(); err != nil { + return PrependError("error writing set end: ", err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 11:stringSet: ", p), err) + } + return err +} + +func (p *MyTestStruct) writeField12(oprot TProtocol) (err error) { + if err := oprot.WriteFieldBegin("e", I32, 12); err != nil { + return PrependError(fmt.Sprintf("%T write field begin error 12:e: ", p), err) + } + if err := oprot.WriteI32(int32(p.E)); err != nil { + return PrependError(fmt.Sprintf("%T.e (12) field write error: ", p), err) + } + if err := oprot.WriteFieldEnd(); err != nil { + return PrependError(fmt.Sprintf("%T write field end error 12:e: ", p), err) + } + return err +} + +func (p *MyTestStruct) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("MyTestStruct(%+v)", *p) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/server.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/server.go new file mode 100644 index 0000000..f813fa3 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/server.go @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +type TServer interface { + ProcessorFactory() TProcessorFactory + ServerTransport() TServerTransport + InputTransportFactory() TTransportFactory + OutputTransportFactory() TTransportFactory + InputProtocolFactory() TProtocolFactory + OutputProtocolFactory() TProtocolFactory + + // Starts the server + Serve() error + // Stops the server. This is optional on a per-implementation basis. Not + // all servers are required to be cleanly stoppable. + Stop() error +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket.go new file mode 100644 index 0000000..d6e9495 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket.go @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "net" + "sync" + "time" +) + +type TServerSocket struct { + listener net.Listener + addr net.Addr + clientTimeout time.Duration + + // Protects the interrupted value to make it thread safe. + mu sync.RWMutex + interrupted bool +} + +func NewTServerSocket(listenAddr string) (*TServerSocket, error) { + return NewTServerSocketTimeout(listenAddr, 0) +} + +func NewTServerSocketTimeout(listenAddr string, clientTimeout time.Duration) (*TServerSocket, error) { + addr, err := net.ResolveTCPAddr("tcp", listenAddr) + if err != nil { + return nil, err + } + return &TServerSocket{addr: addr, clientTimeout: clientTimeout}, nil +} + +func (p *TServerSocket) Listen() error { + if p.IsListening() { + return nil + } + l, err := net.Listen(p.addr.Network(), p.addr.String()) + if err != nil { + return err + } + p.listener = l + return nil +} + +func (p *TServerSocket) Accept() (TTransport, error) { + p.mu.RLock() + interrupted := p.interrupted + p.mu.RUnlock() + + if interrupted { + return nil, errTransportInterrupted + } + if p.listener == nil { + return nil, NewTTransportException(NOT_OPEN, "No underlying server socket") + } + conn, err := p.listener.Accept() + if err != nil { + return nil, NewTTransportExceptionFromError(err) + } + return NewTSocketFromConnTimeout(conn, p.clientTimeout), nil +} + +// Checks whether the socket is listening. +func (p *TServerSocket) IsListening() bool { + return p.listener != nil +} + +// Connects the socket, creating a new socket object if necessary. +func (p *TServerSocket) Open() error { + if p.IsListening() { + return NewTTransportException(ALREADY_OPEN, "Server socket already open") + } + if l, err := net.Listen(p.addr.Network(), p.addr.String()); err != nil { + return err + } else { + p.listener = l + } + return nil +} + +func (p *TServerSocket) Addr() net.Addr { + if p.listener != nil { + return p.listener.Addr() + } + return p.addr +} + +func (p *TServerSocket) Close() error { + defer func() { + p.listener = nil + }() + if p.IsListening() { + return p.listener.Close() + } + return nil +} + +func (p *TServerSocket) Interrupt() error { + p.mu.Lock() + p.interrupted = true + p.Close() + p.mu.Unlock() + + return nil +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go new file mode 100644 index 0000000..f08e8e9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket_test.go @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "fmt" + "testing" +) + +func TestSocketIsntListeningAfterInterrupt(t *testing.T) { + host := "127.0.0.1" + port := 9090 + addr := fmt.Sprintf("%s:%d", host, port) + + socket := CreateServerSocket(t, addr) + socket.Listen() + socket.Interrupt() + + newSocket := CreateServerSocket(t, addr) + err := newSocket.Listen() + defer newSocket.Interrupt() + if err != nil { + t.Fatalf("Failed to rebinds: %s", err) + } +} + +func CreateServerSocket(t *testing.T, addr string) *TServerSocket { + socket, err := NewTServerSocket(addr) + if err != nil { + t.Fatalf("Failed to create server socket: %s", err) + } + return socket +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/server_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_test.go new file mode 100644 index 0000000..ffaf457 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_test.go @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "testing" +) + +func TestNothing(t *testing.T) { + +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/server_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_transport.go new file mode 100644 index 0000000..51c40b6 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/server_transport.go @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Server transport. Object which provides client transports. +type TServerTransport interface { + Listen() error + Accept() (TTransport, error) + Close() error + + // Optional method implementation. This signals to the server transport + // that it should break out of any accept() or listen() that it is currently + // blocked on. This method, if implemented, MUST be thread safe, as it may + // be called from a different thread context than the other TServerTransport + // methods. + Interrupt() error +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol.go new file mode 100644 index 0000000..7353322 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol.go @@ -0,0 +1,1337 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "bufio" + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "math" + "strconv" +) + +type _ParseContext int + +const ( + _CONTEXT_IN_TOPLEVEL _ParseContext = 1 + _CONTEXT_IN_LIST_FIRST _ParseContext = 2 + _CONTEXT_IN_LIST _ParseContext = 3 + _CONTEXT_IN_OBJECT_FIRST _ParseContext = 4 + _CONTEXT_IN_OBJECT_NEXT_KEY _ParseContext = 5 + _CONTEXT_IN_OBJECT_NEXT_VALUE _ParseContext = 6 +) + +func (p _ParseContext) String() string { + switch p { + case _CONTEXT_IN_TOPLEVEL: + return "TOPLEVEL" + case _CONTEXT_IN_LIST_FIRST: + return "LIST-FIRST" + case _CONTEXT_IN_LIST: + return "LIST" + case _CONTEXT_IN_OBJECT_FIRST: + return "OBJECT-FIRST" + case _CONTEXT_IN_OBJECT_NEXT_KEY: + return "OBJECT-NEXT-KEY" + case _CONTEXT_IN_OBJECT_NEXT_VALUE: + return "OBJECT-NEXT-VALUE" + } + return "UNKNOWN-PARSE-CONTEXT" +} + +// JSON protocol implementation for thrift. +// +// This protocol produces/consumes a simple output format +// suitable for parsing by scripting languages. It should not be +// confused with the full-featured TJSONProtocol. +// +type TSimpleJSONProtocol struct { + trans TTransport + + parseContextStack []int + dumpContext []int + + writer *bufio.Writer + reader *bufio.Reader +} + +// Constructor +func NewTSimpleJSONProtocol(t TTransport) *TSimpleJSONProtocol { + v := &TSimpleJSONProtocol{trans: t, + writer: bufio.NewWriter(t), + reader: bufio.NewReader(t), + } + v.parseContextStack = append(v.parseContextStack, int(_CONTEXT_IN_TOPLEVEL)) + v.dumpContext = append(v.dumpContext, int(_CONTEXT_IN_TOPLEVEL)) + return v +} + +// Factory +type TSimpleJSONProtocolFactory struct{} + +func (p *TSimpleJSONProtocolFactory) GetProtocol(trans TTransport) TProtocol { + return NewTSimpleJSONProtocol(trans) +} + +func NewTSimpleJSONProtocolFactory() *TSimpleJSONProtocolFactory { + return &TSimpleJSONProtocolFactory{} +} + +var ( + JSON_COMMA []byte + JSON_COLON []byte + JSON_LBRACE []byte + JSON_RBRACE []byte + JSON_LBRACKET []byte + JSON_RBRACKET []byte + JSON_QUOTE byte + JSON_QUOTE_BYTES []byte + JSON_NULL []byte + JSON_TRUE []byte + JSON_FALSE []byte + JSON_INFINITY string + JSON_NEGATIVE_INFINITY string + JSON_NAN string + JSON_INFINITY_BYTES []byte + JSON_NEGATIVE_INFINITY_BYTES []byte + JSON_NAN_BYTES []byte + json_nonbase_map_elem_bytes []byte +) + +func init() { + JSON_COMMA = []byte{','} + JSON_COLON = []byte{':'} + JSON_LBRACE = []byte{'{'} + JSON_RBRACE = []byte{'}'} + JSON_LBRACKET = []byte{'['} + JSON_RBRACKET = []byte{']'} + JSON_QUOTE = '"' + JSON_QUOTE_BYTES = []byte{'"'} + JSON_NULL = []byte{'n', 'u', 'l', 'l'} + JSON_TRUE = []byte{'t', 'r', 'u', 'e'} + JSON_FALSE = []byte{'f', 'a', 'l', 's', 'e'} + JSON_INFINITY = "Infinity" + JSON_NEGATIVE_INFINITY = "-Infinity" + JSON_NAN = "NaN" + JSON_INFINITY_BYTES = []byte{'I', 'n', 'f', 'i', 'n', 'i', 't', 'y'} + JSON_NEGATIVE_INFINITY_BYTES = []byte{'-', 'I', 'n', 'f', 'i', 'n', 'i', 't', 'y'} + JSON_NAN_BYTES = []byte{'N', 'a', 'N'} + json_nonbase_map_elem_bytes = []byte{']', ',', '['} +} + +func jsonQuote(s string) string { + b, _ := json.Marshal(s) + s1 := string(b) + return s1 +} + +func jsonUnquote(s string) (string, bool) { + s1 := new(string) + err := json.Unmarshal([]byte(s), s1) + return *s1, err == nil +} + +func mismatch(expected, actual string) error { + return fmt.Errorf("Expected '%s' but found '%s' while parsing JSON.", expected, actual) +} + +func (p *TSimpleJSONProtocol) WriteMessageBegin(name string, typeId TMessageType, seqId int32) error { + p.resetContextStack() // THRIFT-3735 + if e := p.OutputListBegin(); e != nil { + return e + } + if e := p.WriteString(name); e != nil { + return e + } + if e := p.WriteByte(int8(typeId)); e != nil { + return e + } + if e := p.WriteI32(seqId); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) WriteMessageEnd() error { + return p.OutputListEnd() +} + +func (p *TSimpleJSONProtocol) WriteStructBegin(name string) error { + if e := p.OutputObjectBegin(); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) WriteStructEnd() error { + return p.OutputObjectEnd() +} + +func (p *TSimpleJSONProtocol) WriteFieldBegin(name string, typeId TType, id int16) error { + if e := p.WriteString(name); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) WriteFieldEnd() error { + //return p.OutputListEnd() + return nil +} + +func (p *TSimpleJSONProtocol) WriteFieldStop() error { return nil } + +func (p *TSimpleJSONProtocol) WriteMapBegin(keyType TType, valueType TType, size int) error { + if e := p.OutputListBegin(); e != nil { + return e + } + if e := p.WriteByte(int8(keyType)); e != nil { + return e + } + if e := p.WriteByte(int8(valueType)); e != nil { + return e + } + return p.WriteI32(int32(size)) +} + +func (p *TSimpleJSONProtocol) WriteMapEnd() error { + return p.OutputListEnd() +} + +func (p *TSimpleJSONProtocol) WriteListBegin(elemType TType, size int) error { + return p.OutputElemListBegin(elemType, size) +} + +func (p *TSimpleJSONProtocol) WriteListEnd() error { + return p.OutputListEnd() +} + +func (p *TSimpleJSONProtocol) WriteSetBegin(elemType TType, size int) error { + return p.OutputElemListBegin(elemType, size) +} + +func (p *TSimpleJSONProtocol) WriteSetEnd() error { + return p.OutputListEnd() +} + +func (p *TSimpleJSONProtocol) WriteBool(b bool) error { + return p.OutputBool(b) +} + +func (p *TSimpleJSONProtocol) WriteByte(b int8) error { + return p.WriteI32(int32(b)) +} + +func (p *TSimpleJSONProtocol) WriteI16(v int16) error { + return p.WriteI32(int32(v)) +} + +func (p *TSimpleJSONProtocol) WriteI32(v int32) error { + return p.OutputI64(int64(v)) +} + +func (p *TSimpleJSONProtocol) WriteI64(v int64) error { + return p.OutputI64(int64(v)) +} + +func (p *TSimpleJSONProtocol) WriteDouble(v float64) error { + return p.OutputF64(v) +} + +func (p *TSimpleJSONProtocol) WriteString(v string) error { + return p.OutputString(v) +} + +func (p *TSimpleJSONProtocol) WriteBinary(v []byte) error { + // JSON library only takes in a string, + // not an arbitrary byte array, to ensure bytes are transmitted + // efficiently we must convert this into a valid JSON string + // therefore we use base64 encoding to avoid excessive escaping/quoting + if e := p.OutputPreValue(); e != nil { + return e + } + if _, e := p.write(JSON_QUOTE_BYTES); e != nil { + return NewTProtocolException(e) + } + writer := base64.NewEncoder(base64.StdEncoding, p.writer) + if _, e := writer.Write(v); e != nil { + p.writer.Reset(p.trans) // THRIFT-3735 + return NewTProtocolException(e) + } + if e := writer.Close(); e != nil { + return NewTProtocolException(e) + } + if _, e := p.write(JSON_QUOTE_BYTES); e != nil { + return NewTProtocolException(e) + } + return p.OutputPostValue() +} + +// Reading methods. +func (p *TSimpleJSONProtocol) ReadMessageBegin() (name string, typeId TMessageType, seqId int32, err error) { + p.resetContextStack() // THRIFT-3735 + if isNull, err := p.ParseListBegin(); isNull || err != nil { + return name, typeId, seqId, err + } + if name, err = p.ReadString(); err != nil { + return name, typeId, seqId, err + } + bTypeId, err := p.ReadByte() + typeId = TMessageType(bTypeId) + if err != nil { + return name, typeId, seqId, err + } + if seqId, err = p.ReadI32(); err != nil { + return name, typeId, seqId, err + } + return name, typeId, seqId, nil +} + +func (p *TSimpleJSONProtocol) ReadMessageEnd() error { + return p.ParseListEnd() +} + +func (p *TSimpleJSONProtocol) ReadStructBegin() (name string, err error) { + _, err = p.ParseObjectStart() + return "", err +} + +func (p *TSimpleJSONProtocol) ReadStructEnd() error { + return p.ParseObjectEnd() +} + +func (p *TSimpleJSONProtocol) ReadFieldBegin() (string, TType, int16, error) { + if err := p.ParsePreValue(); err != nil { + return "", STOP, 0, err + } + b, _ := p.reader.Peek(1) + if len(b) > 0 { + switch b[0] { + case JSON_RBRACE[0]: + return "", STOP, 0, nil + case JSON_QUOTE: + p.reader.ReadByte() + name, err := p.ParseStringBody() + // simplejson is not meant to be read back into thrift + // - see http://wiki.apache.org/thrift/ThriftUsageJava + // - use JSON instead + if err != nil { + return name, STOP, 0, err + } + return name, STOP, -1, p.ParsePostValue() + /* + if err = p.ParsePostValue(); err != nil { + return name, STOP, 0, err + } + if isNull, err := p.ParseListBegin(); isNull || err != nil { + return name, STOP, 0, err + } + bType, err := p.ReadByte() + thetype := TType(bType) + if err != nil { + return name, thetype, 0, err + } + id, err := p.ReadI16() + return name, thetype, id, err + */ + } + e := fmt.Errorf("Expected \"}\" or '\"', but found: '%s'", string(b)) + return "", STOP, 0, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return "", STOP, 0, NewTProtocolException(io.EOF) +} + +func (p *TSimpleJSONProtocol) ReadFieldEnd() error { + return nil + //return p.ParseListEnd() +} + +func (p *TSimpleJSONProtocol) ReadMapBegin() (keyType TType, valueType TType, size int, e error) { + if isNull, e := p.ParseListBegin(); isNull || e != nil { + return VOID, VOID, 0, e + } + + // read keyType + bKeyType, e := p.ReadByte() + keyType = TType(bKeyType) + if e != nil { + return keyType, valueType, size, e + } + + // read valueType + bValueType, e := p.ReadByte() + valueType = TType(bValueType) + if e != nil { + return keyType, valueType, size, e + } + + // read size + iSize, err := p.ReadI64() + size = int(iSize) + return keyType, valueType, size, err +} + +func (p *TSimpleJSONProtocol) ReadMapEnd() error { + return p.ParseListEnd() +} + +func (p *TSimpleJSONProtocol) ReadListBegin() (elemType TType, size int, e error) { + return p.ParseElemListBegin() +} + +func (p *TSimpleJSONProtocol) ReadListEnd() error { + return p.ParseListEnd() +} + +func (p *TSimpleJSONProtocol) ReadSetBegin() (elemType TType, size int, e error) { + return p.ParseElemListBegin() +} + +func (p *TSimpleJSONProtocol) ReadSetEnd() error { + return p.ParseListEnd() +} + +func (p *TSimpleJSONProtocol) ReadBool() (bool, error) { + var value bool + + if err := p.ParsePreValue(); err != nil { + return value, err + } + f, _ := p.reader.Peek(1) + if len(f) > 0 { + switch f[0] { + case JSON_TRUE[0]: + b := make([]byte, len(JSON_TRUE)) + _, err := p.reader.Read(b) + if err != nil { + return false, NewTProtocolException(err) + } + if string(b) == string(JSON_TRUE) { + value = true + } else { + e := fmt.Errorf("Expected \"true\" but found: %s", string(b)) + return value, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + break + case JSON_FALSE[0]: + b := make([]byte, len(JSON_FALSE)) + _, err := p.reader.Read(b) + if err != nil { + return false, NewTProtocolException(err) + } + if string(b) == string(JSON_FALSE) { + value = false + } else { + e := fmt.Errorf("Expected \"false\" but found: %s", string(b)) + return value, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + break + case JSON_NULL[0]: + b := make([]byte, len(JSON_NULL)) + _, err := p.reader.Read(b) + if err != nil { + return false, NewTProtocolException(err) + } + if string(b) == string(JSON_NULL) { + value = false + } else { + e := fmt.Errorf("Expected \"null\" but found: %s", string(b)) + return value, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + default: + e := fmt.Errorf("Expected \"true\", \"false\", or \"null\" but found: %s", string(f)) + return value, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + return value, p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) ReadByte() (int8, error) { + v, err := p.ReadI64() + return int8(v), err +} + +func (p *TSimpleJSONProtocol) ReadI16() (int16, error) { + v, err := p.ReadI64() + return int16(v), err +} + +func (p *TSimpleJSONProtocol) ReadI32() (int32, error) { + v, err := p.ReadI64() + return int32(v), err +} + +func (p *TSimpleJSONProtocol) ReadI64() (int64, error) { + v, _, err := p.ParseI64() + return v, err +} + +func (p *TSimpleJSONProtocol) ReadDouble() (float64, error) { + v, _, err := p.ParseF64() + return v, err +} + +func (p *TSimpleJSONProtocol) ReadString() (string, error) { + var v string + if err := p.ParsePreValue(); err != nil { + return v, err + } + f, _ := p.reader.Peek(1) + if len(f) > 0 && f[0] == JSON_QUOTE { + p.reader.ReadByte() + value, err := p.ParseStringBody() + v = value + if err != nil { + return v, err + } + } else if len(f) > 0 && f[0] == JSON_NULL[0] { + b := make([]byte, len(JSON_NULL)) + _, err := p.reader.Read(b) + if err != nil { + return v, NewTProtocolException(err) + } + if string(b) != string(JSON_NULL) { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } else { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return v, p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) ReadBinary() ([]byte, error) { + var v []byte + if err := p.ParsePreValue(); err != nil { + return nil, err + } + f, _ := p.reader.Peek(1) + if len(f) > 0 && f[0] == JSON_QUOTE { + p.reader.ReadByte() + value, err := p.ParseBase64EncodedBody() + v = value + if err != nil { + return v, err + } + } else if len(f) > 0 && f[0] == JSON_NULL[0] { + b := make([]byte, len(JSON_NULL)) + _, err := p.reader.Read(b) + if err != nil { + return v, NewTProtocolException(err) + } + if string(b) != string(JSON_NULL) { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } else { + e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) + return v, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + + return v, p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) Flush() (err error) { + return NewTProtocolException(p.writer.Flush()) +} + +func (p *TSimpleJSONProtocol) Skip(fieldType TType) (err error) { + return SkipDefaultDepth(p, fieldType) +} + +func (p *TSimpleJSONProtocol) Transport() TTransport { + return p.trans +} + +func (p *TSimpleJSONProtocol) OutputPreValue() error { + cxt := _ParseContext(p.dumpContext[len(p.dumpContext)-1]) + switch cxt { + case _CONTEXT_IN_LIST, _CONTEXT_IN_OBJECT_NEXT_KEY: + if _, e := p.write(JSON_COMMA); e != nil { + return NewTProtocolException(e) + } + break + case _CONTEXT_IN_OBJECT_NEXT_VALUE: + if _, e := p.write(JSON_COLON); e != nil { + return NewTProtocolException(e) + } + break + } + return nil +} + +func (p *TSimpleJSONProtocol) OutputPostValue() error { + cxt := _ParseContext(p.dumpContext[len(p.dumpContext)-1]) + switch cxt { + case _CONTEXT_IN_LIST_FIRST: + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_LIST)) + break + case _CONTEXT_IN_OBJECT_FIRST: + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_OBJECT_NEXT_VALUE)) + break + case _CONTEXT_IN_OBJECT_NEXT_KEY: + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_OBJECT_NEXT_VALUE)) + break + case _CONTEXT_IN_OBJECT_NEXT_VALUE: + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_OBJECT_NEXT_KEY)) + break + } + return nil +} + +func (p *TSimpleJSONProtocol) OutputBool(value bool) error { + if e := p.OutputPreValue(); e != nil { + return e + } + var v string + if value { + v = string(JSON_TRUE) + } else { + v = string(JSON_FALSE) + } + switch _ParseContext(p.dumpContext[len(p.dumpContext)-1]) { + case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: + v = jsonQuote(v) + default: + } + if e := p.OutputStringData(v); e != nil { + return e + } + return p.OutputPostValue() +} + +func (p *TSimpleJSONProtocol) OutputNull() error { + if e := p.OutputPreValue(); e != nil { + return e + } + if _, e := p.write(JSON_NULL); e != nil { + return NewTProtocolException(e) + } + return p.OutputPostValue() +} + +func (p *TSimpleJSONProtocol) OutputF64(value float64) error { + if e := p.OutputPreValue(); e != nil { + return e + } + var v string + if math.IsNaN(value) { + v = string(JSON_QUOTE) + JSON_NAN + string(JSON_QUOTE) + } else if math.IsInf(value, 1) { + v = string(JSON_QUOTE) + JSON_INFINITY + string(JSON_QUOTE) + } else if math.IsInf(value, -1) { + v = string(JSON_QUOTE) + JSON_NEGATIVE_INFINITY + string(JSON_QUOTE) + } else { + v = strconv.FormatFloat(value, 'g', -1, 64) + switch _ParseContext(p.dumpContext[len(p.dumpContext)-1]) { + case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: + v = string(JSON_QUOTE) + v + string(JSON_QUOTE) + default: + } + } + if e := p.OutputStringData(v); e != nil { + return e + } + return p.OutputPostValue() +} + +func (p *TSimpleJSONProtocol) OutputI64(value int64) error { + if e := p.OutputPreValue(); e != nil { + return e + } + v := strconv.FormatInt(value, 10) + switch _ParseContext(p.dumpContext[len(p.dumpContext)-1]) { + case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: + v = jsonQuote(v) + default: + } + if e := p.OutputStringData(v); e != nil { + return e + } + return p.OutputPostValue() +} + +func (p *TSimpleJSONProtocol) OutputString(s string) error { + if e := p.OutputPreValue(); e != nil { + return e + } + if e := p.OutputStringData(jsonQuote(s)); e != nil { + return e + } + return p.OutputPostValue() +} + +func (p *TSimpleJSONProtocol) OutputStringData(s string) error { + _, e := p.write([]byte(s)) + return NewTProtocolException(e) +} + +func (p *TSimpleJSONProtocol) OutputObjectBegin() error { + if e := p.OutputPreValue(); e != nil { + return e + } + if _, e := p.write(JSON_LBRACE); e != nil { + return NewTProtocolException(e) + } + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_OBJECT_FIRST)) + return nil +} + +func (p *TSimpleJSONProtocol) OutputObjectEnd() error { + if _, e := p.write(JSON_RBRACE); e != nil { + return NewTProtocolException(e) + } + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + if e := p.OutputPostValue(); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) OutputListBegin() error { + if e := p.OutputPreValue(); e != nil { + return e + } + if _, e := p.write(JSON_LBRACKET); e != nil { + return NewTProtocolException(e) + } + p.dumpContext = append(p.dumpContext, int(_CONTEXT_IN_LIST_FIRST)) + return nil +} + +func (p *TSimpleJSONProtocol) OutputListEnd() error { + if _, e := p.write(JSON_RBRACKET); e != nil { + return NewTProtocolException(e) + } + p.dumpContext = p.dumpContext[:len(p.dumpContext)-1] + if e := p.OutputPostValue(); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) OutputElemListBegin(elemType TType, size int) error { + if e := p.OutputListBegin(); e != nil { + return e + } + if e := p.WriteByte(int8(elemType)); e != nil { + return e + } + if e := p.WriteI64(int64(size)); e != nil { + return e + } + return nil +} + +func (p *TSimpleJSONProtocol) ParsePreValue() error { + if e := p.readNonSignificantWhitespace(); e != nil { + return NewTProtocolException(e) + } + cxt := _ParseContext(p.parseContextStack[len(p.parseContextStack)-1]) + b, _ := p.reader.Peek(1) + switch cxt { + case _CONTEXT_IN_LIST: + if len(b) > 0 { + switch b[0] { + case JSON_RBRACKET[0]: + return nil + case JSON_COMMA[0]: + p.reader.ReadByte() + if e := p.readNonSignificantWhitespace(); e != nil { + return NewTProtocolException(e) + } + return nil + default: + e := fmt.Errorf("Expected \"]\" or \",\" in list context, but found \"%s\"", string(b)) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + break + case _CONTEXT_IN_OBJECT_NEXT_KEY: + if len(b) > 0 { + switch b[0] { + case JSON_RBRACE[0]: + return nil + case JSON_COMMA[0]: + p.reader.ReadByte() + if e := p.readNonSignificantWhitespace(); e != nil { + return NewTProtocolException(e) + } + return nil + default: + e := fmt.Errorf("Expected \"}\" or \",\" in object context, but found \"%s\"", string(b)) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + break + case _CONTEXT_IN_OBJECT_NEXT_VALUE: + if len(b) > 0 { + switch b[0] { + case JSON_COLON[0]: + p.reader.ReadByte() + if e := p.readNonSignificantWhitespace(); e != nil { + return NewTProtocolException(e) + } + return nil + default: + e := fmt.Errorf("Expected \":\" in object context, but found \"%s\"", string(b)) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + break + } + return nil +} + +func (p *TSimpleJSONProtocol) ParsePostValue() error { + if e := p.readNonSignificantWhitespace(); e != nil { + return NewTProtocolException(e) + } + cxt := _ParseContext(p.parseContextStack[len(p.parseContextStack)-1]) + switch cxt { + case _CONTEXT_IN_LIST_FIRST: + p.parseContextStack = p.parseContextStack[:len(p.parseContextStack)-1] + p.parseContextStack = append(p.parseContextStack, int(_CONTEXT_IN_LIST)) + break + case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: + p.parseContextStack = p.parseContextStack[:len(p.parseContextStack)-1] + p.parseContextStack = append(p.parseContextStack, int(_CONTEXT_IN_OBJECT_NEXT_VALUE)) + break + case _CONTEXT_IN_OBJECT_NEXT_VALUE: + p.parseContextStack = p.parseContextStack[:len(p.parseContextStack)-1] + p.parseContextStack = append(p.parseContextStack, int(_CONTEXT_IN_OBJECT_NEXT_KEY)) + break + } + return nil +} + +func (p *TSimpleJSONProtocol) readNonSignificantWhitespace() error { + for { + b, _ := p.reader.Peek(1) + if len(b) < 1 { + return nil + } + switch b[0] { + case ' ', '\r', '\n', '\t': + p.reader.ReadByte() + continue + default: + break + } + break + } + return nil +} + +func (p *TSimpleJSONProtocol) ParseStringBody() (string, error) { + line, err := p.reader.ReadString(JSON_QUOTE) + if err != nil { + return "", NewTProtocolException(err) + } + l := len(line) + // count number of escapes to see if we need to keep going + i := 1 + for ; i < l; i++ { + if line[l-i-1] != '\\' { + break + } + } + if i&0x01 == 1 { + v, ok := jsonUnquote(string(JSON_QUOTE) + line) + if !ok { + return "", NewTProtocolException(err) + } + return v, nil + } + s, err := p.ParseQuotedStringBody() + if err != nil { + return "", NewTProtocolException(err) + } + str := string(JSON_QUOTE) + line + s + v, ok := jsonUnquote(str) + if !ok { + e := fmt.Errorf("Unable to parse as JSON string %s", str) + return "", NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return v, nil +} + +func (p *TSimpleJSONProtocol) ParseQuotedStringBody() (string, error) { + line, err := p.reader.ReadString(JSON_QUOTE) + if err != nil { + return "", NewTProtocolException(err) + } + l := len(line) + // count number of escapes to see if we need to keep going + i := 1 + for ; i < l; i++ { + if line[l-i-1] != '\\' { + break + } + } + if i&0x01 == 1 { + return line, nil + } + s, err := p.ParseQuotedStringBody() + if err != nil { + return "", NewTProtocolException(err) + } + v := line + s + return v, nil +} + +func (p *TSimpleJSONProtocol) ParseBase64EncodedBody() ([]byte, error) { + line, err := p.reader.ReadBytes(JSON_QUOTE) + if err != nil { + return line, NewTProtocolException(err) + } + line2 := line[0 : len(line)-1] + l := len(line2) + if (l % 4) != 0 { + pad := 4 - (l % 4) + fill := [...]byte{'=', '=', '='} + line2 = append(line2, fill[:pad]...) + l = len(line2) + } + output := make([]byte, base64.StdEncoding.DecodedLen(l)) + n, err := base64.StdEncoding.Decode(output, line2) + return output[0:n], NewTProtocolException(err) +} + +func (p *TSimpleJSONProtocol) ParseI64() (int64, bool, error) { + if err := p.ParsePreValue(); err != nil { + return 0, false, err + } + var value int64 + var isnull bool + if p.safePeekContains(JSON_NULL) { + p.reader.Read(make([]byte, len(JSON_NULL))) + isnull = true + } else { + num, err := p.readNumeric() + isnull = (num == nil) + if !isnull { + value = num.Int64() + } + if err != nil { + return value, isnull, err + } + } + return value, isnull, p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) ParseF64() (float64, bool, error) { + if err := p.ParsePreValue(); err != nil { + return 0, false, err + } + var value float64 + var isnull bool + if p.safePeekContains(JSON_NULL) { + p.reader.Read(make([]byte, len(JSON_NULL))) + isnull = true + } else { + num, err := p.readNumeric() + isnull = (num == nil) + if !isnull { + value = num.Float64() + } + if err != nil { + return value, isnull, err + } + } + return value, isnull, p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) ParseObjectStart() (bool, error) { + if err := p.ParsePreValue(); err != nil { + return false, err + } + var b []byte + b, err := p.reader.Peek(1) + if err != nil { + return false, err + } + if len(b) > 0 && b[0] == JSON_LBRACE[0] { + p.reader.ReadByte() + p.parseContextStack = append(p.parseContextStack, int(_CONTEXT_IN_OBJECT_FIRST)) + return false, nil + } else if p.safePeekContains(JSON_NULL) { + return true, nil + } + e := fmt.Errorf("Expected '{' or null, but found '%s'", string(b)) + return false, NewTProtocolExceptionWithType(INVALID_DATA, e) +} + +func (p *TSimpleJSONProtocol) ParseObjectEnd() error { + if isNull, err := p.readIfNull(); isNull || err != nil { + return err + } + cxt := _ParseContext(p.parseContextStack[len(p.parseContextStack)-1]) + if (cxt != _CONTEXT_IN_OBJECT_FIRST) && (cxt != _CONTEXT_IN_OBJECT_NEXT_KEY) { + e := fmt.Errorf("Expected to be in the Object Context, but not in Object Context (%d)", cxt) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + } + line, err := p.reader.ReadString(JSON_RBRACE[0]) + if err != nil { + return NewTProtocolException(err) + } + for _, char := range line { + switch char { + default: + e := fmt.Errorf("Expecting end of object \"}\", but found: \"%s\"", line) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + case ' ', '\n', '\r', '\t', '}': + break + } + } + p.parseContextStack = p.parseContextStack[:len(p.parseContextStack)-1] + return p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) ParseListBegin() (isNull bool, err error) { + if e := p.ParsePreValue(); e != nil { + return false, e + } + var b []byte + b, err = p.reader.Peek(1) + if err != nil { + return false, err + } + if len(b) >= 1 && b[0] == JSON_LBRACKET[0] { + p.parseContextStack = append(p.parseContextStack, int(_CONTEXT_IN_LIST_FIRST)) + p.reader.ReadByte() + isNull = false + } else if p.safePeekContains(JSON_NULL) { + isNull = true + } else { + err = fmt.Errorf("Expected \"null\" or \"[\", received %q", b) + } + return isNull, NewTProtocolExceptionWithType(INVALID_DATA, err) +} + +func (p *TSimpleJSONProtocol) ParseElemListBegin() (elemType TType, size int, e error) { + if isNull, e := p.ParseListBegin(); isNull || e != nil { + return VOID, 0, e + } + bElemType, err := p.ReadByte() + elemType = TType(bElemType) + if err != nil { + return elemType, size, err + } + nSize, err2 := p.ReadI64() + size = int(nSize) + return elemType, size, err2 +} + +func (p *TSimpleJSONProtocol) ParseListEnd() error { + if isNull, err := p.readIfNull(); isNull || err != nil { + return err + } + cxt := _ParseContext(p.parseContextStack[len(p.parseContextStack)-1]) + if cxt != _CONTEXT_IN_LIST { + e := fmt.Errorf("Expected to be in the List Context, but not in List Context (%d)", cxt) + return NewTProtocolExceptionWithType(INVALID_DATA, e) + } + line, err := p.reader.ReadString(JSON_RBRACKET[0]) + if err != nil { + return NewTProtocolException(err) + } + for _, char := range line { + switch char { + default: + e := fmt.Errorf("Expecting end of list \"]\", but found: \"", line, "\"") + return NewTProtocolExceptionWithType(INVALID_DATA, e) + case ' ', '\n', '\r', '\t', rune(JSON_RBRACKET[0]): + break + } + } + p.parseContextStack = p.parseContextStack[:len(p.parseContextStack)-1] + if _ParseContext(p.parseContextStack[len(p.parseContextStack)-1]) == _CONTEXT_IN_TOPLEVEL { + return nil + } + return p.ParsePostValue() +} + +func (p *TSimpleJSONProtocol) readSingleValue() (interface{}, TType, error) { + e := p.readNonSignificantWhitespace() + if e != nil { + return nil, VOID, NewTProtocolException(e) + } + b, e := p.reader.Peek(1) + if len(b) > 0 { + c := b[0] + switch c { + case JSON_NULL[0]: + buf := make([]byte, len(JSON_NULL)) + _, e := p.reader.Read(buf) + if e != nil { + return nil, VOID, NewTProtocolException(e) + } + if string(JSON_NULL) != string(buf) { + e = mismatch(string(JSON_NULL), string(buf)) + return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return nil, VOID, nil + case JSON_QUOTE: + p.reader.ReadByte() + v, e := p.ParseStringBody() + if e != nil { + return v, UTF8, NewTProtocolException(e) + } + if v == JSON_INFINITY { + return INFINITY, DOUBLE, nil + } else if v == JSON_NEGATIVE_INFINITY { + return NEGATIVE_INFINITY, DOUBLE, nil + } else if v == JSON_NAN { + return NAN, DOUBLE, nil + } + return v, UTF8, nil + case JSON_TRUE[0]: + buf := make([]byte, len(JSON_TRUE)) + _, e := p.reader.Read(buf) + if e != nil { + return true, BOOL, NewTProtocolException(e) + } + if string(JSON_TRUE) != string(buf) { + e := mismatch(string(JSON_TRUE), string(buf)) + return true, BOOL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return true, BOOL, nil + case JSON_FALSE[0]: + buf := make([]byte, len(JSON_FALSE)) + _, e := p.reader.Read(buf) + if e != nil { + return false, BOOL, NewTProtocolException(e) + } + if string(JSON_FALSE) != string(buf) { + e := mismatch(string(JSON_FALSE), string(buf)) + return false, BOOL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return false, BOOL, nil + case JSON_LBRACKET[0]: + _, e := p.reader.ReadByte() + return make([]interface{}, 0), LIST, NewTProtocolException(e) + case JSON_LBRACE[0]: + _, e := p.reader.ReadByte() + return make(map[string]interface{}), STRUCT, NewTProtocolException(e) + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e', 'E', '.', '+', '-', JSON_INFINITY[0], JSON_NAN[0]: + // assume numeric + v, e := p.readNumeric() + return v, DOUBLE, e + default: + e := fmt.Errorf("Expected element in list but found '%s' while parsing JSON.", string(c)) + return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + e = fmt.Errorf("Cannot read a single element while parsing JSON.") + return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) + +} + +func (p *TSimpleJSONProtocol) readIfNull() (bool, error) { + cont := true + for cont { + b, _ := p.reader.Peek(1) + if len(b) < 1 { + return false, nil + } + switch b[0] { + default: + return false, nil + case JSON_NULL[0]: + cont = false + break + case ' ', '\n', '\r', '\t': + p.reader.ReadByte() + break + } + } + if p.safePeekContains(JSON_NULL) { + p.reader.Read(make([]byte, len(JSON_NULL))) + return true, nil + } + return false, nil +} + +func (p *TSimpleJSONProtocol) readQuoteIfNext() { + b, _ := p.reader.Peek(1) + if len(b) > 0 && b[0] == JSON_QUOTE { + p.reader.ReadByte() + } +} + +func (p *TSimpleJSONProtocol) readNumeric() (Numeric, error) { + isNull, err := p.readIfNull() + if isNull || err != nil { + return NUMERIC_NULL, err + } + hasDecimalPoint := false + nextCanBeSign := true + hasE := false + MAX_LEN := 40 + buf := bytes.NewBuffer(make([]byte, 0, MAX_LEN)) + continueFor := true + inQuotes := false + for continueFor { + c, err := p.reader.ReadByte() + if err != nil { + if err == io.EOF { + break + } + return NUMERIC_NULL, NewTProtocolException(err) + } + switch c { + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + buf.WriteByte(c) + nextCanBeSign = false + case '.': + if hasDecimalPoint { + e := fmt.Errorf("Unable to parse number with multiple decimal points '%s.'", buf.String()) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + if hasE { + e := fmt.Errorf("Unable to parse number with decimal points in the exponent '%s.'", buf.String()) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + buf.WriteByte(c) + hasDecimalPoint, nextCanBeSign = true, false + case 'e', 'E': + if hasE { + e := fmt.Errorf("Unable to parse number with multiple exponents '%s%c'", buf.String(), c) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + buf.WriteByte(c) + hasE, nextCanBeSign = true, true + case '-', '+': + if !nextCanBeSign { + e := fmt.Errorf("Negative sign within number") + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + buf.WriteByte(c) + nextCanBeSign = false + case ' ', 0, '\t', '\n', '\r', JSON_RBRACE[0], JSON_RBRACKET[0], JSON_COMMA[0], JSON_COLON[0]: + p.reader.UnreadByte() + continueFor = false + case JSON_NAN[0]: + if buf.Len() == 0 { + buffer := make([]byte, len(JSON_NAN)) + buffer[0] = c + _, e := p.reader.Read(buffer[1:]) + if e != nil { + return NUMERIC_NULL, NewTProtocolException(e) + } + if JSON_NAN != string(buffer) { + e := mismatch(JSON_NAN, string(buffer)) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + if inQuotes { + p.readQuoteIfNext() + } + return NAN, nil + } else { + e := fmt.Errorf("Unable to parse number starting with character '%c'", c) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + case JSON_INFINITY[0]: + if buf.Len() == 0 || (buf.Len() == 1 && buf.Bytes()[0] == '+') { + buffer := make([]byte, len(JSON_INFINITY)) + buffer[0] = c + _, e := p.reader.Read(buffer[1:]) + if e != nil { + return NUMERIC_NULL, NewTProtocolException(e) + } + if JSON_INFINITY != string(buffer) { + e := mismatch(JSON_INFINITY, string(buffer)) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + if inQuotes { + p.readQuoteIfNext() + } + return INFINITY, nil + } else if buf.Len() == 1 && buf.Bytes()[0] == JSON_NEGATIVE_INFINITY[0] { + buffer := make([]byte, len(JSON_NEGATIVE_INFINITY)) + buffer[0] = JSON_NEGATIVE_INFINITY[0] + buffer[1] = c + _, e := p.reader.Read(buffer[2:]) + if e != nil { + return NUMERIC_NULL, NewTProtocolException(e) + } + if JSON_NEGATIVE_INFINITY != string(buffer) { + e := mismatch(JSON_NEGATIVE_INFINITY, string(buffer)) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + if inQuotes { + p.readQuoteIfNext() + } + return NEGATIVE_INFINITY, nil + } else { + e := fmt.Errorf("Unable to parse number starting with character '%c' due to existing buffer %s", c, buf.String()) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + case JSON_QUOTE: + if !inQuotes { + inQuotes = true + } else { + break + } + default: + e := fmt.Errorf("Unable to parse number starting with character '%c'", c) + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + } + if buf.Len() == 0 { + e := fmt.Errorf("Unable to parse number from empty string ''") + return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) + } + return NewNumericFromJSONString(buf.String(), false), nil +} + +// Safely peeks into the buffer, reading only what is necessary +func (p *TSimpleJSONProtocol) safePeekContains(b []byte) bool { + for i := 0; i < len(b); i++ { + a, _ := p.reader.Peek(i + 1) + if len(a) == 0 || a[i] != b[i] { + return false + } + } + return true +} + +// Reset the context stack to its initial state. +func (p *TSimpleJSONProtocol) resetContextStack() { + p.parseContextStack = []int{int(_CONTEXT_IN_TOPLEVEL)} + p.dumpContext = []int{int(_CONTEXT_IN_TOPLEVEL)} +} + +func (p *TSimpleJSONProtocol) write(b []byte) (int, error) { + n, err := p.writer.Write(b) + if err != nil { + p.writer.Reset(p.trans) // THRIFT-3735 + } + return n, err +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol_test.go new file mode 100644 index 0000000..8f0dcc9 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_json_protocol_test.go @@ -0,0 +1,715 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "math" + "strconv" + "strings" + "testing" +) + +func TestWriteSimpleJSONProtocolBool(t *testing.T) { + thetype := "boolean" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range BOOL_VALUES { + if e := p.WriteBool(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := false + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolBool(t *testing.T) { + thetype := "boolean" + for _, value := range BOOL_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + if value { + trans.Write(JSON_TRUE) + } else { + trans.Write(JSON_FALSE) + } + trans.Flush() + s := trans.String() + v, e := p.ReadBool() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolByte(t *testing.T) { + thetype := "byte" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range BYTE_VALUES { + if e := p.WriteByte(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int8(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolByte(t *testing.T) { + thetype := "byte" + for _, value := range BYTE_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadByte() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolI16(t *testing.T) { + thetype := "int16" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT16_VALUES { + if e := p.WriteI16(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int16(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI16(t *testing.T) { + thetype := "int16" + for _, value := range INT16_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI16() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolI32(t *testing.T) { + thetype := "int32" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT32_VALUES { + if e := p.WriteI32(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int32(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI32(t *testing.T) { + thetype := "int32" + for _, value := range INT32_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.Itoa(int(value))) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestReadSimpleJSONProtocolI32Null(t *testing.T) { + thetype := "int32" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadI32() + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != 0 { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolI64(t *testing.T) { + thetype := "int64" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range INT64_VALUES { + if e := p.WriteI64(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := int64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolI64(t *testing.T) { + thetype := "int64" + for _, value := range INT64_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(strconv.FormatInt(value, 10)) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + trans.Reset() + trans.Close() + } +} + +func TestReadSimpleJSONProtocolI64Null(t *testing.T) { + thetype := "int32" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadI64() + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != 0 { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolDouble(t *testing.T) { + thetype := "double" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, -1) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s %v, wrote: %v, expected: %v", thetype, value, s, jsonQuote(JSON_NAN)) + } + } else { + if s != fmt.Sprint(value) { + t.Fatalf("Bad value for %s %v: %s", thetype, value, s) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolDouble(t *testing.T) { + thetype := "double" + for _, value := range DOUBLE_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + n := NewNumericFromDouble(value) + trans.WriteString(n.String()) + trans.Flush() + s := trans.String() + v, e := p.ReadDouble() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if math.IsInf(value, 1) { + if !math.IsInf(v, 1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsInf(value, -1) { + if !math.IsInf(v, -1) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else if math.IsNaN(value) { + if !math.IsNaN(v) { + t.Fatalf("Bad value for %s %v, wrote: %v, received: %v", thetype, value, s, v) + } + } else { + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + trans.Close() + } +} + +func TestWriteSimpleJSONProtocolString(t *testing.T) { + thetype := "string" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + for _, value := range STRING_VALUES { + if e := p.WriteString(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s[0] != '"' || s[len(s)-1] != '"' { + t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\"")) + } + v := new(string) + if err := json.Unmarshal([]byte(s), v); err != nil || *v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v) + } + trans.Reset() + } + trans.Close() +} + +func TestReadSimpleJSONProtocolString(t *testing.T) { + thetype := "string" + for _, value := range STRING_VALUES { + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(jsonQuote(value)) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != value { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() + } +} +func TestReadSimpleJSONProtocolStringNull(t *testing.T) { + thetype := "string" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + v, e := p.ReadString() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != "" { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + if e := p.WriteBinary(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) + } + s := trans.String() + if s != fmt.Sprint("\"", b64String, "\"") { + t.Fatalf("Bad value for %s %v\n wrote: %v\nexpected: %v", thetype, value, s, "\""+b64String+"\"") + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Close() +} + +func TestReadSimpleJSONProtocolBinary(t *testing.T) { + thetype := "binary" + value := protocol_bdata + b64value := make([]byte, base64.StdEncoding.EncodedLen(len(protocol_bdata))) + base64.StdEncoding.Encode(b64value, value) + b64String := string(b64value) + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(jsonQuote(b64String)) + trans.Flush() + s := trans.String() + v, e := p.ReadBinary() + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if len(v) != len(value) { + t.Fatalf("Bad value for %s value length %v, wrote: %v, received length: %v", thetype, len(value), s, len(v)) + } + for i := 0; i < len(v); i++ { + if v[i] != value[i] { + t.Fatalf("Bad value for %s at index %d value %v, wrote: %v, received: %v", thetype, i, value[i], s, v[i]) + } + } + v1 := new(string) + if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != b64String { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) + } + trans.Reset() + trans.Close() +} + +func TestReadSimpleJSONProtocolBinaryNull(t *testing.T) { + thetype := "binary" + value := "null" + + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + trans.WriteString(value) + trans.Flush() + s := trans.String() + b, e := p.ReadBinary() + v := string(b) + + if e != nil { + t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) + } + if v != "" { + t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) + } + trans.Reset() + trans.Close() +} + +func TestWriteSimpleJSONProtocolList(t *testing.T) { + thetype := "list" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteListBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteListEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("List must be at least of length two to include metadata") + } + if int(l[0].(float64)) != DOUBLE { + t.Fatal("Invalid type for list, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for list, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteSimpleJSONProtocolSet(t *testing.T) { + thetype := "set" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteSetBegin(TType(DOUBLE), len(DOUBLE_VALUES)) + for _, value := range DOUBLE_VALUES { + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteSetEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + str1 := new([]interface{}) + err := json.Unmarshal([]byte(str), str1) + if err != nil { + t.Fatalf("Unable to decode %s, wrote: %s", thetype, str) + } + l := *str1 + if len(l) < 2 { + t.Fatalf("Set must be at least of length two to include metadata") + } + if int(l[0].(float64)) != DOUBLE { + t.Fatal("Invalid type for set, expected: ", DOUBLE, ", but was: ", l[0]) + } + if int(l[1].(float64)) != len(DOUBLE_VALUES) { + t.Fatal("Invalid length for set, expected: ", len(DOUBLE_VALUES), ", but was: ", l[1]) + } + for k, value := range DOUBLE_VALUES { + s := l[k+2] + if math.IsInf(value, 1) { + if s.(string) != JSON_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_INFINITY), str) + } + } else if math.IsInf(value, 0) { + if s.(string) != JSON_NEGATIVE_INFINITY { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY), str) + } + } else if math.IsNaN(value) { + if s.(string) != JSON_NAN { + t.Fatalf("Bad value for %s at index %v %v, wrote: %q, expected: %q, originally wrote: %q", thetype, k, value, s, jsonQuote(JSON_NAN), str) + } + } else { + if s.(float64) != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s'", thetype, value, s) + } + } + trans.Reset() + } + trans.Close() +} + +func TestWriteSimpleJSONProtocolMap(t *testing.T) { + thetype := "map" + trans := NewTMemoryBuffer() + p := NewTSimpleJSONProtocol(trans) + p.WriteMapBegin(TType(I32), TType(DOUBLE), len(DOUBLE_VALUES)) + for k, value := range DOUBLE_VALUES { + if e := p.WriteI32(int32(k)); e != nil { + t.Fatalf("Unable to write %s key int32 value %v due to error: %s", thetype, k, e.Error()) + } + if e := p.WriteDouble(value); e != nil { + t.Fatalf("Unable to write %s value float64 value %v due to error: %s", thetype, value, e.Error()) + } + } + p.WriteMapEnd() + if e := p.Flush(); e != nil { + t.Fatalf("Unable to write %s due to error flushing: %s", thetype, e.Error()) + } + str := trans.String() + if str[0] != '[' || str[len(str)-1] != ']' { + t.Fatalf("Bad value for %s, wrote: %q, in go: %q", thetype, str, DOUBLE_VALUES) + } + l := strings.Split(str[1:len(str)-1], ",") + if len(l) < 3 { + t.Fatal("Expected list of at least length 3 for map for metadata, but was of length ", len(l)) + } + expectedKeyType, _ := strconv.Atoi(l[0]) + expectedValueType, _ := strconv.Atoi(l[1]) + expectedSize, _ := strconv.Atoi(l[2]) + if expectedKeyType != I32 { + t.Fatal("Expected map key type ", I32, ", but was ", l[0]) + } + if expectedValueType != DOUBLE { + t.Fatal("Expected map value type ", DOUBLE, ", but was ", l[1]) + } + if expectedSize != len(DOUBLE_VALUES) { + t.Fatal("Expected map size of ", len(DOUBLE_VALUES), ", but was ", l[2]) + } + for k, value := range DOUBLE_VALUES { + strk := l[k*2+3] + strv := l[k*2+4] + ik, err := strconv.Atoi(strk) + if err != nil { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v, error: %s", thetype, k, strk, string(k), err.Error()) + } + if ik != k { + t.Fatalf("Bad value for %s index %v, wrote: %v, expected: %v", thetype, k, strk, k) + } + s := strv + if math.IsInf(value, 1) { + if s != jsonQuote(JSON_INFINITY) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_INFINITY)) + } + } else if math.IsInf(value, 0) { + if s != jsonQuote(JSON_NEGATIVE_INFINITY) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NEGATIVE_INFINITY)) + } + } else if math.IsNaN(value) { + if s != jsonQuote(JSON_NAN) { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected: %v", thetype, k, value, s, jsonQuote(JSON_NAN)) + } + } else { + expected := strconv.FormatFloat(value, 'g', 10, 64) + if s != expected { + t.Fatalf("Bad value for %s at index %v %v, wrote: %v, expected %v", thetype, k, value, s, expected) + } + v := float64(0) + if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { + t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) + } + } + trans.Reset() + } + trans.Close() +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_server.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_server.go new file mode 100644 index 0000000..6b3811e --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/simple_server.go @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "log" + "runtime/debug" + "sync/atomic" +) + +// Simple, non-concurrent server for testing. +type TSimpleServer struct { + quit chan struct{} + stopped int64 + + processorFactory TProcessorFactory + serverTransport TServerTransport + inputTransportFactory TTransportFactory + outputTransportFactory TTransportFactory + inputProtocolFactory TProtocolFactory + outputProtocolFactory TProtocolFactory +} + +func NewTSimpleServer2(processor TProcessor, serverTransport TServerTransport) *TSimpleServer { + return NewTSimpleServerFactory2(NewTProcessorFactory(processor), serverTransport) +} + +func NewTSimpleServer4(processor TProcessor, serverTransport TServerTransport, transportFactory TTransportFactory, protocolFactory TProtocolFactory) *TSimpleServer { + return NewTSimpleServerFactory4(NewTProcessorFactory(processor), + serverTransport, + transportFactory, + protocolFactory, + ) +} + +func NewTSimpleServer6(processor TProcessor, serverTransport TServerTransport, inputTransportFactory TTransportFactory, outputTransportFactory TTransportFactory, inputProtocolFactory TProtocolFactory, outputProtocolFactory TProtocolFactory) *TSimpleServer { + return NewTSimpleServerFactory6(NewTProcessorFactory(processor), + serverTransport, + inputTransportFactory, + outputTransportFactory, + inputProtocolFactory, + outputProtocolFactory, + ) +} + +func NewTSimpleServerFactory2(processorFactory TProcessorFactory, serverTransport TServerTransport) *TSimpleServer { + return NewTSimpleServerFactory6(processorFactory, + serverTransport, + NewTTransportFactory(), + NewTTransportFactory(), + NewTBinaryProtocolFactoryDefault(), + NewTBinaryProtocolFactoryDefault(), + ) +} + +func NewTSimpleServerFactory4(processorFactory TProcessorFactory, serverTransport TServerTransport, transportFactory TTransportFactory, protocolFactory TProtocolFactory) *TSimpleServer { + return NewTSimpleServerFactory6(processorFactory, + serverTransport, + transportFactory, + transportFactory, + protocolFactory, + protocolFactory, + ) +} + +func NewTSimpleServerFactory6(processorFactory TProcessorFactory, serverTransport TServerTransport, inputTransportFactory TTransportFactory, outputTransportFactory TTransportFactory, inputProtocolFactory TProtocolFactory, outputProtocolFactory TProtocolFactory) *TSimpleServer { + return &TSimpleServer{ + processorFactory: processorFactory, + serverTransport: serverTransport, + inputTransportFactory: inputTransportFactory, + outputTransportFactory: outputTransportFactory, + inputProtocolFactory: inputProtocolFactory, + outputProtocolFactory: outputProtocolFactory, + quit: make(chan struct{}, 1), + } +} + +func (p *TSimpleServer) ProcessorFactory() TProcessorFactory { + return p.processorFactory +} + +func (p *TSimpleServer) ServerTransport() TServerTransport { + return p.serverTransport +} + +func (p *TSimpleServer) InputTransportFactory() TTransportFactory { + return p.inputTransportFactory +} + +func (p *TSimpleServer) OutputTransportFactory() TTransportFactory { + return p.outputTransportFactory +} + +func (p *TSimpleServer) InputProtocolFactory() TProtocolFactory { + return p.inputProtocolFactory +} + +func (p *TSimpleServer) OutputProtocolFactory() TProtocolFactory { + return p.outputProtocolFactory +} + +func (p *TSimpleServer) Listen() error { + return p.serverTransport.Listen() +} + +func (p *TSimpleServer) AcceptLoop() error { + for { + client, err := p.serverTransport.Accept() + if err != nil { + select { + case <-p.quit: + return nil + default: + } + return err + } + if client != nil { + go func() { + if err := p.processRequests(client); err != nil { + log.Println("error processing request:", err) + } + }() + } + } +} + +func (p *TSimpleServer) Serve() error { + err := p.Listen() + if err != nil { + return err + } + p.AcceptLoop() + return nil +} + +func (p *TSimpleServer) Stop() error { + if atomic.CompareAndSwapInt64(&p.stopped, 0, 1) { + p.quit <- struct{}{} + p.serverTransport.Interrupt() + } + return nil +} + +func (p *TSimpleServer) processRequests(client TTransport) error { + processor := p.processorFactory.GetProcessor(client) + inputTransport := p.inputTransportFactory.GetTransport(client) + outputTransport := p.outputTransportFactory.GetTransport(client) + inputProtocol := p.inputProtocolFactory.GetProtocol(inputTransport) + outputProtocol := p.outputProtocolFactory.GetProtocol(outputTransport) + defer func() { + if e := recover(); e != nil { + log.Printf("panic in processor: %s: %s", e, debug.Stack()) + } + }() + if inputTransport != nil { + defer inputTransport.Close() + } + if outputTransport != nil { + defer outputTransport.Close() + } + for { + ok, err := processor.Process(inputProtocol, outputProtocol) + if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE { + return nil + } else if err != nil { + log.Printf("error processing request: %s", err) + return err + } + if !ok { + break + } + } + return nil +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/socket.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/socket.go new file mode 100644 index 0000000..82e28b4 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/socket.go @@ -0,0 +1,166 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "net" + "time" +) + +type TSocket struct { + conn net.Conn + addr net.Addr + timeout time.Duration +} + +// NewTSocket creates a net.Conn-backed TTransport, given a host and port +// +// Example: +// trans, err := thrift.NewTSocket("localhost:9090") +func NewTSocket(hostPort string) (*TSocket, error) { + return NewTSocketTimeout(hostPort, 0) +} + +// NewTSocketTimeout creates a net.Conn-backed TTransport, given a host and port +// it also accepts a timeout as a time.Duration +func NewTSocketTimeout(hostPort string, timeout time.Duration) (*TSocket, error) { + //conn, err := net.DialTimeout(network, address, timeout) + addr, err := net.ResolveTCPAddr("tcp", hostPort) + if err != nil { + return nil, err + } + return NewTSocketFromAddrTimeout(addr, timeout), nil +} + +// Creates a TSocket from a net.Addr +func NewTSocketFromAddrTimeout(addr net.Addr, timeout time.Duration) *TSocket { + return &TSocket{addr: addr, timeout: timeout} +} + +// Creates a TSocket from an existing net.Conn +func NewTSocketFromConnTimeout(conn net.Conn, timeout time.Duration) *TSocket { + return &TSocket{conn: conn, addr: conn.RemoteAddr(), timeout: timeout} +} + +// Sets the socket timeout +func (p *TSocket) SetTimeout(timeout time.Duration) error { + p.timeout = timeout + return nil +} + +func (p *TSocket) pushDeadline(read, write bool) { + var t time.Time + if p.timeout > 0 { + t = time.Now().Add(time.Duration(p.timeout)) + } + if read && write { + p.conn.SetDeadline(t) + } else if read { + p.conn.SetReadDeadline(t) + } else if write { + p.conn.SetWriteDeadline(t) + } +} + +// Connects the socket, creating a new socket object if necessary. +func (p *TSocket) Open() error { + if p.IsOpen() { + return NewTTransportException(ALREADY_OPEN, "Socket already connected.") + } + if p.addr == nil { + return NewTTransportException(NOT_OPEN, "Cannot open nil address.") + } + if len(p.addr.Network()) == 0 { + return NewTTransportException(NOT_OPEN, "Cannot open bad network name.") + } + if len(p.addr.String()) == 0 { + return NewTTransportException(NOT_OPEN, "Cannot open bad address.") + } + var err error + if p.conn, err = net.DialTimeout(p.addr.Network(), p.addr.String(), p.timeout); err != nil { + return NewTTransportException(NOT_OPEN, err.Error()) + } + return nil +} + +// Retrieve the underlying net.Conn +func (p *TSocket) Conn() net.Conn { + return p.conn +} + +// Returns true if the connection is open +func (p *TSocket) IsOpen() bool { + if p.conn == nil { + return false + } + return true +} + +// Closes the socket. +func (p *TSocket) Close() error { + // Close the socket + if p.conn != nil { + err := p.conn.Close() + if err != nil { + return err + } + p.conn = nil + } + return nil +} + +//Returns the remote address of the socket. +func (p *TSocket) Addr() net.Addr { + return p.addr +} + +func (p *TSocket) Read(buf []byte) (int, error) { + if !p.IsOpen() { + return 0, NewTTransportException(NOT_OPEN, "Connection not open") + } + p.pushDeadline(true, false) + n, err := p.conn.Read(buf) + return n, NewTTransportExceptionFromError(err) +} + +func (p *TSocket) Write(buf []byte) (int, error) { + if !p.IsOpen() { + return 0, NewTTransportException(NOT_OPEN, "Connection not open") + } + p.pushDeadline(false, true) + return p.conn.Write(buf) +} + +func (p *TSocket) Flush() error { + return nil +} + +func (p *TSocket) Interrupt() error { + if !p.IsOpen() { + return nil + } + return p.conn.Close() +} + +func (p *TSocket) RemainingBytes() (num_bytes uint64) { + const maxSize = ^uint64(0) + return maxSize // the thruth is, we just don't know unless framed is used +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_server_socket.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_server_socket.go new file mode 100644 index 0000000..58f859b --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_server_socket.go @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "net" + "time" + "crypto/tls" +) + +type TSSLServerSocket struct { + listener net.Listener + addr net.Addr + clientTimeout time.Duration + interrupted bool + cfg *tls.Config +} + +func NewTSSLServerSocket(listenAddr string, cfg *tls.Config) (*TSSLServerSocket, error) { + return NewTSSLServerSocketTimeout(listenAddr, cfg, 0) +} + +func NewTSSLServerSocketTimeout(listenAddr string, cfg *tls.Config, clientTimeout time.Duration) (*TSSLServerSocket, error) { + addr, err := net.ResolveTCPAddr("tcp", listenAddr) + if err != nil { + return nil, err + } + return &TSSLServerSocket{addr: addr, clientTimeout: clientTimeout, cfg: cfg}, nil +} + +func (p *TSSLServerSocket) Listen() error { + if p.IsListening() { + return nil + } + l, err := tls.Listen(p.addr.Network(), p.addr.String(), p.cfg) + if err != nil { + return err + } + p.listener = l + return nil +} + +func (p *TSSLServerSocket) Accept() (TTransport, error) { + if p.interrupted { + return nil, errTransportInterrupted + } + if p.listener == nil { + return nil, NewTTransportException(NOT_OPEN, "No underlying server socket") + } + conn, err := p.listener.Accept() + if err != nil { + return nil, NewTTransportExceptionFromError(err) + } + return NewTSSLSocketFromConnTimeout(conn, p.cfg, p.clientTimeout), nil +} + +// Checks whether the socket is listening. +func (p *TSSLServerSocket) IsListening() bool { + return p.listener != nil +} + +// Connects the socket, creating a new socket object if necessary. +func (p *TSSLServerSocket) Open() error { + if p.IsListening() { + return NewTTransportException(ALREADY_OPEN, "Server socket already open") + } + if l, err := tls.Listen(p.addr.Network(), p.addr.String(), p.cfg); err != nil { + return err + } else { + p.listener = l + } + return nil +} + +func (p *TSSLServerSocket) Addr() net.Addr { + return p.addr +} + +func (p *TSSLServerSocket) Close() error { + defer func() { + p.listener = nil + }() + if p.IsListening() { + return p.listener.Close() + } + return nil +} + +func (p *TSSLServerSocket) Interrupt() error { + p.interrupted = true + return nil +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_socket.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_socket.go new file mode 100644 index 0000000..04d3850 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/ssl_socket.go @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "crypto/tls" + "net" + "time" +) + +type TSSLSocket struct { + conn net.Conn + // hostPort contains host:port (e.g. "asdf.com:12345"). The field is + // only valid if addr is nil. + hostPort string + // addr is nil when hostPort is not "", and is only used when the + // TSSLSocket is constructed from a net.Addr. + addr net.Addr + timeout time.Duration + cfg *tls.Config +} + +// NewTSSLSocket creates a net.Conn-backed TTransport, given a host and port and tls Configuration +// +// Example: +// trans, err := thrift.NewTSSLSocket("localhost:9090", nil) +func NewTSSLSocket(hostPort string, cfg *tls.Config) (*TSSLSocket, error) { + return NewTSSLSocketTimeout(hostPort, cfg, 0) +} + +// NewTSSLSocketTimeout creates a net.Conn-backed TTransport, given a host and port +// it also accepts a tls Configuration and a timeout as a time.Duration +func NewTSSLSocketTimeout(hostPort string, cfg *tls.Config, timeout time.Duration) (*TSSLSocket, error) { + return &TSSLSocket{hostPort: hostPort, timeout: timeout, cfg: cfg}, nil +} + +// Creates a TSSLSocket from a net.Addr +func NewTSSLSocketFromAddrTimeout(addr net.Addr, cfg *tls.Config, timeout time.Duration) *TSSLSocket { + return &TSSLSocket{addr: addr, timeout: timeout, cfg: cfg} +} + +// Creates a TSSLSocket from an existing net.Conn +func NewTSSLSocketFromConnTimeout(conn net.Conn, cfg *tls.Config, timeout time.Duration) *TSSLSocket { + return &TSSLSocket{conn: conn, addr: conn.RemoteAddr(), timeout: timeout, cfg: cfg} +} + +// Sets the socket timeout +func (p *TSSLSocket) SetTimeout(timeout time.Duration) error { + p.timeout = timeout + return nil +} + +func (p *TSSLSocket) pushDeadline(read, write bool) { + var t time.Time + if p.timeout > 0 { + t = time.Now().Add(time.Duration(p.timeout)) + } + if read && write { + p.conn.SetDeadline(t) + } else if read { + p.conn.SetReadDeadline(t) + } else if write { + p.conn.SetWriteDeadline(t) + } +} + +// Connects the socket, creating a new socket object if necessary. +func (p *TSSLSocket) Open() error { + var err error + // If we have a hostname, we need to pass the hostname to tls.Dial for + // certificate hostname checks. + if p.hostPort != "" { + if p.conn, err = tls.Dial("tcp", p.hostPort, p.cfg); err != nil { + return NewTTransportException(NOT_OPEN, err.Error()) + } + } else { + if p.IsOpen() { + return NewTTransportException(ALREADY_OPEN, "Socket already connected.") + } + if p.addr == nil { + return NewTTransportException(NOT_OPEN, "Cannot open nil address.") + } + if len(p.addr.Network()) == 0 { + return NewTTransportException(NOT_OPEN, "Cannot open bad network name.") + } + if len(p.addr.String()) == 0 { + return NewTTransportException(NOT_OPEN, "Cannot open bad address.") + } + if p.conn, err = tls.Dial(p.addr.Network(), p.addr.String(), p.cfg); err != nil { + return NewTTransportException(NOT_OPEN, err.Error()) + } + } + return nil +} + +// Retrieve the underlying net.Conn +func (p *TSSLSocket) Conn() net.Conn { + return p.conn +} + +// Returns true if the connection is open +func (p *TSSLSocket) IsOpen() bool { + if p.conn == nil { + return false + } + return true +} + +// Closes the socket. +func (p *TSSLSocket) Close() error { + // Close the socket + if p.conn != nil { + err := p.conn.Close() + if err != nil { + return err + } + p.conn = nil + } + return nil +} + +func (p *TSSLSocket) Read(buf []byte) (int, error) { + if !p.IsOpen() { + return 0, NewTTransportException(NOT_OPEN, "Connection not open") + } + p.pushDeadline(true, false) + n, err := p.conn.Read(buf) + return n, NewTTransportExceptionFromError(err) +} + +func (p *TSSLSocket) Write(buf []byte) (int, error) { + if !p.IsOpen() { + return 0, NewTTransportException(NOT_OPEN, "Connection not open") + } + p.pushDeadline(false, true) + return p.conn.Write(buf) +} + +func (p *TSSLSocket) Flush() error { + return nil +} + +func (p *TSSLSocket) Interrupt() error { + if !p.IsOpen() { + return nil + } + return p.conn.Close() +} + +func (p *TSSLSocket) RemainingBytes() (num_bytes uint64) { + const maxSize = ^uint64(0) + return maxSize // the thruth is, we just don't know unless framed is used +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport.go new file mode 100644 index 0000000..4538996 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport.go @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" + "io" +) + +var errTransportInterrupted = errors.New("Transport Interrupted") + +type Flusher interface { + Flush() (err error) +} + +type ReadSizeProvider interface { + RemainingBytes() (num_bytes uint64) +} + + +// Encapsulates the I/O layer +type TTransport interface { + io.ReadWriteCloser + Flusher + ReadSizeProvider + + // Opens the transport for communication + Open() error + + // Returns true if the transport is open + IsOpen() bool +} + +type stringWriter interface { + WriteString(s string) (n int, err error) +} + + +// This is "enchanced" transport with extra capabilities. You need to use one of these +// to construct protocol. +// Notably, TSocket does not implement this interface, and it is always a mistake to use +// TSocket directly in protocol. +type TRichTransport interface { + io.ReadWriter + io.ByteReader + io.ByteWriter + stringWriter + Flusher + ReadSizeProvider +} + diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception.go new file mode 100644 index 0000000..9505b44 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception.go @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "errors" + "io" +) + +type timeoutable interface { + Timeout() bool +} + +// Thrift Transport exception +type TTransportException interface { + TException + TypeId() int + Err() error +} + +const ( + UNKNOWN_TRANSPORT_EXCEPTION = 0 + NOT_OPEN = 1 + ALREADY_OPEN = 2 + TIMED_OUT = 3 + END_OF_FILE = 4 +) + +type tTransportException struct { + typeId int + err error +} + +func (p *tTransportException) TypeId() int { + return p.typeId +} + +func (p *tTransportException) Error() string { + return p.err.Error() +} + +func (p *tTransportException) Err() error { + return p.err +} + +func NewTTransportException(t int, e string) TTransportException { + return &tTransportException{typeId: t, err: errors.New(e)} +} + +func NewTTransportExceptionFromError(e error) TTransportException { + if e == nil { + return nil + } + + if t, ok := e.(TTransportException); ok { + return t + } + + switch v := e.(type) { + case TTransportException: + return v + case timeoutable: + if v.Timeout() { + return &tTransportException{typeId: TIMED_OUT, err: e} + } + } + + if e == io.EOF { + return &tTransportException{typeId: END_OF_FILE, err: e} + } + + return &tTransportException{typeId: UNKNOWN_TRANSPORT_EXCEPTION, err: e} +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception_test.go new file mode 100644 index 0000000..b44314f --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_exception_test.go @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "fmt" + "io" + + "testing" +) + +type timeout struct{ timedout bool } + +func (t *timeout) Timeout() bool { + return t.timedout +} + +func (t *timeout) Error() string { + return fmt.Sprintf("Timeout: %v", t.timedout) +} + +func TestTExceptionTimeout(t *testing.T) { + timeout := &timeout{true} + exception := NewTTransportExceptionFromError(timeout) + if timeout.Error() != exception.Error() { + t.Fatalf("Error did not match: expected %q, got %q", timeout.Error(), exception.Error()) + } + + if exception.TypeId() != TIMED_OUT { + t.Fatalf("TypeId was not TIMED_OUT: expected %v, got %v", TIMED_OUT, exception.TypeId()) + } +} + +func TestTExceptionEOF(t *testing.T) { + exception := NewTTransportExceptionFromError(io.EOF) + if io.EOF.Error() != exception.Error() { + t.Fatalf("Error did not match: expected %q, got %q", io.EOF.Error(), exception.Error()) + } + + if exception.TypeId() != END_OF_FILE { + t.Fatalf("TypeId was not END_OF_FILE: expected %v, got %v", END_OF_FILE, exception.TypeId()) + } +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_factory.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_factory.go new file mode 100644 index 0000000..533d1b4 --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_factory.go @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Factory class used to create wrapped instance of Transports. +// This is used primarily in servers, which get Transports from +// a ServerTransport and then may want to mutate them (i.e. create +// a BufferedTransport from the underlying base transport) +type TTransportFactory interface { + GetTransport(trans TTransport) TTransport +} + +type tTransportFactory struct{} + +// Return a wrapped instance of the base Transport. +func (p *tTransportFactory) GetTransport(trans TTransport) TTransport { + return trans +} + +func NewTTransportFactory() TTransportFactory { + return &tTransportFactory{} +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_test.go new file mode 100644 index 0000000..864958a --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/transport_test.go @@ -0,0 +1,176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "io" + "net" + "strconv" + "testing" +) + +const TRANSPORT_BINARY_DATA_SIZE = 4096 + +var ( + transport_bdata []byte // test data for writing; same as data + transport_header map[string]string +) + +func init() { + transport_bdata = make([]byte, TRANSPORT_BINARY_DATA_SIZE) + for i := 0; i < TRANSPORT_BINARY_DATA_SIZE; i++ { + transport_bdata[i] = byte((i + 'a') % 255) + } + transport_header = map[string]string{"key": "User-Agent", + "value": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"} +} + +func TransportTest(t *testing.T, writeTrans TTransport, readTrans TTransport) { + buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE) + if !writeTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans) + } + if !readTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", readTrans, readTrans) + } + _, err := writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err) + } + n, err := io.ReadFull(readTrans, buf) + if err != nil { + t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err) + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } + _, err = writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data 2 of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write binary data 2: %s", writeTrans, err) + } + buf = make([]byte, TRANSPORT_BINARY_DATA_SIZE) + read := 1 + for n = 0; n < TRANSPORT_BINARY_DATA_SIZE && read != 0; { + read, err = readTrans.Read(buf[n:]) + if err != nil { + t.Errorf("Transport %T cannot read binary data 2 of total length %d from offset %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, n, err) + } + n += read + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data 2", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } +} + +func TransportHeaderTest(t *testing.T, writeTrans TTransport, readTrans TTransport) { + buf := make([]byte, TRANSPORT_BINARY_DATA_SIZE) + if !writeTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", writeTrans, writeTrans) + } + if !readTrans.IsOpen() { + t.Fatalf("Transport %T not open: %s", readTrans, readTrans) + } + // Need to assert type of TTransport to THttpClient to expose the Setter + httpWPostTrans := writeTrans.(*THttpClient) + httpWPostTrans.SetHeader(transport_header["key"], transport_header["value"]) + + _, err := writeTrans.Write(transport_bdata) + if err != nil { + t.Fatalf("Transport %T cannot write binary data of length %d: %s", writeTrans, len(transport_bdata), err) + } + err = writeTrans.Flush() + if err != nil { + t.Fatalf("Transport %T cannot flush write of binary data: %s", writeTrans, err) + } + // Need to assert type of TTransport to THttpClient to expose the Getter + httpRPostTrans := readTrans.(*THttpClient) + readHeader := httpRPostTrans.GetHeader(transport_header["key"]) + if err != nil { + t.Errorf("Transport %T cannot read HTTP Header Value", httpRPostTrans) + } + + if transport_header["value"] != readHeader { + t.Errorf("Expected HTTP Header Value %s, got %s", transport_header["value"], readHeader) + } + n, err := io.ReadFull(readTrans, buf) + if err != nil { + t.Errorf("Transport %T cannot read binary data of length %d: %s", readTrans, TRANSPORT_BINARY_DATA_SIZE, err) + } + if n != TRANSPORT_BINARY_DATA_SIZE { + t.Errorf("Transport %T read only %d instead of %d bytes of binary data", readTrans, n, TRANSPORT_BINARY_DATA_SIZE) + } + for k, v := range buf { + if v != transport_bdata[k] { + t.Fatalf("Transport %T read %d instead of %d for index %d of binary data 2", readTrans, v, transport_bdata[k], k) + } + } +} + +func CloseTransports(t *testing.T, readTrans TTransport, writeTrans TTransport) { + err := readTrans.Close() + if err != nil { + t.Errorf("Transport %T cannot close read transport: %s", readTrans, err) + } + if writeTrans != readTrans { + err = writeTrans.Close() + if err != nil { + t.Errorf("Transport %T cannot close write transport: %s", writeTrans, err) + } + } +} + +func FindAvailableTCPServerPort(startPort int) (net.Addr, error) { + for i := startPort; i < 65535; i++ { + s := "127.0.0.1:" + strconv.Itoa(i) + l, err := net.Listen("tcp", s) + if err == nil { + l.Close() + return net.ResolveTCPAddr("tcp", s) + } + } + return nil, NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "Could not find available server port") +} + +func valueInSlice(value string, slice []string) bool { + for _, v := range slice { + if value == v { + return true + } + } + return false +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/type.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/type.go new file mode 100644 index 0000000..4292ffc --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/type.go @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +// Type constants in the Thrift protocol +type TType byte + +const ( + STOP = 0 + VOID = 1 + BOOL = 2 + BYTE = 3 + I08 = 3 + DOUBLE = 4 + I16 = 6 + I32 = 8 + I64 = 10 + STRING = 11 + UTF7 = 11 + STRUCT = 12 + MAP = 13 + SET = 14 + LIST = 15 + UTF8 = 16 + UTF16 = 17 + //BINARY = 18 wrong and unusued +) + +var typeNames = map[int]string{ + STOP: "STOP", + VOID: "VOID", + BOOL: "BOOL", + BYTE: "BYTE", + DOUBLE: "DOUBLE", + I16: "I16", + I32: "I32", + I64: "I64", + STRING: "STRING", + STRUCT: "STRUCT", + MAP: "MAP", + SET: "SET", + LIST: "LIST", + UTF8: "UTF8", + UTF16: "UTF16", +} + +func (p TType) String() string { + if s, ok := typeNames[int(p)]; ok { + return s + } + return "Unknown" +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport.go new file mode 100644 index 0000000..e47455f --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport.go @@ -0,0 +1,117 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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 thrift + +import ( + "compress/zlib" + "io" + "log" +) + +// TZlibTransportFactory is a factory for TZlibTransport instances +type TZlibTransportFactory struct { + level int +} + +// TZlibTransport is a TTransport implementation that makes use of zlib compression. +type TZlibTransport struct { + reader io.ReadCloser + transport TTransport + writer *zlib.Writer +} + +// GetTransport constructs a new instance of NewTZlibTransport +func (p *TZlibTransportFactory) GetTransport(trans TTransport) TTransport { + t, _ := NewTZlibTransport(trans, p.level) + return t +} + +// NewTZlibTransportFactory constructs a new instance of NewTZlibTransportFactory +func NewTZlibTransportFactory(level int) *TZlibTransportFactory { + return &TZlibTransportFactory{level: level} +} + +// NewTZlibTransport constructs a new instance of TZlibTransport +func NewTZlibTransport(trans TTransport, level int) (*TZlibTransport, error) { + w, err := zlib.NewWriterLevel(trans, level) + if err != nil { + log.Println(err) + return nil, err + } + + return &TZlibTransport{ + writer: w, + transport: trans, + }, nil +} + +// Close closes the reader and writer (flushing any unwritten data) and closes +// the underlying transport. +func (z *TZlibTransport) Close() error { + if z.reader != nil { + if err := z.reader.Close(); err != nil { + return err + } + } + if err := z.writer.Close(); err != nil { + return err + } + return z.transport.Close() +} + +// Flush flushes the writer and its underlying transport. +func (z *TZlibTransport) Flush() error { + if err := z.writer.Flush(); err != nil { + return err + } + return z.transport.Flush() +} + +// IsOpen returns true if the transport is open +func (z *TZlibTransport) IsOpen() bool { + return z.transport.IsOpen() +} + +// Open opens the transport for communication +func (z *TZlibTransport) Open() error { + return z.transport.Open() +} + +func (z *TZlibTransport) Read(p []byte) (int, error) { + if z.reader == nil { + r, err := zlib.NewReader(z.transport) + if err != nil { + return 0, NewTTransportExceptionFromError(err) + } + z.reader = r + } + + return z.reader.Read(p) +} + +// RemainingBytes returns the size in bytes of the data that is still to be +// read. +func (z *TZlibTransport) RemainingBytes() uint64 { + return z.transport.RemainingBytes() +} + +func (z *TZlibTransport) Write(p []byte) (int, error) { + return z.writer.Write(p) +} diff --git a/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport_test.go b/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport_test.go new file mode 100644 index 0000000..f57610c --- /dev/null +++ b/vendor/git.apache.org/thrift.git/lib/go/thrift/zlib_transport_test.go @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 thrift + +import ( + "compress/zlib" + "testing" +) + +func TestZlibTransport(t *testing.T) { + trans, err := NewTZlibTransport(NewTMemoryBuffer(), zlib.BestCompression) + if err != nil { + t.Fatal(err) + } + TransportTest(t, trans, trans) +} diff --git a/vendor/vendor.json b/vendor/vendor.json new file mode 100644 index 0000000..3b5d962 --- /dev/null +++ b/vendor/vendor.json @@ -0,0 +1,18 @@ +{ + "comment": "", + "ignore": "", + "package": [ + { + "checksumSHA1": "ok7Zbwi2IVOuN4hKybLLU9CjsQI=", + "path": "errors", + "revision": "" + }, + { + "checksumSHA1": "6Lb7h/mj8rBtSQPV1O3RxxfBvNE=", + "path": "git.apache.org/thrift.git/lib/go/thrift", + "revision": "bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c", + "revisionTime": "2016-07-24T10:11:25Z" + } + ], + "rootPath": "github.com/rdelval/gorealis" +}