diff --git a/go/vt/proto/vtadmin/vtadmin.pb.go b/go/vt/proto/vtadmin/vtadmin.pb.go index c897510cfdd..09506b95a19 100644 --- a/go/vt/proto/vtadmin/vtadmin.pb.go +++ b/go/vt/proto/vtadmin/vtadmin.pb.go @@ -56,7 +56,7 @@ func (x Tablet_ServingState) String() string { } func (Tablet_ServingState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{3, 0} + return fileDescriptor_609739e22a0a50b3, []int{4, 0} } // Cluster represents information about a Vitess cluster. @@ -115,6 +115,63 @@ func (m *Cluster) GetName() string { return "" } +type ClusterWorkflows struct { + Workflows []*Workflow `protobuf:"bytes,1,rep,name=workflows,proto3" json:"workflows,omitempty"` + // Warnings is a list of non-fatal errors encountered when fetching + // workflows for a particular cluster. + Warnings []string `protobuf:"bytes,2,rep,name=warnings,proto3" json:"warnings,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterWorkflows) Reset() { *m = ClusterWorkflows{} } +func (m *ClusterWorkflows) String() string { return proto.CompactTextString(m) } +func (*ClusterWorkflows) ProtoMessage() {} +func (*ClusterWorkflows) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{1} +} +func (m *ClusterWorkflows) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterWorkflows) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterWorkflows.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClusterWorkflows) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterWorkflows.Merge(m, src) +} +func (m *ClusterWorkflows) XXX_Size() int { + return m.Size() +} +func (m *ClusterWorkflows) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterWorkflows.DiscardUnknown(m) +} + +var xxx_messageInfo_ClusterWorkflows proto.InternalMessageInfo + +func (m *ClusterWorkflows) GetWorkflows() []*Workflow { + if m != nil { + return m.Workflows + } + return nil +} + +func (m *ClusterWorkflows) GetWarnings() []string { + if m != nil { + return m.Warnings + } + return nil +} + // Keyspace represents information about a keyspace in a particular Vitess // cluster. type Keyspace struct { @@ -130,7 +187,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} } func (m *Keyspace) String() string { return proto.CompactTextString(m) } func (*Keyspace) ProtoMessage() {} func (*Keyspace) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{1} + return fileDescriptor_609739e22a0a50b3, []int{2} } func (m *Keyspace) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -193,7 +250,7 @@ func (m *Schema) Reset() { *m = Schema{} } func (m *Schema) String() string { return proto.CompactTextString(m) } func (*Schema) ProtoMessage() {} func (*Schema) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{2} + return fileDescriptor_609739e22a0a50b3, []int{3} } func (m *Schema) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -258,7 +315,7 @@ func (m *Tablet) Reset() { *m = Tablet{} } func (m *Tablet) String() string { return proto.CompactTextString(m) } func (*Tablet) ProtoMessage() {} func (*Tablet) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{3} + return fileDescriptor_609739e22a0a50b3, []int{4} } func (m *Tablet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -323,7 +380,7 @@ func (m *VSchema) Reset() { *m = VSchema{} } func (m *VSchema) String() string { return proto.CompactTextString(m) } func (*VSchema) ProtoMessage() {} func (*VSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{4} + return fileDescriptor_609739e22a0a50b3, []int{5} } func (m *VSchema) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,7 +443,7 @@ func (m *Vtctld) Reset() { *m = Vtctld{} } func (m *Vtctld) String() string { return proto.CompactTextString(m) } func (*Vtctld) ProtoMessage() {} func (*Vtctld) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{5} + return fileDescriptor_609739e22a0a50b3, []int{6} } func (m *Vtctld) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -452,7 +509,7 @@ func (m *VTGate) Reset() { *m = VTGate{} } func (m *VTGate) String() string { return proto.CompactTextString(m) } func (*VTGate) ProtoMessage() {} func (*VTGate) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{6} + return fileDescriptor_609739e22a0a50b3, []int{7} } func (m *VTGate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,6 +573,69 @@ func (m *VTGate) GetKeyspaces() []string { return nil } +type Workflow struct { + Cluster *Cluster `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` + Workflow *vtctldata.Workflow `protobuf:"bytes,3,opt,name=workflow,proto3" json:"workflow,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Workflow) Reset() { *m = Workflow{} } +func (m *Workflow) String() string { return proto.CompactTextString(m) } +func (*Workflow) ProtoMessage() {} +func (*Workflow) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{8} +} +func (m *Workflow) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Workflow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Workflow.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Workflow) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow.Merge(m, src) +} +func (m *Workflow) XXX_Size() int { + return m.Size() +} +func (m *Workflow) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow.DiscardUnknown(m) +} + +var xxx_messageInfo_Workflow proto.InternalMessageInfo + +func (m *Workflow) GetCluster() *Cluster { + if m != nil { + return m.Cluster + } + return nil +} + +func (m *Workflow) GetKeyspace() string { + if m != nil { + return m.Keyspace + } + return "" +} + +func (m *Workflow) GetWorkflow() *vtctldata.Workflow { + if m != nil { + return m.Workflow + } + return nil +} + type FindSchemaRequest struct { Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` ClusterIds []string `protobuf:"bytes,2,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` @@ -528,7 +648,7 @@ func (m *FindSchemaRequest) Reset() { *m = FindSchemaRequest{} } func (m *FindSchemaRequest) String() string { return proto.CompactTextString(m) } func (*FindSchemaRequest) ProtoMessage() {} func (*FindSchemaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{7} + return fileDescriptor_609739e22a0a50b3, []int{9} } func (m *FindSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -581,7 +701,7 @@ func (m *GetClustersRequest) Reset() { *m = GetClustersRequest{} } func (m *GetClustersRequest) String() string { return proto.CompactTextString(m) } func (*GetClustersRequest) ProtoMessage() {} func (*GetClustersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{8} + return fileDescriptor_609739e22a0a50b3, []int{10} } func (m *GetClustersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -621,7 +741,7 @@ func (m *GetClustersResponse) Reset() { *m = GetClustersResponse{} } func (m *GetClustersResponse) String() string { return proto.CompactTextString(m) } func (*GetClustersResponse) ProtoMessage() {} func (*GetClustersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{9} + return fileDescriptor_609739e22a0a50b3, []int{11} } func (m *GetClustersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -668,7 +788,7 @@ func (m *GetGatesRequest) Reset() { *m = GetGatesRequest{} } func (m *GetGatesRequest) String() string { return proto.CompactTextString(m) } func (*GetGatesRequest) ProtoMessage() {} func (*GetGatesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{10} + return fileDescriptor_609739e22a0a50b3, []int{12} } func (m *GetGatesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -715,7 +835,7 @@ func (m *GetGatesResponse) Reset() { *m = GetGatesResponse{} } func (m *GetGatesResponse) String() string { return proto.CompactTextString(m) } func (*GetGatesResponse) ProtoMessage() {} func (*GetGatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{11} + return fileDescriptor_609739e22a0a50b3, []int{13} } func (m *GetGatesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -762,7 +882,7 @@ func (m *GetKeyspacesRequest) Reset() { *m = GetKeyspacesRequest{} } func (m *GetKeyspacesRequest) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesRequest) ProtoMessage() {} func (*GetKeyspacesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{12} + return fileDescriptor_609739e22a0a50b3, []int{14} } func (m *GetKeyspacesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -809,7 +929,7 @@ func (m *GetKeyspacesResponse) Reset() { *m = GetKeyspacesResponse{} } func (m *GetKeyspacesResponse) String() string { return proto.CompactTextString(m) } func (*GetKeyspacesResponse) ProtoMessage() {} func (*GetKeyspacesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{13} + return fileDescriptor_609739e22a0a50b3, []int{15} } func (m *GetKeyspacesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -858,7 +978,7 @@ func (m *GetSchemaRequest) Reset() { *m = GetSchemaRequest{} } func (m *GetSchemaRequest) String() string { return proto.CompactTextString(m) } func (*GetSchemaRequest) ProtoMessage() {} func (*GetSchemaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{14} + return fileDescriptor_609739e22a0a50b3, []int{16} } func (m *GetSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -919,7 +1039,7 @@ func (m *GetSchemasRequest) Reset() { *m = GetSchemasRequest{} } func (m *GetSchemasRequest) String() string { return proto.CompactTextString(m) } func (*GetSchemasRequest) ProtoMessage() {} func (*GetSchemasRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{15} + return fileDescriptor_609739e22a0a50b3, []int{17} } func (m *GetSchemasRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -966,7 +1086,7 @@ func (m *GetSchemasResponse) Reset() { *m = GetSchemasResponse{} } func (m *GetSchemasResponse) String() string { return proto.CompactTextString(m) } func (*GetSchemasResponse) ProtoMessage() {} func (*GetSchemasResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{16} + return fileDescriptor_609739e22a0a50b3, []int{18} } func (m *GetSchemasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1017,7 +1137,7 @@ func (m *GetTabletRequest) Reset() { *m = GetTabletRequest{} } func (m *GetTabletRequest) String() string { return proto.CompactTextString(m) } func (*GetTabletRequest) ProtoMessage() {} func (*GetTabletRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{17} + return fileDescriptor_609739e22a0a50b3, []int{19} } func (m *GetTabletRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1071,7 +1191,7 @@ func (m *GetTabletsRequest) Reset() { *m = GetTabletsRequest{} } func (m *GetTabletsRequest) String() string { return proto.CompactTextString(m) } func (*GetTabletsRequest) ProtoMessage() {} func (*GetTabletsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{18} + return fileDescriptor_609739e22a0a50b3, []int{20} } func (m *GetTabletsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1118,7 +1238,7 @@ func (m *GetTabletsResponse) Reset() { *m = GetTabletsResponse{} } func (m *GetTabletsResponse) String() string { return proto.CompactTextString(m) } func (*GetTabletsResponse) ProtoMessage() {} func (*GetTabletsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{19} + return fileDescriptor_609739e22a0a50b3, []int{21} } func (m *GetTabletsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1166,7 +1286,7 @@ func (m *GetVSchemaRequest) Reset() { *m = GetVSchemaRequest{} } func (m *GetVSchemaRequest) String() string { return proto.CompactTextString(m) } func (*GetVSchemaRequest) ProtoMessage() {} func (*GetVSchemaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{20} + return fileDescriptor_609739e22a0a50b3, []int{22} } func (m *GetVSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1220,7 +1340,7 @@ func (m *GetVSchemasRequest) Reset() { *m = GetVSchemasRequest{} } func (m *GetVSchemasRequest) String() string { return proto.CompactTextString(m) } func (*GetVSchemasRequest) ProtoMessage() {} func (*GetVSchemasRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{21} + return fileDescriptor_609739e22a0a50b3, []int{23} } func (m *GetVSchemasRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1267,7 +1387,7 @@ func (m *GetVSchemasResponse) Reset() { *m = GetVSchemasResponse{} } func (m *GetVSchemasResponse) String() string { return proto.CompactTextString(m) } func (*GetVSchemasResponse) ProtoMessage() {} func (*GetVSchemasResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{22} + return fileDescriptor_609739e22a0a50b3, []int{24} } func (m *GetVSchemasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1303,6 +1423,210 @@ func (m *GetVSchemasResponse) GetVSchemas() []*VSchema { return nil } +type GetWorkflowRequest struct { + ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + ActiveOnly bool `protobuf:"varint,4,opt,name=active_only,json=activeOnly,proto3" json:"active_only,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetWorkflowRequest) Reset() { *m = GetWorkflowRequest{} } +func (m *GetWorkflowRequest) String() string { return proto.CompactTextString(m) } +func (*GetWorkflowRequest) ProtoMessage() {} +func (*GetWorkflowRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{25} +} +func (m *GetWorkflowRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetWorkflowRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetWorkflowRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetWorkflowRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetWorkflowRequest.Merge(m, src) +} +func (m *GetWorkflowRequest) XXX_Size() int { + return m.Size() +} +func (m *GetWorkflowRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetWorkflowRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetWorkflowRequest proto.InternalMessageInfo + +func (m *GetWorkflowRequest) GetClusterId() string { + if m != nil { + return m.ClusterId + } + return "" +} + +func (m *GetWorkflowRequest) GetKeyspace() string { + if m != nil { + return m.Keyspace + } + return "" +} + +func (m *GetWorkflowRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *GetWorkflowRequest) GetActiveOnly() bool { + if m != nil { + return m.ActiveOnly + } + return false +} + +type GetWorkflowsRequest struct { + ClusterIds []string `protobuf:"bytes,1,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` + // ActiveOnly specifies whether to return workflows that are currently + // active (running or paused) instead of all workflows. + ActiveOnly bool `protobuf:"varint,2,opt,name=active_only,json=activeOnly,proto3" json:"active_only,omitempty"` + // Keyspaces is a list of keyspaces to restrict the workflow search to. Note + // that the keyspaces list applies across all cluster IDs in the request. + // + // If, for example, you have two clusters, each with a keyspace called "foo" + // and want the workflows from "foo" in cluster1 but not from cluster2, you + // must make two requests. + // + // Keyspaces and IgnoreKeyspaces are mutually-exclusive, and Keyspaces takes + // precedence; if Keyspaces is a non-empty list, then IgnoreKeyspaces is + // ignored completely. + Keyspaces []string `protobuf:"bytes,3,rep,name=keyspaces,proto3" json:"keyspaces,omitempty"` + // IgnoreKeyspaces is a list of keyspaces to skip during the workflow + // search. It has the same semantics as the Keyspaces parameter, so refer to + // that documentation for more details. + IgnoreKeyspaces []string `protobuf:"bytes,4,rep,name=ignore_keyspaces,json=ignoreKeyspaces,proto3" json:"ignore_keyspaces,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetWorkflowsRequest) Reset() { *m = GetWorkflowsRequest{} } +func (m *GetWorkflowsRequest) String() string { return proto.CompactTextString(m) } +func (*GetWorkflowsRequest) ProtoMessage() {} +func (*GetWorkflowsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{26} +} +func (m *GetWorkflowsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetWorkflowsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetWorkflowsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetWorkflowsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetWorkflowsRequest.Merge(m, src) +} +func (m *GetWorkflowsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetWorkflowsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetWorkflowsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetWorkflowsRequest proto.InternalMessageInfo + +func (m *GetWorkflowsRequest) GetClusterIds() []string { + if m != nil { + return m.ClusterIds + } + return nil +} + +func (m *GetWorkflowsRequest) GetActiveOnly() bool { + if m != nil { + return m.ActiveOnly + } + return false +} + +func (m *GetWorkflowsRequest) GetKeyspaces() []string { + if m != nil { + return m.Keyspaces + } + return nil +} + +func (m *GetWorkflowsRequest) GetIgnoreKeyspaces() []string { + if m != nil { + return m.IgnoreKeyspaces + } + return nil +} + +type GetWorkflowsResponse struct { + WorkflowsByCluster map[string]*ClusterWorkflows `protobuf:"bytes,1,rep,name=workflows_by_cluster,json=workflowsByCluster,proto3" json:"workflows_by_cluster,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetWorkflowsResponse) Reset() { *m = GetWorkflowsResponse{} } +func (m *GetWorkflowsResponse) String() string { return proto.CompactTextString(m) } +func (*GetWorkflowsResponse) ProtoMessage() {} +func (*GetWorkflowsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{27} +} +func (m *GetWorkflowsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetWorkflowsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetWorkflowsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetWorkflowsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetWorkflowsResponse.Merge(m, src) +} +func (m *GetWorkflowsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetWorkflowsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetWorkflowsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetWorkflowsResponse proto.InternalMessageInfo + +func (m *GetWorkflowsResponse) GetWorkflowsByCluster() map[string]*ClusterWorkflows { + if m != nil { + return m.WorkflowsByCluster + } + return nil +} + type VTExplainRequest struct { Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` @@ -1316,7 +1640,7 @@ func (m *VTExplainRequest) Reset() { *m = VTExplainRequest{} } func (m *VTExplainRequest) String() string { return proto.CompactTextString(m) } func (*VTExplainRequest) ProtoMessage() {} func (*VTExplainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{23} + return fileDescriptor_609739e22a0a50b3, []int{28} } func (m *VTExplainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1377,7 +1701,7 @@ func (m *VTExplainResponse) Reset() { *m = VTExplainResponse{} } func (m *VTExplainResponse) String() string { return proto.CompactTextString(m) } func (*VTExplainResponse) ProtoMessage() {} func (*VTExplainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{24} + return fileDescriptor_609739e22a0a50b3, []int{29} } func (m *VTExplainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1416,6 +1740,7 @@ func (m *VTExplainResponse) GetResponse() string { func init() { proto.RegisterEnum("vtadmin.Tablet_ServingState", Tablet_ServingState_name, Tablet_ServingState_value) proto.RegisterType((*Cluster)(nil), "vtadmin.Cluster") + proto.RegisterType((*ClusterWorkflows)(nil), "vtadmin.ClusterWorkflows") proto.RegisterType((*Keyspace)(nil), "vtadmin.Keyspace") proto.RegisterMapType((map[string]*vtctldata.Shard)(nil), "vtadmin.Keyspace.ShardsEntry") proto.RegisterType((*Schema)(nil), "vtadmin.Schema") @@ -1423,6 +1748,7 @@ func init() { proto.RegisterType((*VSchema)(nil), "vtadmin.VSchema") proto.RegisterType((*Vtctld)(nil), "vtadmin.Vtctld") proto.RegisterType((*VTGate)(nil), "vtadmin.VTGate") + proto.RegisterType((*Workflow)(nil), "vtadmin.Workflow") proto.RegisterType((*FindSchemaRequest)(nil), "vtadmin.FindSchemaRequest") proto.RegisterType((*GetClustersRequest)(nil), "vtadmin.GetClustersRequest") proto.RegisterType((*GetClustersResponse)(nil), "vtadmin.GetClustersResponse") @@ -1439,6 +1765,10 @@ func init() { proto.RegisterType((*GetVSchemaRequest)(nil), "vtadmin.GetVSchemaRequest") proto.RegisterType((*GetVSchemasRequest)(nil), "vtadmin.GetVSchemasRequest") proto.RegisterType((*GetVSchemasResponse)(nil), "vtadmin.GetVSchemasResponse") + proto.RegisterType((*GetWorkflowRequest)(nil), "vtadmin.GetWorkflowRequest") + proto.RegisterType((*GetWorkflowsRequest)(nil), "vtadmin.GetWorkflowsRequest") + proto.RegisterType((*GetWorkflowsResponse)(nil), "vtadmin.GetWorkflowsResponse") + proto.RegisterMapType((map[string]*ClusterWorkflows)(nil), "vtadmin.GetWorkflowsResponse.WorkflowsByClusterEntry") proto.RegisterType((*VTExplainRequest)(nil), "vtadmin.VTExplainRequest") proto.RegisterType((*VTExplainResponse)(nil), "vtadmin.VTExplainResponse") } @@ -1446,71 +1776,85 @@ func init() { func init() { proto.RegisterFile("vtadmin.proto", fileDescriptor_609739e22a0a50b3) } var fileDescriptor_609739e22a0a50b3 = []byte{ - // 1011 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x8e, 0x93, 0xe6, 0xc7, 0x27, 0xbb, 0xad, 0x33, 0x5b, 0x09, 0xe3, 0x6d, 0x4b, 0x35, 0x02, - 0x14, 0x10, 0x9b, 0x48, 0x81, 0x5d, 0x51, 0x40, 0x42, 0xcb, 0xb6, 0x44, 0xbb, 0x15, 0x29, 0x72, - 0x82, 0x91, 0xf6, 0xa6, 0xf2, 0xc6, 0xa6, 0xb5, 0x36, 0xb5, 0xd3, 0xcc, 0xd4, 0xd0, 0x17, 0x41, - 0xdc, 0xf2, 0x36, 0xdc, 0x20, 0xf1, 0x08, 0xa8, 0x5c, 0xf2, 0x0a, 0x5c, 0x20, 0xcf, 0x5f, 0xc6, - 0x76, 0xe8, 0x0f, 0xda, 0xbb, 0x99, 0x73, 0xce, 0x7c, 0xe7, 0x3b, 0xbf, 0x36, 0xdc, 0x4f, 0xa9, - 0x1f, 0x9c, 0x45, 0x71, 0x6f, 0xbe, 0x48, 0x68, 0x82, 0x9a, 0xe2, 0xea, 0xbc, 0x45, 0xfd, 0x57, - 0xb3, 0x90, 0x9e, 0xf9, 0xb1, 0x7f, 0x12, 0x2e, 0x02, 0x9f, 0xfa, 0xdc, 0xc2, 0x59, 0xa7, 0xc9, - 0x3c, 0xd1, 0xee, 0xf7, 0x53, 0x32, 0x3d, 0x0d, 0xcf, 0xe4, 0x75, 0x23, 0xa5, 0x53, 0x3a, 0x5b, - 0xea, 0xf1, 0x23, 0x68, 0x3e, 0x9b, 0x5d, 0x10, 0x1a, 0x2e, 0xd0, 0x3a, 0x54, 0xa3, 0xc0, 0x36, - 0x76, 0x8d, 0xae, 0xe9, 0x56, 0xa3, 0x00, 0x21, 0x58, 0x8b, 0xfd, 0xb3, 0xd0, 0xae, 0x32, 0x09, - 0x3b, 0xe3, 0xbf, 0x0d, 0x68, 0x1d, 0x86, 0x97, 0x64, 0xee, 0x4f, 0x43, 0xf4, 0x21, 0x34, 0xa7, - 0xfc, 0x2d, 0x7b, 0xd5, 0x1e, 0x58, 0x3d, 0x49, 0x57, 0x60, 0xba, 0xd2, 0x00, 0xf5, 0xa1, 0xf5, - 0x5a, 0xbc, 0x63, 0x80, 0xed, 0xc1, 0x83, 0xde, 0x92, 0x8b, 0x84, 0x74, 0x95, 0x11, 0x7a, 0x0c, - 0x0d, 0x72, 0xea, 0x2f, 0x02, 0x62, 0xd7, 0x76, 0x6b, 0xdd, 0xf6, 0x60, 0x5b, 0x61, 0x4b, 0xe3, - 0xde, 0x98, 0xe9, 0x0f, 0x62, 0xba, 0xb8, 0x74, 0x85, 0xb1, 0x73, 0x08, 0x6d, 0x4d, 0x8c, 0x2c, - 0xa8, 0xbd, 0x0e, 0x2f, 0x45, 0x50, 0xd9, 0x11, 0xbd, 0x0f, 0xf5, 0xd4, 0x9f, 0x5d, 0x48, 0x16, - 0x96, 0xc6, 0x82, 0x3d, 0x74, 0xb9, 0xfa, 0xb3, 0xea, 0xa7, 0x06, 0xfe, 0xd5, 0x80, 0xc6, 0x98, - 0xa5, 0xef, 0x4e, 0xb1, 0x3a, 0x85, 0x58, 0x4d, 0x2d, 0xac, 0x23, 0xe8, 0xb0, 0xd2, 0x1d, 0x07, - 0xe1, 0x0f, 0x51, 0x1c, 0xd1, 0x28, 0x89, 0x65, 0x84, 0xb8, 0x57, 0x2e, 0xea, 0x24, 0x93, 0xec, - 0x2b, 0x53, 0xd7, 0xa2, 0x79, 0x01, 0xc1, 0xbf, 0x1b, 0xd0, 0x60, 0x56, 0xf4, 0x4e, 0x1c, 0xbb, - 0xd0, 0xe0, 0xde, 0x54, 0x1e, 0x54, 0xe3, 0x70, 0x34, 0x57, 0xe8, 0xd1, 0x00, 0xea, 0x84, 0xfa, - 0x34, 0xb4, 0x6b, 0xbb, 0x46, 0x77, 0x7d, 0xb0, 0xa5, 0x30, 0xb9, 0x5d, 0x6f, 0x1c, 0x2e, 0xd2, - 0x28, 0x3e, 0x19, 0x67, 0x36, 0x2e, 0x37, 0xc5, 0x7b, 0x70, 0x4f, 0x17, 0xa3, 0x36, 0x34, 0xbf, - 0x1b, 0x1d, 0x8e, 0x8e, 0xbe, 0x1f, 0x59, 0x95, 0xec, 0x32, 0x3e, 0x70, 0xbd, 0xe7, 0xa3, 0xa1, - 0x65, 0xa0, 0x0d, 0x68, 0x8f, 0x8e, 0x26, 0xc7, 0x52, 0x50, 0xc5, 0x3f, 0x42, 0xd3, 0xfb, 0x1f, - 0x39, 0x5f, 0xd1, 0xac, 0xe8, 0x23, 0x68, 0xa5, 0xc7, 0xbc, 0xfd, 0x19, 0xf9, 0xf6, 0xa0, 0xd3, - 0x93, 0xe3, 0xa0, 0x3a, 0xae, 0x99, 0x72, 0x6f, 0xf8, 0x5b, 0x68, 0x78, 0xac, 0x15, 0xb2, 0xfa, - 0x9d, 0x26, 0x84, 0x32, 0x3c, 0xde, 0x39, 0xea, 0xae, 0x73, 0xaa, 0xde, 0xc0, 0x09, 0xff, 0x6c, - 0x40, 0xc3, 0x9b, 0x0c, 0xb3, 0x04, 0x5c, 0x07, 0x89, 0x60, 0x6d, 0x9e, 0x24, 0x33, 0x49, 0x3d, - 0x3b, 0x67, 0xb2, 0x69, 0x38, 0x9b, 0x31, 0xda, 0xa6, 0xcb, 0xce, 0xba, 0xeb, 0xb5, 0x9b, 0xd2, - 0xb1, 0x05, 0xa6, 0x6c, 0x39, 0x62, 0xd7, 0x77, 0x6b, 0x5d, 0xd3, 0x5d, 0x0a, 0xf0, 0x0b, 0xe8, - 0x7c, 0x1d, 0xc5, 0x01, 0x0f, 0xdc, 0x0d, 0xcf, 0x2f, 0x42, 0x42, 0xd1, 0x26, 0xd4, 0x59, 0xc5, - 0x05, 0x3f, 0x7e, 0x41, 0xef, 0x40, 0x5b, 0x60, 0x1e, 0x47, 0x01, 0xb1, 0xab, 0x0c, 0x0a, 0x84, - 0xe8, 0x79, 0x40, 0xf0, 0x26, 0xa0, 0x61, 0x48, 0x05, 0x01, 0x22, 0xc0, 0xf0, 0x33, 0x78, 0x90, - 0x93, 0x92, 0x79, 0x12, 0x13, 0x56, 0x11, 0xf1, 0x94, 0xd8, 0x06, 0x6b, 0xfa, 0x72, 0x0c, 0xca, - 0x02, 0x0f, 0x60, 0x63, 0x18, 0xd2, 0x2c, 0x7f, 0x12, 0xb7, 0x48, 0xc7, 0x28, 0xd1, 0xd9, 0x03, - 0x6b, 0xf9, 0x46, 0x78, 0x7d, 0x0f, 0xea, 0x27, 0x99, 0x40, 0xb8, 0xdc, 0x50, 0x2e, 0x79, 0x71, - 0x5c, 0xae, 0xc5, 0x4f, 0x18, 0x67, 0xd9, 0x18, 0xb7, 0x77, 0x39, 0x84, 0xcd, 0xfc, 0x3b, 0xe1, - 0xb6, 0xaf, 0xd7, 0x80, 0xbb, 0xee, 0x94, 0x96, 0x98, 0x5e, 0x96, 0x29, 0xe3, 0x9e, 0xaf, 0xca, - 0x36, 0xc0, 0xd2, 0xbb, 0x28, 0x8d, 0xa9, 0x9c, 0x5f, 0xbb, 0x6a, 0x54, 0x41, 0x6b, 0x5a, 0x41, - 0xf1, 0x27, 0xd0, 0x51, 0x4e, 0x6e, 0x1f, 0xe3, 0x97, 0xac, 0xca, 0xea, 0x95, 0x88, 0xf0, 0x03, - 0x68, 0xf2, 0x71, 0x2a, 0xa7, 0x56, 0x44, 0x21, 0xf5, 0xf8, 0x88, 0xc5, 0x26, 0x56, 0x8b, 0xf0, - 0x7a, 0xdd, 0x50, 0xdc, 0xd8, 0x77, 0x3c, 0x0e, 0x0e, 0x78, 0xd7, 0x38, 0xd4, 0xab, 0x65, 0x1c, - 0x7c, 0xd9, 0x95, 0xe3, 0x10, 0x8c, 0xa5, 0x1e, 0x8f, 0x98, 0x5b, 0xef, 0x4d, 0x15, 0x09, 0x3f, - 0x66, 0x84, 0xbc, 0xbb, 0xd6, 0x63, 0x9f, 0xf5, 0xaa, 0x57, 0x2c, 0xc8, 0x23, 0x30, 0xe5, 0xc6, - 0x2b, 0x0f, 0x98, 0x24, 0xdd, 0x12, 0x1b, 0x8f, 0xe0, 0x97, 0x60, 0x79, 0x93, 0x83, 0x9f, 0xe6, - 0x33, 0x3f, 0x8a, 0xa5, 0x6b, 0x3b, 0xbf, 0x74, 0xcd, 0xdb, 0x7d, 0xd6, 0x2c, 0xa8, 0x91, 0x73, - 0xb9, 0xae, 0xb2, 0x23, 0xee, 0x43, 0x47, 0xc3, 0x16, 0xfc, 0x1c, 0x68, 0x2d, 0xc4, 0x59, 0x56, - 0x5c, 0xde, 0x07, 0xff, 0xd4, 0xa1, 0xe9, 0x4d, 0x9e, 0x66, 0x54, 0xd1, 0xe7, 0x00, 0xcb, 0x05, - 0x85, 0x1c, 0x15, 0x42, 0x69, 0x6b, 0x39, 0xc5, 0x8e, 0xc3, 0x15, 0xf4, 0x02, 0xda, 0xda, 0xee, - 0x41, 0x0f, 0x95, 0x45, 0x79, 0x4f, 0x39, 0x5b, 0xab, 0x95, 0x9c, 0x12, 0xae, 0xa0, 0xa7, 0xd0, - 0x92, 0xeb, 0x04, 0xd9, 0xba, 0xad, 0xbe, 0x95, 0x9c, 0xb7, 0x57, 0x68, 0x14, 0xc4, 0x37, 0x70, - 0x4f, 0x5f, 0x0f, 0x28, 0xe7, 0xb2, 0xb8, 0x6d, 0x9c, 0xed, 0xff, 0xd0, 0x2a, 0xb8, 0x3d, 0x30, - 0xd5, 0x24, 0xa2, 0x9c, 0xe3, 0x1b, 0x13, 0x33, 0x04, 0x58, 0x0e, 0xb1, 0x96, 0xd5, 0xd2, 0x3e, - 0x70, 0x1e, 0xae, 0xd4, 0x15, 0x38, 0x88, 0xbf, 0x8e, 0x1c, 0x87, 0xdc, 0x80, 0x3b, 0xc5, 0x31, - 0x52, 0x1c, 0xc4, 0x00, 0xe6, 0x39, 0xe4, 0x67, 0x39, 0xcf, 0xa1, 0x30, 0xb1, 0xb8, 0x82, 0xbe, - 0x60, 0x40, 0x5e, 0xa9, 0x45, 0x4a, 0xd3, 0xe9, 0x94, 0x26, 0x40, 0xf5, 0x88, 0x9c, 0x9f, 0x7c, - 0x8f, 0x14, 0x86, 0x31, 0xdf, 0x23, 0x5e, 0x39, 0x1b, 0xfb, 0x60, 0xaa, 0x4e, 0xd7, 0xb2, 0x51, - 0x9c, 0x2c, 0xc7, 0x59, 0xa5, 0x92, 0x28, 0x5f, 0x3d, 0xf9, 0xed, 0x6a, 0xc7, 0xf8, 0xe3, 0x6a, - 0xc7, 0xf8, 0xf3, 0x6a, 0xc7, 0xf8, 0xe5, 0xaf, 0x9d, 0xca, 0xcb, 0x77, 0xd3, 0x88, 0x86, 0x84, - 0xf4, 0xa2, 0xa4, 0xcf, 0x4f, 0xfd, 0x93, 0xa4, 0x9f, 0xd2, 0x3e, 0xfb, 0x71, 0xef, 0x0b, 0xac, - 0x57, 0x0d, 0x76, 0xfd, 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd7, 0xbc, 0x6b, 0x83, 0x2a, - 0x0c, 0x00, 0x00, + // 1244 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6f, 0xdb, 0x54, + 0x14, 0x8f, 0x93, 0x36, 0x89, 0x4f, 0xb6, 0xd5, 0xbd, 0xab, 0xb4, 0xcc, 0xfd, 0x58, 0x75, 0x05, + 0xa8, 0x43, 0x2c, 0x96, 0x02, 0x9d, 0x28, 0x20, 0x4d, 0xdb, 0x5a, 0xa2, 0xad, 0x22, 0x45, 0x6e, + 0xf1, 0xa4, 0xbd, 0x04, 0x37, 0xf1, 0x52, 0xab, 0xae, 0x9d, 0xc5, 0xb7, 0x29, 0x79, 0x86, 0x47, + 0x9e, 0x11, 0x8f, 0xf0, 0xdf, 0xf0, 0x82, 0xc4, 0x9f, 0x00, 0xe5, 0x91, 0x7f, 0x02, 0xf9, 0x7e, + 0xf9, 0xda, 0x4e, 0xbf, 0x60, 0x6f, 0xbe, 0xf7, 0x9e, 0x7b, 0xce, 0xef, 0x7c, 0xfd, 0xce, 0x35, + 0xdc, 0x9e, 0x10, 0x77, 0x70, 0xe2, 0x87, 0xad, 0xd1, 0x38, 0x22, 0x11, 0xaa, 0xf1, 0xa5, 0x79, + 0x8f, 0xb8, 0x87, 0x81, 0x47, 0x4e, 0xdc, 0xd0, 0x1d, 0x7a, 0xe3, 0x81, 0x4b, 0x5c, 0x26, 0x61, + 0xde, 0x21, 0xd1, 0x28, 0x52, 0xd6, 0xb7, 0x27, 0x71, 0xff, 0xc8, 0x3b, 0x11, 0xcb, 0x85, 0x09, + 0xe9, 0x93, 0x20, 0x3d, 0xc7, 0x8f, 0xa0, 0xf6, 0x3c, 0x38, 0x8d, 0x89, 0x37, 0x46, 0x77, 0xa0, + 0xec, 0x0f, 0x9a, 0xda, 0xba, 0xb6, 0xa1, 0xdb, 0x65, 0x7f, 0x80, 0x10, 0xcc, 0x85, 0xee, 0x89, + 0xd7, 0x2c, 0xd3, 0x1d, 0xfa, 0x8d, 0x7b, 0x60, 0x70, 0xf1, 0x57, 0xd1, 0xf8, 0xf8, 0x4d, 0x10, + 0x9d, 0xc5, 0xc8, 0x02, 0xfd, 0x4c, 0x2c, 0x9a, 0xda, 0x7a, 0x65, 0xa3, 0xd1, 0x5e, 0x6c, 0x09, + 0xdc, 0x42, 0xcc, 0x4e, 0x65, 0x90, 0x09, 0xf5, 0x33, 0x77, 0x1c, 0xfa, 0xe1, 0x30, 0x6e, 0x96, + 0xd7, 0x2b, 0x1b, 0xba, 0x2d, 0xd7, 0xf8, 0x1f, 0x0d, 0xea, 0xbb, 0xde, 0x34, 0x1e, 0xb9, 0x7d, + 0x0f, 0x7d, 0x08, 0xb5, 0x3e, 0xb3, 0x46, 0x61, 0x35, 0xda, 0x86, 0xd4, 0xcb, 0x51, 0xd8, 0x42, + 0x00, 0x59, 0x50, 0x3f, 0xe6, 0xf7, 0x28, 0xe2, 0x46, 0xfb, 0x6e, 0x2b, 0x75, 0x56, 0xa8, 0xb4, + 0xa5, 0x10, 0xda, 0x84, 0x6a, 0x7c, 0xe4, 0x8e, 0x07, 0x71, 0xb3, 0x42, 0x31, 0xaf, 0x4a, 0xdd, + 0x42, 0xb8, 0xb5, 0x4f, 0xcf, 0x77, 0x42, 0x32, 0x9e, 0xda, 0x5c, 0xd8, 0xdc, 0x85, 0x86, 0xb2, + 0x8d, 0x0c, 0xa8, 0x1c, 0x7b, 0x53, 0x1e, 0xb5, 0xe4, 0x13, 0x7d, 0x00, 0xf3, 0x13, 0x37, 0x38, + 0x15, 0x28, 0x0c, 0x05, 0x05, 0xbd, 0x68, 0xb3, 0xe3, 0xcf, 0xca, 0x9f, 0x6a, 0xf8, 0x57, 0x0d, + 0xaa, 0xfb, 0x34, 0x3f, 0x37, 0xf2, 0xd5, 0xcc, 0xf9, 0xaa, 0x2b, 0x6e, 0xed, 0xc1, 0x22, 0xad, + 0x8d, 0xde, 0xc0, 0x7b, 0xe3, 0x87, 0x3e, 0xf1, 0xa3, 0x50, 0x78, 0x88, 0x5b, 0xc5, 0xaa, 0x39, + 0x48, 0x76, 0xb6, 0xa5, 0xa8, 0x6d, 0x90, 0xec, 0x46, 0x8c, 0x7f, 0xd7, 0xa0, 0x4a, 0xa5, 0xc8, + 0x8d, 0x30, 0x6e, 0x40, 0x95, 0x59, 0x93, 0x71, 0x90, 0x95, 0xc9, 0xb4, 0xd9, 0xfc, 0x1c, 0xb5, + 0x61, 0x3e, 0x26, 0x2e, 0xf1, 0x9a, 0x95, 0x75, 0x6d, 0xe3, 0x4e, 0x7b, 0x45, 0xea, 0x64, 0x72, + 0xad, 0x7d, 0x6f, 0x3c, 0xf1, 0xc3, 0xe1, 0x7e, 0x22, 0x63, 0x33, 0x51, 0xbc, 0x05, 0xb7, 0xd4, + 0x6d, 0xd4, 0x80, 0xda, 0x37, 0xdd, 0xdd, 0xee, 0xde, 0xab, 0xae, 0x51, 0x4a, 0x16, 0xfb, 0x3b, + 0xb6, 0xf3, 0xa2, 0xdb, 0x31, 0x34, 0xb4, 0x00, 0x8d, 0xee, 0xde, 0x41, 0x4f, 0x6c, 0x94, 0xf1, + 0x19, 0xd4, 0x9c, 0xff, 0x10, 0xf3, 0x19, 0xdd, 0x80, 0x3e, 0x82, 0xfa, 0xa4, 0xc7, 0xfa, 0x8b, + 0x82, 0xa7, 0x85, 0xcf, 0xfb, 0x4d, 0x56, 0x5c, 0x6d, 0xc2, 0xac, 0xe1, 0xaf, 0xa1, 0xea, 0xd0, + 0x52, 0x48, 0xf2, 0x77, 0x14, 0xc5, 0x84, 0xea, 0x63, 0x95, 0x23, 0xd7, 0x2a, 0xa6, 0xf2, 0x15, + 0x98, 0xf0, 0x4f, 0x1a, 0x54, 0x9d, 0x83, 0x4e, 0x12, 0x80, 0xcb, 0x54, 0x22, 0x98, 0x1b, 0x45, + 0x51, 0x20, 0xa0, 0x27, 0xdf, 0xc9, 0x5e, 0xdf, 0x0b, 0x02, 0x0a, 0x5b, 0xb7, 0xe9, 0xb7, 0x6a, + 0x7a, 0xee, 0xaa, 0x70, 0xac, 0x80, 0x2e, 0x4a, 0x2e, 0x6e, 0xce, 0xd3, 0x26, 0x4e, 0x37, 0xf0, + 0xf7, 0x1a, 0xd4, 0x45, 0xe7, 0xbf, 0xb3, 0xca, 0xb6, 0xa0, 0x2e, 0x38, 0x84, 0x47, 0x5b, 0xed, + 0x70, 0x49, 0x34, 0x52, 0x08, 0xbf, 0x84, 0xc5, 0x2f, 0xfd, 0x70, 0xc0, 0xc2, 0x6f, 0x7b, 0x6f, + 0x4f, 0xbd, 0x98, 0xa0, 0x25, 0x98, 0xa7, 0x75, 0xc7, 0xa3, 0xc4, 0x16, 0xe8, 0x01, 0x34, 0x38, + 0x84, 0x9e, 0x3f, 0x10, 0xac, 0x04, 0x7c, 0xeb, 0xc5, 0x20, 0xc6, 0x4b, 0x80, 0x3a, 0x1e, 0xe1, + 0x78, 0x63, 0xae, 0x0c, 0x3f, 0x87, 0xbb, 0x99, 0xdd, 0x78, 0x14, 0x85, 0x31, 0xad, 0x0b, 0x7e, + 0x55, 0x10, 0x62, 0xd1, 0x65, 0x29, 0x81, 0xdb, 0xb0, 0xd0, 0xf1, 0x48, 0x92, 0x45, 0xa1, 0x37, + 0x0f, 0x47, 0x2b, 0xc0, 0xd9, 0x02, 0x23, 0xbd, 0xc3, 0xad, 0xbe, 0x0f, 0xf3, 0xc3, 0x64, 0x83, + 0x9b, 0x5c, 0x90, 0x26, 0x59, 0x89, 0xd8, 0xec, 0x14, 0x3f, 0xa6, 0x98, 0x45, 0x79, 0x5e, 0xdf, + 0x64, 0x07, 0x96, 0xb2, 0xf7, 0xb8, 0x59, 0x4b, 0xad, 0x84, 0x3c, 0xfd, 0xcb, 0x2e, 0x50, 0x8a, + 0xa3, 0x4f, 0xb1, 0x67, 0xb3, 0xb2, 0x0a, 0x90, 0x5a, 0xe7, 0xa9, 0xd1, 0xa5, 0xf1, 0x4b, 0xcb, + 0x42, 0x26, 0xb4, 0xa2, 0x24, 0x14, 0x7f, 0x02, 0x8b, 0xd2, 0xc8, 0xf5, 0x7d, 0x7c, 0x42, 0xb3, + 0x2c, 0x6f, 0x71, 0x0f, 0x1f, 0x42, 0x8d, 0x35, 0x75, 0x31, 0xb4, 0xdc, 0x0b, 0x71, 0x8e, 0xf7, + 0xa8, 0x6f, 0x9c, 0xe0, 0xb8, 0xd5, 0xcb, 0x5a, 0xf3, 0xca, 0xba, 0x63, 0x7e, 0x30, 0x85, 0x37, + 0xf5, 0x43, 0xde, 0x4a, 0xfd, 0x60, 0x94, 0x5b, 0xf4, 0x83, 0x23, 0x16, 0xe7, 0xb8, 0x4b, 0xcd, + 0x3a, 0xef, 0x2a, 0x49, 0x78, 0x93, 0x02, 0x72, 0x6e, 0x9a, 0x8f, 0x6d, 0x5a, 0xab, 0x4e, 0x3e, + 0x21, 0x8f, 0x40, 0x17, 0xbc, 0x5b, 0x6c, 0x30, 0x01, 0xba, 0xce, 0x79, 0x37, 0xc6, 0x3f, 0x68, + 0xd4, 0xba, 0x64, 0x88, 0xff, 0x5f, 0x73, 0x62, 0x18, 0x54, 0x94, 0x61, 0xf0, 0x00, 0x1a, 0x6e, + 0x9f, 0xf8, 0x13, 0xaf, 0x17, 0x85, 0xc1, 0x94, 0x32, 0x68, 0xdd, 0x06, 0xb6, 0xb5, 0x17, 0x06, + 0x53, 0xfc, 0x8b, 0x46, 0xbd, 0x91, 0x0f, 0xa7, 0xeb, 0x46, 0x21, 0xaf, 0xb9, 0x9c, 0xd7, 0x9c, + 0x25, 0xe3, 0x4a, 0x8e, 0x8c, 0xd1, 0x43, 0x30, 0xfc, 0x61, 0x18, 0x8d, 0xbd, 0x5e, 0x2a, 0x34, + 0x47, 0x85, 0x16, 0xd8, 0xbe, 0xec, 0x69, 0xfc, 0x97, 0x46, 0x9b, 0x5c, 0x81, 0xc8, 0x23, 0x3e, + 0x84, 0x25, 0xf9, 0x7e, 0xeb, 0x1d, 0x4e, 0x7b, 0x29, 0xa1, 0x27, 0xc1, 0xdf, 0x94, 0xc1, 0x9f, + 0x75, 0x59, 0x52, 0x73, 0xfc, 0x6c, 0xca, 0xd9, 0x8f, 0x3d, 0xa9, 0xd0, 0x59, 0xe1, 0xc0, 0xfc, + 0x16, 0xee, 0x5d, 0x20, 0x3e, 0xe3, 0xa9, 0x65, 0x65, 0x9f, 0x5a, 0xf7, 0xf3, 0x24, 0x9b, 0x42, + 0x51, 0xde, 0x5c, 0xaf, 0xc1, 0x70, 0x0e, 0x76, 0xbe, 0x1b, 0x05, 0xae, 0x1f, 0x8a, 0x14, 0x34, + 0xb3, 0x23, 0x4a, 0xbf, 0xde, 0x40, 0x32, 0xa0, 0x12, 0xbf, 0x15, 0x23, 0x34, 0xf9, 0xc4, 0x16, + 0x2c, 0x2a, 0xba, 0x79, 0xec, 0x4c, 0xa8, 0x8f, 0xf9, 0xb7, 0xe8, 0x7f, 0xb1, 0x6e, 0xff, 0x58, + 0x83, 0x9a, 0x73, 0xf0, 0x34, 0x01, 0x8d, 0x3e, 0x07, 0x48, 0xc7, 0x15, 0x32, 0xa5, 0x33, 0x85, + 0x19, 0x66, 0xe6, 0xf9, 0x07, 0x97, 0xd0, 0x4b, 0x68, 0x28, 0x93, 0x08, 0x2d, 0xab, 0x19, 0xc9, + 0x4d, 0x2d, 0x73, 0x65, 0xf6, 0x21, 0x83, 0x84, 0x4b, 0xe8, 0x29, 0xd4, 0xc5, 0x70, 0x41, 0x4d, + 0x55, 0x56, 0x9d, 0x51, 0xe6, 0xfd, 0x19, 0x27, 0x52, 0xc5, 0x57, 0x70, 0x4b, 0x1d, 0x16, 0x28, + 0x63, 0x32, 0x3f, 0x7b, 0xcc, 0xd5, 0x0b, 0x4e, 0xa5, 0xba, 0x2d, 0xd0, 0x25, 0x2f, 0xa3, 0x8c, + 0xe1, 0x2b, 0x03, 0xd3, 0x01, 0x48, 0x29, 0x5d, 0x89, 0x6a, 0x61, 0x3a, 0x98, 0xcb, 0x33, 0xcf, + 0x72, 0x18, 0xf8, 0x4b, 0x38, 0x83, 0x21, 0x43, 0xf7, 0x66, 0x9e, 0x54, 0x25, 0x06, 0x4e, 0xc7, + 0x59, 0x0c, 0x59, 0x66, 0xcf, 0x62, 0xc8, 0xf1, 0x37, 0x2e, 0xa1, 0x2f, 0xa8, 0x22, 0xa7, 0x50, + 0x22, 0x05, 0xae, 0x36, 0x0b, 0x7c, 0x28, 0x6b, 0x44, 0xb0, 0x69, 0xb6, 0x46, 0x72, 0xd4, 0x9c, + 0xad, 0x11, 0xa7, 0x18, 0x8d, 0x27, 0x54, 0x97, 0x7c, 0xe3, 0x2d, 0xcf, 0x62, 0x00, 0xa1, 0xab, + 0xf8, 0x37, 0x28, 0x2b, 0x24, 0xfd, 0x8b, 0x5c, 0xb9, 0x80, 0x43, 0x66, 0x54, 0x48, 0x81, 0x61, + 0x70, 0x09, 0x6d, 0x83, 0x2e, 0x3b, 0x4f, 0xc9, 0x4e, 0xbe, 0xd3, 0x4d, 0x73, 0xd6, 0x91, 0xd0, + 0xf2, 0xec, 0xf1, 0x6f, 0xe7, 0x6b, 0xda, 0x1f, 0xe7, 0x6b, 0xda, 0x9f, 0xe7, 0x6b, 0xda, 0xcf, + 0x7f, 0xaf, 0x95, 0x5e, 0xbf, 0x37, 0xf1, 0x89, 0x17, 0xc7, 0x2d, 0x3f, 0xb2, 0xd8, 0x97, 0x35, + 0x8c, 0xac, 0x09, 0xb1, 0xe8, 0xdf, 0xb3, 0xc5, 0x75, 0x1d, 0x56, 0xe9, 0xf2, 0xe3, 0x7f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xe0, 0x66, 0xc0, 0xf2, 0xaf, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1553,6 +1897,11 @@ type VTAdminClient interface { GetVSchema(ctx context.Context, in *GetVSchemaRequest, opts ...grpc.CallOption) (*VSchema, error) // GetVSchemas returns the VSchemas for all specified clusters. GetVSchemas(ctx context.Context, in *GetVSchemasRequest, opts ...grpc.CallOption) (*GetVSchemasResponse, error) + // GetWorkflow returns a single Workflow for a given cluster, keyspace, and + // workflow name. + GetWorkflow(ctx context.Context, in *GetWorkflowRequest, opts ...grpc.CallOption) (*Workflow, error) + // GetWorkflows returns the Workflows for all specified clusters. + GetWorkflows(ctx context.Context, in *GetWorkflowsRequest, opts ...grpc.CallOption) (*GetWorkflowsResponse, error) // VTExplain provides information on how Vitess plans to execute a particular query. VTExplain(ctx context.Context, in *VTExplainRequest, opts ...grpc.CallOption) (*VTExplainResponse, error) } @@ -1655,23 +2004,41 @@ func (c *vTAdminClient) GetVSchemas(ctx context.Context, in *GetVSchemasRequest, return out, nil } -func (c *vTAdminClient) VTExplain(ctx context.Context, in *VTExplainRequest, opts ...grpc.CallOption) (*VTExplainResponse, error) { - out := new(VTExplainResponse) - err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/VTExplain", in, out, opts...) +func (c *vTAdminClient) GetWorkflow(ctx context.Context, in *GetWorkflowRequest, opts ...grpc.CallOption) (*Workflow, error) { + out := new(Workflow) + err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/GetWorkflow", in, out, opts...) if err != nil { return nil, err } return out, nil } -// VTAdminServer is the server API for VTAdmin service. -type VTAdminServer interface { - // FindSchema returns a single Schema that matches the provided table name - // across all specified clusters IDs. Not specifying a set of cluster IDs - // causes the search to span all configured clusters. - // - // An error occurs if either no table exists across any of the clusters with - // the specified table name, or if multiple tables exist with that name. +func (c *vTAdminClient) GetWorkflows(ctx context.Context, in *GetWorkflowsRequest, opts ...grpc.CallOption) (*GetWorkflowsResponse, error) { + out := new(GetWorkflowsResponse) + err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/GetWorkflows", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vTAdminClient) VTExplain(ctx context.Context, in *VTExplainRequest, opts ...grpc.CallOption) (*VTExplainResponse, error) { + out := new(VTExplainResponse) + err := c.cc.Invoke(ctx, "/vtadmin.VTAdmin/VTExplain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// VTAdminServer is the server API for VTAdmin service. +type VTAdminServer interface { + // FindSchema returns a single Schema that matches the provided table name + // across all specified clusters IDs. Not specifying a set of cluster IDs + // causes the search to span all configured clusters. + // + // An error occurs if either no table exists across any of the clusters with + // the specified table name, or if multiple tables exist with that name. FindSchema(context.Context, *FindSchemaRequest) (*Schema, error) // GetClusters returns all configured clusters. GetClusters(context.Context, *GetClustersRequest) (*GetClustersResponse, error) @@ -1694,6 +2061,11 @@ type VTAdminServer interface { GetVSchema(context.Context, *GetVSchemaRequest) (*VSchema, error) // GetVSchemas returns the VSchemas for all specified clusters. GetVSchemas(context.Context, *GetVSchemasRequest) (*GetVSchemasResponse, error) + // GetWorkflow returns a single Workflow for a given cluster, keyspace, and + // workflow name. + GetWorkflow(context.Context, *GetWorkflowRequest) (*Workflow, error) + // GetWorkflows returns the Workflows for all specified clusters. + GetWorkflows(context.Context, *GetWorkflowsRequest) (*GetWorkflowsResponse, error) // VTExplain provides information on how Vitess plans to execute a particular query. VTExplain(context.Context, *VTExplainRequest) (*VTExplainResponse, error) } @@ -1732,6 +2104,12 @@ func (*UnimplementedVTAdminServer) GetVSchema(ctx context.Context, req *GetVSche func (*UnimplementedVTAdminServer) GetVSchemas(ctx context.Context, req *GetVSchemasRequest) (*GetVSchemasResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetVSchemas not implemented") } +func (*UnimplementedVTAdminServer) GetWorkflow(ctx context.Context, req *GetWorkflowRequest) (*Workflow, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWorkflow not implemented") +} +func (*UnimplementedVTAdminServer) GetWorkflows(ctx context.Context, req *GetWorkflowsRequest) (*GetWorkflowsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWorkflows not implemented") +} func (*UnimplementedVTAdminServer) VTExplain(ctx context.Context, req *VTExplainRequest) (*VTExplainResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VTExplain not implemented") } @@ -1920,6 +2298,42 @@ func _VTAdmin_GetVSchemas_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _VTAdmin_GetWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWorkflowRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VTAdminServer).GetWorkflow(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtadmin.VTAdmin/GetWorkflow", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VTAdminServer).GetWorkflow(ctx, req.(*GetWorkflowRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VTAdmin_GetWorkflows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWorkflowsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VTAdminServer).GetWorkflows(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtadmin.VTAdmin/GetWorkflows", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VTAdminServer).GetWorkflows(ctx, req.(*GetWorkflowsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _VTAdmin_VTExplain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VTExplainRequest) if err := dec(in); err != nil { @@ -1982,6 +2396,14 @@ var _VTAdmin_serviceDesc = grpc.ServiceDesc{ MethodName: "GetVSchemas", Handler: _VTAdmin_GetVSchemas_Handler, }, + { + MethodName: "GetWorkflow", + Handler: _VTAdmin_GetWorkflow_Handler, + }, + { + MethodName: "GetWorkflows", + Handler: _VTAdmin_GetWorkflows_Handler, + }, { MethodName: "VTExplain", Handler: _VTAdmin_VTExplain_Handler, @@ -2032,6 +2454,56 @@ func (m *Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ClusterWorkflows) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClusterWorkflows) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClusterWorkflows) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Warnings) > 0 { + for iNdEx := len(m.Warnings) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Warnings[iNdEx]) + copy(dAtA[i:], m.Warnings[iNdEx]) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Warnings[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Workflows) > 0 { + for iNdEx := len(m.Workflows) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Workflows[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *Keyspace) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2398,6 +2870,64 @@ func (m *VTGate) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Workflow) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Workflow) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Workflow) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Workflow != nil { + { + size, err := m.Workflow.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Keyspace) > 0 { + i -= len(m.Keyspace) + copy(dAtA[i:], m.Keyspace) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Keyspace))) + i-- + dAtA[i] = 0x12 + } + if m.Cluster != nil { + { + size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *FindSchemaRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3026,7 +3556,7 @@ func (m *GetVSchemasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *VTExplainRequest) Marshal() (dAtA []byte, err error) { +func (m *GetWorkflowRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3036,12 +3566,12 @@ func (m *VTExplainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VTExplainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetWorkflowRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VTExplainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetWorkflowRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3050,10 +3580,20 @@ func (m *VTExplainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Sql) > 0 { - i -= len(m.Sql) - copy(dAtA[i:], m.Sql) - i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Sql))) + if m.ActiveOnly { + i-- + if m.ActiveOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x1a } @@ -3064,17 +3604,17 @@ func (m *VTExplainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Cluster) > 0 { - i -= len(m.Cluster) - copy(dAtA[i:], m.Cluster) - i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Cluster))) + if len(m.ClusterId) > 0 { + i -= len(m.ClusterId) + copy(dAtA[i:], m.ClusterId) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.ClusterId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *VTExplainResponse) Marshal() (dAtA []byte, err error) { +func (m *GetWorkflowsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3084,12 +3624,12 @@ func (m *VTExplainResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VTExplainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetWorkflowsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VTExplainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetWorkflowsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3098,64 +3638,253 @@ func (m *VTExplainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Response) > 0 { - i -= len(m.Response) - copy(dAtA[i:], m.Response) - i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Response))) + if len(m.IgnoreKeyspaces) > 0 { + for iNdEx := len(m.IgnoreKeyspaces) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.IgnoreKeyspaces[iNdEx]) + copy(dAtA[i:], m.IgnoreKeyspaces[iNdEx]) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.IgnoreKeyspaces[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.Keyspaces) > 0 { + for iNdEx := len(m.Keyspaces) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Keyspaces[iNdEx]) + copy(dAtA[i:], m.Keyspaces[iNdEx]) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Keyspaces[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.ActiveOnly { i-- - dAtA[i] = 0xa + if m.ActiveOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.ClusterIds) > 0 { + for iNdEx := len(m.ClusterIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ClusterIds[iNdEx]) + copy(dAtA[i:], m.ClusterIds[iNdEx]) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.ClusterIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func encodeVarintVtadmin(dAtA []byte, offset int, v uint64) int { - offset -= sovVtadmin(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *GetWorkflowsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *Cluster) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovVtadmin(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovVtadmin(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + +func (m *GetWorkflowsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Keyspace) Size() (n int) { - if m == nil { - return 0 - } +func (m *GetWorkflowsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Cluster != nil { - l = m.Cluster.Size() - n += 1 + l + sovVtadmin(uint64(l)) - } - if m.Keyspace != nil { - l = m.Keyspace.Size() - n += 1 + l + sovVtadmin(uint64(l)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Shards) > 0 { - for k, v := range m.Shards { - _ = k + if len(m.WorkflowsByCluster) > 0 { + for k := range m.WorkflowsByCluster { + v := m.WorkflowsByCluster[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintVtadmin(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintVtadmin(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VTExplainRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VTExplainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VTExplainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Sql) > 0 { + i -= len(m.Sql) + copy(dAtA[i:], m.Sql) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Sql))) + i-- + dAtA[i] = 0x1a + } + if len(m.Keyspace) > 0 { + i -= len(m.Keyspace) + copy(dAtA[i:], m.Keyspace) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Keyspace))) + i-- + dAtA[i] = 0x12 + } + if len(m.Cluster) > 0 { + i -= len(m.Cluster) + copy(dAtA[i:], m.Cluster) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Cluster))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VTExplainResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VTExplainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VTExplainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Response) > 0 { + i -= len(m.Response) + copy(dAtA[i:], m.Response) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Response))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintVtadmin(dAtA []byte, offset int, v uint64) int { + offset -= sovVtadmin(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Cluster) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClusterWorkflows) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Workflows) > 0 { + for _, e := range m.Workflows { + l = e.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } + } + if len(m.Warnings) > 0 { + for _, s := range m.Warnings { + l = len(s) + n += 1 + l + sovVtadmin(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Keyspace) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Cluster != nil { + l = m.Cluster.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.Keyspace != nil { + l = m.Keyspace.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } + if len(m.Shards) > 0 { + for k, v := range m.Shards { + _ = k _ = v l = 0 if v != nil { @@ -3299,6 +4028,30 @@ func (m *VTGate) Size() (n int) { return n } +func (m *Workflow) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Cluster != nil { + l = m.Cluster.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } + l = len(m.Keyspace) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.Workflow != nil { + l = m.Workflow.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *FindSchemaRequest) Size() (n int) { if m == nil { return 0 @@ -3597,13 +4350,13 @@ func (m *GetVSchemasResponse) Size() (n int) { return n } -func (m *VTExplainRequest) Size() (n int) { +func (m *GetWorkflowRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Cluster) + l = len(m.ClusterId) if l > 0 { n += 1 + l + sovVtadmin(uint64(l)) } @@ -3611,25 +4364,45 @@ func (m *VTExplainRequest) Size() (n int) { if l > 0 { n += 1 + l + sovVtadmin(uint64(l)) } - l = len(m.Sql) + l = len(m.Name) if l > 0 { n += 1 + l + sovVtadmin(uint64(l)) } + if m.ActiveOnly { + n += 2 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } -func (m *VTExplainResponse) Size() (n int) { +func (m *GetWorkflowsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Response) - if l > 0 { - n += 1 + l + sovVtadmin(uint64(l)) + if len(m.ClusterIds) > 0 { + for _, s := range m.ClusterIds { + l = len(s) + n += 1 + l + sovVtadmin(uint64(l)) + } + } + if m.ActiveOnly { + n += 2 + } + if len(m.Keyspaces) > 0 { + for _, s := range m.Keyspaces { + l = len(s) + n += 1 + l + sovVtadmin(uint64(l)) + } + } + if len(m.IgnoreKeyspaces) > 0 { + for _, s := range m.IgnoreKeyspaces { + l = len(s) + n += 1 + l + sovVtadmin(uint64(l)) + } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -3637,30 +4410,95 @@ func (m *VTExplainResponse) Size() (n int) { return n } -func sovVtadmin(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozVtadmin(x uint64) (n int) { - return sovVtadmin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Cluster) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVtadmin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF +func (m *GetWorkflowsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.WorkflowsByCluster) > 0 { + for k, v := range m.WorkflowsByCluster { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovVtadmin(uint64(l)) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + mapEntrySize := 1 + len(k) + sovVtadmin(uint64(len(k))) + l + n += mapEntrySize + 1 + sovVtadmin(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VTExplainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Cluster) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + l = len(m.Keyspace) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + l = len(m.Sql) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VTExplainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Response) + if l > 0 { + n += 1 + l + sovVtadmin(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVtadmin(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVtadmin(x uint64) (n int) { + return sovVtadmin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Cluster) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } fieldNum := int32(wire >> 3) @@ -3761,6 +4599,126 @@ func (m *Cluster) Unmarshal(dAtA []byte) error { } return nil } +func (m *ClusterWorkflows) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterWorkflows: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterWorkflows: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Workflows", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Workflows = append(m.Workflows, &Workflow{}) + if err := m.Workflows[len(m.Workflows)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Warnings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Warnings = append(m.Warnings, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Keyspace) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4815,7 +5773,7 @@ func (m *VTGate) Unmarshal(dAtA []byte) error { } return nil } -func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { +func (m *Workflow) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4838,15 +5796,51 @@ func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: FindSchemaRequest: wiretype end group for non-group") + return fmt.Errorf("proto: Workflow: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: FindSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Workflow: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Cluster == nil { + m.Cluster = &Cluster{} + } + if err := m.Cluster.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keyspace", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4874,13 +5868,449 @@ func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Table = string(dAtA[iNdEx:postIndex]) + m.Keyspace = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Workflow", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Workflow == nil { + m.Workflow = &vtctldata.Workflow{} + } + if err := m.Workflow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindSchemaRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Table = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetClustersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetClustersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetClustersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetClustersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetClustersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetClustersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Clusters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Clusters = append(m.Clusters, &Cluster{}) + if err := m.Clusters[len(m.Clusters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetGatesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetGatesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetGatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetGatesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetGatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetGatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Gates", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVtadmin @@ -4890,23 +6320,25 @@ func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthVtadmin } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthVtadmin } if postIndex > l { return io.ErrUnexpectedEOF } - m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + m.Gates = append(m.Gates, &VTGate{}) + if err := m.Gates[len(m.Gates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4933,7 +6365,7 @@ func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetClustersRequest) Unmarshal(dAtA []byte) error { +func (m *GetKeyspacesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4956,12 +6388,44 @@ func (m *GetClustersRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetClustersRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetKeyspacesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetClustersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetKeyspacesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -4987,7 +6451,7 @@ func (m *GetClustersRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetClustersResponse) Unmarshal(dAtA []byte) error { +func (m *GetKeyspacesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5010,15 +6474,15 @@ func (m *GetClustersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetClustersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetKeyspacesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetClustersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetKeyspacesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Clusters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Keyspaces", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5045,8 +6509,8 @@ func (m *GetClustersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Clusters = append(m.Clusters, &Cluster{}) - if err := m.Clusters[len(m.Clusters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Keyspaces = append(m.Keyspaces, &Keyspace{}) + if err := m.Keyspaces[len(m.Keyspaces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5075,7 +6539,7 @@ func (m *GetClustersResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetGatesRequest) Unmarshal(dAtA []byte) error { +func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5098,15 +6562,15 @@ func (m *GetGatesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetGatesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetSchemaRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetGatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5134,67 +6598,45 @@ func (m *GetGatesRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + m.ClusterId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVtadmin(dAtA[iNdEx:]) - if err != nil { - return err + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keyspace", wireType) } - if skippy < 0 { - return ErrInvalidLengthVtadmin + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthVtadmin } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetGatesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVtadmin + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetGatesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetGatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + m.Keyspace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVtadmin @@ -5204,25 +6646,23 @@ func (m *GetGatesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthVtadmin } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthVtadmin } if postIndex > l { return io.ErrUnexpectedEOF } - m.Gates = append(m.Gates, &VTGate{}) - if err := m.Gates[len(m.Gates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Table = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5249,7 +6689,7 @@ func (m *GetGatesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetKeyspacesRequest) Unmarshal(dAtA []byte) error { +func (m *GetSchemasRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5272,10 +6712,10 @@ func (m *GetKeyspacesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetKeyspacesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetSchemasRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetKeyspacesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetSchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5335,7 +6775,7 @@ func (m *GetKeyspacesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetKeyspacesResponse) Unmarshal(dAtA []byte) error { +func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5358,15 +6798,15 @@ func (m *GetKeyspacesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetKeyspacesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetSchemasResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetKeyspacesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetSchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keyspaces", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5393,8 +6833,8 @@ func (m *GetKeyspacesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Keyspaces = append(m.Keyspaces, &Keyspace{}) - if err := m.Keyspaces[len(m.Keyspaces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Schemas = append(m.Schemas, &Schema{}) + if err := m.Schemas[len(m.Schemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5423,7 +6863,7 @@ func (m *GetKeyspacesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { +func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5446,15 +6886,15 @@ func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetSchemaRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetTabletRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetTabletRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5482,43 +6922,11 @@ func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClusterId = string(dAtA[iNdEx:postIndex]) + m.Hostname = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keyspace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVtadmin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthVtadmin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthVtadmin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keyspace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5546,7 +6954,7 @@ func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Table = string(dAtA[iNdEx:postIndex]) + m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -5573,7 +6981,7 @@ func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetSchemasRequest) Unmarshal(dAtA []byte) error { +func (m *GetTabletsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5596,10 +7004,10 @@ func (m *GetSchemasRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetSchemasRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetTabletsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetSchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetTabletsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5659,7 +7067,7 @@ func (m *GetSchemasRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { +func (m *GetTabletsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5682,15 +7090,15 @@ func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetSchemasResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetTabletsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetSchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetTabletsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tablets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5717,8 +7125,8 @@ func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Schemas = append(m.Schemas, &Schema{}) - if err := m.Schemas[len(m.Schemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tablets = append(m.Tablets, &Tablet{}) + if err := m.Tablets[len(m.Tablets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5747,7 +7155,7 @@ func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { +func (m *GetVSchemaRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5770,15 +7178,15 @@ func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetTabletRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetVSchemaRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetTabletRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetVSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5806,11 +7214,11 @@ func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hostname = string(dAtA[iNdEx:postIndex]) + m.ClusterId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Keyspace", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5838,7 +7246,7 @@ func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) + m.Keyspace = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5865,7 +7273,7 @@ func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetTabletsRequest) Unmarshal(dAtA []byte) error { +func (m *GetVSchemasRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5888,10 +7296,10 @@ func (m *GetTabletsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetTabletsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetVSchemasRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetTabletsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetVSchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5951,7 +7359,7 @@ func (m *GetTabletsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetTabletsResponse) Unmarshal(dAtA []byte) error { +func (m *GetVSchemasResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5974,15 +7382,15 @@ func (m *GetTabletsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetTabletsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetVSchemasResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetTabletsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetVSchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tablets", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VSchemas", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6009,8 +7417,8 @@ func (m *GetTabletsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tablets = append(m.Tablets, &Tablet{}) - if err := m.Tablets[len(m.Tablets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.VSchemas = append(m.VSchemas, &VSchema{}) + if err := m.VSchemas[len(m.VSchemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6039,7 +7447,7 @@ func (m *GetTabletsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetVSchemaRequest) Unmarshal(dAtA []byte) error { +func (m *GetWorkflowRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6062,10 +7470,10 @@ func (m *GetVSchemaRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetVSchemaRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetWorkflowRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetVSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetWorkflowRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6132,6 +7540,58 @@ func (m *GetVSchemaRequest) Unmarshal(dAtA []byte) error { } m.Keyspace = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ActiveOnly = bool(v != 0) default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -6157,7 +7617,7 @@ func (m *GetVSchemaRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetVSchemasRequest) Unmarshal(dAtA []byte) error { +func (m *GetWorkflowsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6180,10 +7640,10 @@ func (m *GetVSchemasRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetVSchemasRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetWorkflowsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetVSchemasRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetWorkflowsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6218,6 +7678,90 @@ func (m *GetVSchemasRequest) Unmarshal(dAtA []byte) error { } m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ActiveOnly = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keyspaces", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keyspaces = append(m.Keyspaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IgnoreKeyspaces", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IgnoreKeyspaces = append(m.IgnoreKeyspaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -6243,7 +7787,7 @@ func (m *GetVSchemasRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetVSchemasResponse) Unmarshal(dAtA []byte) error { +func (m *GetWorkflowsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6266,15 +7810,15 @@ func (m *GetVSchemasResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetVSchemasResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetWorkflowsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetVSchemasResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetWorkflowsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VSchemas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WorkflowsByCluster", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6301,10 +7845,105 @@ func (m *GetVSchemasResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VSchemas = append(m.VSchemas, &VSchema{}) - if err := m.VSchemas[len(m.VSchemas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.WorkflowsByCluster == nil { + m.WorkflowsByCluster = make(map[string]*ClusterWorkflows) + } + var mapkey string + var mapvalue *ClusterWorkflows + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthVtadmin + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthVtadmin + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthVtadmin + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &ClusterWorkflows{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } + m.WorkflowsByCluster[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/go/vt/vtadmin/api.go b/go/vt/vtadmin/api.go index 3f3cb7fb292..d61968613aa 100644 --- a/go/vt/vtadmin/api.go +++ b/go/vt/vtadmin/api.go @@ -26,6 +26,7 @@ import ( "github.com/gorilla/handlers" "github.com/gorilla/mux" + "k8s.io/apimachinery/pkg/util/sets" "vitess.io/vitess/go/trace" "vitess.io/vitess/go/vt/concurrency" @@ -106,6 +107,8 @@ func NewAPI(clusters []*cluster.Cluster, opts grpcserver.Options, httpOpts vtadm router.HandleFunc("/vschema/{cluster_id}/{keyspace}", httpAPI.Adapt(vtadminhttp.GetVSchema)).Name("API.GetVSchema") router.HandleFunc("/vschemas", httpAPI.Adapt(vtadminhttp.GetVSchemas)).Name("API.GetVSchemas") router.HandleFunc("/vtexplain", httpAPI.Adapt(vtadminhttp.VTExplain)).Name("API.VTExplain") + router.HandleFunc("/workflow/{cluster_id}/{keyspace}/{name}", httpAPI.Adapt(vtadminhttp.GetWorkflow)).Name("API.GetWorkflow") + router.HandleFunc("/workflows", httpAPI.Adapt(vtadminhttp.GetWorkflows)).Name("API.GetWorkflows") // Middlewares are executed in order of addition. Our ordering (all // middlewares being optional) is: @@ -662,28 +665,6 @@ func (api *API) GetTablets(ctx context.Context, req *vtadminpb.GetTabletsRequest }, nil } -func (api *API) getClustersForRequest(ids []string) ([]*cluster.Cluster, []string) { - if len(ids) == 0 { - clusterIDs := make([]string, 0, len(api.clusters)) - - for k := range api.clusterMap { - clusterIDs = append(clusterIDs, k) - } - - return api.clusters, clusterIDs - } - - clusters := make([]*cluster.Cluster, 0, len(ids)) - - for _, id := range ids { - if c, ok := api.clusterMap[id]; ok { - clusters = append(clusters, c) - } - } - - return clusters, ids -} - // GetVSchema is part of the vtadminpb.VTAdminServer interface. func (api *API) GetVSchema(ctx context.Context, req *vtadminpb.GetVSchemaRequest) (*vtadminpb.VSchema, error) { span, ctx := trace.NewSpan(ctx, "API.GetVSchema") @@ -801,6 +782,73 @@ func (api *API) GetVSchemas(ctx context.Context, req *vtadminpb.GetVSchemasReque }, nil } +// GetWorkflow is part of the vtadminpb.VTAdminServer interface. +func (api *API) GetWorkflow(ctx context.Context, req *vtadminpb.GetWorkflowRequest) (*vtadminpb.Workflow, error) { + span, ctx := trace.NewSpan(ctx, "API.GetWorkflow") + defer span.Finish() + + c, ok := api.clusterMap[req.ClusterId] + if !ok { + return nil, fmt.Errorf("%w: no such cluster %s", errors.ErrUnsupportedCluster, req.ClusterId) + } + + cluster.AnnotateSpan(c, span) + span.Annotate("keyspace", req.Keyspace) + span.Annotate("workflow_name", req.Name) + span.Annotate("active_only", req.ActiveOnly) + + return c.GetWorkflow(ctx, req.Keyspace, req.Name, cluster.GetWorkflowOptions{ + ActiveOnly: req.ActiveOnly, + }) +} + +// GetWorkflows is part of the vtadminpb.VTAdminServer interface. +func (api *API) GetWorkflows(ctx context.Context, req *vtadminpb.GetWorkflowsRequest) (*vtadminpb.GetWorkflowsResponse, error) { + span, ctx := trace.NewSpan(ctx, "API.GetWorkflows") + defer span.Finish() + + clusters, _ := api.getClustersForRequest(req.ClusterIds) + + var ( + m sync.Mutex + wg sync.WaitGroup + rec concurrency.AllErrorRecorder + results = map[string]*vtadminpb.ClusterWorkflows{} + ) + + for _, c := range clusters { + wg.Add(1) + + go func(c *cluster.Cluster) { + defer wg.Done() + + workflows, err := c.GetWorkflows(ctx, req.Keyspaces, cluster.GetWorkflowsOptions{ + ActiveOnly: req.ActiveOnly, + IgnoreKeyspaces: sets.NewString(req.IgnoreKeyspaces...), + }) + if err != nil { + rec.RecordError(err) + + return + } + + m.Lock() + results[c.ID] = workflows + m.Unlock() + }(c) + } + + wg.Wait() + + if rec.HasErrors() { + return nil, rec.Error() + } + + return &vtadminpb.GetWorkflowsResponse{ + WorkflowsByCluster: results, + }, nil +} + // VTExplain is part of the vtadminpb.VTAdminServer interface. func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest) (*vtadminpb.VTExplainResponse, error) { span, ctx := trace.NewSpan(ctx, "API.VTExplain") @@ -962,3 +1010,25 @@ func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest) Response: response, }, nil } + +func (api *API) getClustersForRequest(ids []string) ([]*cluster.Cluster, []string) { + if len(ids) == 0 { + clusterIDs := make([]string, 0, len(api.clusters)) + + for k := range api.clusterMap { + clusterIDs = append(clusterIDs, k) + } + + return api.clusters, clusterIDs + } + + clusters := make([]*cluster.Cluster, 0, len(ids)) + + for _, id := range ids { + if c, ok := api.clusterMap[id]; ok { + clusters = append(clusters, c) + } + } + + return clusters, ids +} diff --git a/go/vt/vtadmin/api_test.go b/go/vt/vtadmin/api_test.go index b0680bb1421..f37eb8f148f 100644 --- a/go/vt/vtadmin/api_test.go +++ b/go/vt/vtadmin/api_test.go @@ -2569,6 +2569,584 @@ func TestGetVSchemas(t *testing.T) { } } +func TestGetWorkflow(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cfgs []vtadmintestutil.TestClusterConfig + req *vtadminpb.GetWorkflowRequest + expected *vtadminpb.Workflow + shouldErr bool + }{ + { + name: "success", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowRequest{ + ClusterId: "c1", + Keyspace: "testkeyspace", + Name: "workflow1", + }, + expected: &vtadminpb.Workflow{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "testkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + shouldErr: false, + }, + { + name: "no such workflow", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowRequest{ + ClusterId: "c1", + Keyspace: "testkeyspace", + Name: "workflow3", + }, + expected: nil, + shouldErr: true, + }, + { + name: "no such cluster", + cfgs: []vtadmintestutil.TestClusterConfig{}, + req: &vtadminpb.GetWorkflowRequest{ + ClusterId: "c1", + Keyspace: "testkeyspace", + Name: "workflow1", + }, + expected: nil, + shouldErr: true, + }, + } + + ctx := context.Background() + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + api := NewAPI( + vtadmintestutil.BuildClusters(tt.cfgs...), + grpcserver.Options{}, + http.Options{}, + ) + + resp, err := api.GetWorkflow(ctx, tt.req) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + assert.Equal(t, tt.expected, resp) + }) + } +} + +func TestGetWorkflows(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cfgs []vtadmintestutil.TestClusterConfig + req *vtadminpb.GetWorkflowsRequest + expected *vtadminpb.GetWorkflowsResponse + shouldErr bool + }{ + { + name: "success", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "testkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "otherkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "otherkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowsRequest{}, + expected: &vtadminpb.GetWorkflowsResponse{ + WorkflowsByCluster: map[string]*vtadminpb.ClusterWorkflows{ + "c1": { + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "testkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "testkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow2", + }, + }, + }, + }, + "c2": { + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + Keyspace: "otherkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "one cluster has partial error then request succeeds", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "testkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "otherkeyspace", + }, + { + Name: "badkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "otherkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + "badkeyspace": { + Error: assert.AnError, + }, + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowsRequest{}, + expected: &vtadminpb.GetWorkflowsResponse{ + WorkflowsByCluster: map[string]*vtadminpb.ClusterWorkflows{ + "c1": { + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "testkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "testkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow2", + }, + }, + }, + Warnings: []string{}, + }, + "c2": { + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + Keyspace: "otherkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + }, + Warnings: []string{"some warning about badkeyspace"}, + }, + }, + }, + shouldErr: false, + }, + { + name: "IgnoreKeyspaces applies across clusters", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "testkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "testkeyspace", + }, + { + Name: "otherkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + "otherkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowsRequest{ + IgnoreKeyspaces: []string{"testkeyspace"}, + }, + expected: &vtadminpb.GetWorkflowsResponse{ + WorkflowsByCluster: map[string]*vtadminpb.ClusterWorkflows{ + "c1": {}, + "c2": { + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + Keyspace: "otherkeyspace", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "one cluster has fatal error, request fails", + cfgs: []vtadmintestutil.TestClusterConfig{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "testkeyspace", + }, + }, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + VtctldClient: &vtadmintestutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Error: assert.AnError, // GetKeyspaces is a fatal error + }, + }, + }, + }, + req: &vtadminpb.GetWorkflowsRequest{}, + expected: nil, + shouldErr: true, + }, + } + + ctx := context.Background() + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + api := NewAPI( + vtadmintestutil.BuildClusters(tt.cfgs...), + grpcserver.Options{}, + http.Options{}, + ) + + resp, err := api.GetWorkflows(ctx, tt.req) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + require.NotNil(t, resp) + + vtadmintestutil.AssertGetWorkflowsResponsesEqual(t, tt.expected, resp) + }) + } +} + func TestVTExplain(t *testing.T) { t.Parallel() diff --git a/go/vt/vtadmin/cluster/cluster.go b/go/vt/vtadmin/cluster/cluster.go index d75b93402d9..f967a144107 100644 --- a/go/vt/vtadmin/cluster/cluster.go +++ b/go/vt/vtadmin/cluster/cluster.go @@ -21,9 +21,13 @@ import ( "database/sql" "fmt" "strings" + "sync" "time" + "k8s.io/apimachinery/pkg/util/sets" + "vitess.io/vitess/go/trace" + "vitess.io/vitess/go/vt/concurrency" "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/topo/topoproto" @@ -200,6 +204,152 @@ func (c *Cluster) parseTablet(rows *sql.Rows) (*vtadminpb.Tablet, error) { return tablet, nil } +// FindWorkflowsOptions is the set of options for FindWorkflows requests. +type FindWorkflowsOptions struct { + ActiveOnly bool + IgnoreKeyspaces sets.String + Filter func(workflow *vtadminpb.Workflow) bool +} + +// FindWorkflows returns a list of Workflows in this cluster, across the given +// keyspaces and filtering according to the options passed in. +// +// If the list of keyspaces to check is empty, then FindWorkflows will use the +// result of GetKeyspaces to search all keyspaces in the cluster. In this case, +// opts.IgnoreKeyspaces is respected. +// +// Callers should use this function when they want more fine-grained filtering, +// and GetWorkflows when they just want to filter on keyspace name. +// +// Note that if only a subset of keyspaces error on their vtctld GetWorkflows +// rpc, this is treated as a partial success, and the ClusterWorkflows response +// will include any errors in the Warnings slice. If all keyspaces fail, or if +// non-(Vtctld.GetWorkflows) calls fail, this is treated as an error by this +// function. +func (c *Cluster) FindWorkflows(ctx context.Context, keyspaces []string, opts FindWorkflowsOptions) (*vtadminpb.ClusterWorkflows, error) { + span, ctx := trace.NewSpan(ctx, "Cluster.FindWorkflows") + defer span.Finish() + + AnnotateSpan(c, span) + span.Annotate("active_only", opts.ActiveOnly) + + if err := c.Vtctld.Dial(ctx); err != nil { + return nil, fmt.Errorf("FindWorkflows(cluster = %v, keyspaces = %v, opts = %v) dial failed: %w", c.ID, keyspaces, opts, err) + } + + return c.findWorkflows(ctx, keyspaces, opts) +} + +func (c *Cluster) findWorkflows(ctx context.Context, keyspaces []string, opts FindWorkflowsOptions) (*vtadminpb.ClusterWorkflows, error) { + if opts.Filter == nil { + opts.Filter = func(_ *vtadminpb.Workflow) bool { return true } + } + + if opts.IgnoreKeyspaces == nil { + opts.IgnoreKeyspaces = sets.NewString() + } + + if len(keyspaces) == 0 { + span, ctx := trace.NewSpan(ctx, "Cluster.GetKeyspaces") + AnnotateSpan(c, span) + + resp, err := c.Vtctld.GetKeyspaces(ctx, &vtctldatapb.GetKeyspacesRequest{}) + if err != nil { + span.Finish() + return nil, fmt.Errorf("GetKeyspaces(cluster = %s) failed: %w", c.ID, err) + } + + for _, ks := range resp.Keyspaces { + keyspaces = append(keyspaces, ks.Name) + } + + span.Finish() + } else if opts.IgnoreKeyspaces.Len() > 0 { + log.Warningf("Cluster.findWorkflows: IgnoreKeyspaces was set, but Keyspaces was not empty; ignoring IgnoreKeyspaces in favor of explicitly checking everything in Keyspaces: (%s)", strings.Join(keyspaces, ", ")) + opts.IgnoreKeyspaces = sets.NewString() + } + + // Annotate the parent span with some additional information about the call. + if span, _ := trace.FromContext(ctx); span != nil { + span.Annotate("num_keyspaces", len(keyspaces)) + span.Annotate("keyspaces", strings.Join(keyspaces, ",")) + span.Annotate("num_ignore_keyspaces", opts.IgnoreKeyspaces.Len()) + span.Annotate("ignore_keyspaces", strings.Join(opts.IgnoreKeyspaces.List(), ",")) + } + + clusterpb := c.ToProto() + + var ( + m sync.Mutex + wg sync.WaitGroup + rec concurrency.AllErrorRecorder + results []*vtadminpb.Workflow + ) + + for _, ks := range keyspaces { + if opts.IgnoreKeyspaces.Has(ks) { + log.Infof("Cluster.findWorkflows: ignoring keyspace %s", ks) + + continue + } + + wg.Add(1) + + go func(ks string) { + defer wg.Done() + + span, ctx := trace.NewSpan(ctx, "Cluster.GetWorkflowsForKeyspace") + defer span.Finish() + + AnnotateSpan(c, span) + span.Annotate("keyspace", ks) + span.Annotate("active_only", opts.ActiveOnly) + + resp, err := c.Vtctld.GetWorkflows(ctx, &vtctldatapb.GetWorkflowsRequest{ + Keyspace: ks, + ActiveOnly: opts.ActiveOnly, + }) + if err != nil { + err = fmt.Errorf("GetWorkflows(cluster = %s, keyspace = %s, active_only = %v) failed: %w", c.ID, ks, opts.ActiveOnly, err) + rec.RecordError(err) + + return + } + + workflows := make([]*vtadminpb.Workflow, 0, len(resp.Workflows)) + for _, wf := range resp.Workflows { + workflow := &vtadminpb.Workflow{ + Cluster: clusterpb, + Keyspace: ks, + Workflow: wf, + } + + if opts.Filter(workflow) { + workflows = append(workflows, workflow) + } + } + + m.Lock() + results = append(results, workflows...) + m.Unlock() + }(ks) + } + + wg.Wait() + + // If every keyspace failed, treat this as an error. + if rec.HasErrors() && len(rec.Errors) == len(keyspaces) { + return nil, rec.Error() + } + + // Otherwise, append any failures into the warnings slice, and return what + // results we have. + return &vtadminpb.ClusterWorkflows{ + Workflows: results, + Warnings: rec.ErrorStrings(), + }, nil +} + // GetTablets returns all tablets in the cluster. func (c *Cluster) GetTablets(ctx context.Context) ([]*vtadminpb.Tablet, error) { span, ctx := trace.NewSpan(ctx, "Cluster.GetTablets") @@ -294,6 +444,83 @@ func (c *Cluster) GetVSchema(ctx context.Context, keyspace string) (*vtadminpb.V }, nil } +// GetWorkflowOptions is the set of filtering options for GetWorkflow requests. +type GetWorkflowOptions struct { + ActiveOnly bool +} + +// GetWorkflow returns the single Workflow in this cluster for the given +// keyspace and workflow name. It returns an error if either no workflows or +// multiple workflows are found. +func (c *Cluster) GetWorkflow(ctx context.Context, keyspace string, name string, opts GetWorkflowOptions) (*vtadminpb.Workflow, error) { + span, ctx := trace.NewSpan(ctx, "Cluster.GetWorkflow") + defer span.Finish() + + AnnotateSpan(c, span) + span.Annotate("active_only", opts.ActiveOnly) + span.Annotate("keyspace", keyspace) + span.Annotate("workflow_name", name) + + if err := c.Vtctld.Dial(ctx); err != nil { + return nil, fmt.Errorf("GetWorkflow(cluster = %v, keyspace = %v, workflow = %v, opts = %+v) dial failed: %w", c.ID, keyspace, name, opts, err) + } + + workflows, err := c.findWorkflows(ctx, []string{keyspace}, FindWorkflowsOptions{ + ActiveOnly: opts.ActiveOnly, + Filter: func(workflow *vtadminpb.Workflow) bool { + return workflow.Workflow.Name == name + }, + }) + if err != nil { + return nil, err + } + + switch len(workflows.Workflows) { + case 0: + msg := "%w for keyspace %s and name %s (active_only = %v)" + if len(workflows.Warnings) > 0 { + return nil, fmt.Errorf(msg+"; warnings: %v", errors.ErrNoWorkflow, keyspace, name, opts.ActiveOnly, workflows.Warnings) + } + + return nil, fmt.Errorf(msg, errors.ErrNoWorkflow, keyspace, name, opts.ActiveOnly) + case 1: + return workflows.Workflows[0], nil + default: + return nil, fmt.Errorf("%w: found %d workflows in keyspace %s with name %s (active_only = %v); this should be impossible", errors.ErrAmbiguousWorkflow, len(workflows.Workflows), keyspace, name, opts.ActiveOnly) + } +} + +// GetWorkflowsOptions is the set of filtering options for GetWorkflows +// requests. +type GetWorkflowsOptions struct { + ActiveOnly bool + IgnoreKeyspaces sets.String +} + +// GetWorkflows returns a list of Workflows in this cluster, across the given +// keyspaces and filtering according to the options passed in. +// +// If the list of keyspaces to check is empty, then GetWorkflows will use the +// result of GetKeyspaces to search all keyspaces in the cluster. In this case, +// opts.IgnoreKeyspaces is respected. +func (c *Cluster) GetWorkflows(ctx context.Context, keyspaces []string, opts GetWorkflowsOptions) (*vtadminpb.ClusterWorkflows, error) { + span, ctx := trace.NewSpan(ctx, "Cluster.GetWorkflows") + defer span.Finish() + + AnnotateSpan(c, span) + span.Annotate("active_only", opts.ActiveOnly) + + if err := c.Vtctld.Dial(ctx); err != nil { + return nil, fmt.Errorf("GetWorkflows(cluster = %v, keyspaces = %v, opts = %v) dial failed: %w", c.ID, keyspaces, opts, err) + } + + return c.findWorkflows(ctx, keyspaces, FindWorkflowsOptions{ + ActiveOnly: opts.ActiveOnly, + IgnoreKeyspaces: opts.IgnoreKeyspaces, + Filter: func(_ *vtadminpb.Workflow) bool { return true }, + }) +} + // FindTablet returns the first tablet in a given cluster that satisfies the filter function. func (c *Cluster) FindTablet(ctx context.Context, filter func(*vtadminpb.Tablet) bool) (*vtadminpb.Tablet, error) { span, ctx := trace.NewSpan(ctx, "Cluster.FindTablet") diff --git a/go/vt/vtadmin/cluster/cluster_test.go b/go/vt/vtadmin/cluster/cluster_test.go index 74f4f59a955..5133595c015 100644 --- a/go/vt/vtadmin/cluster/cluster_test.go +++ b/go/vt/vtadmin/cluster/cluster_test.go @@ -21,10 +21,12 @@ import ( "database/sql" "errors" "fmt" + "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "k8s.io/apimachinery/pkg/util/sets" "vitess.io/vitess/go/vt/vitessdriver" "vitess.io/vitess/go/vt/vtadmin/cluster" @@ -559,6 +561,392 @@ func TestGetSchema(t *testing.T) { }) } +func TestFindWorkflows(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cfg testutil.TestClusterConfig + keyspaces []string + opts cluster.FindWorkflowsOptions + expected *vtadminpb.ClusterWorkflows + shouldErr bool + }{ + { + name: "success", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + }, + }, + }, + keyspaces: []string{"ks1"}, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "error getting keyspaces is fatal", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: nil, + Error: assert.AnError, + }, + }, + }, + keyspaces: nil, + expected: nil, + shouldErr: true, + }, + { + name: "no keyspaces found", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{}, + Error: nil, + }, + }, + }, + keyspaces: nil, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{}, + }, + shouldErr: false, + }, + { + name: "when specifying keyspaces and IgnoreKeyspaces, IgnoreKeyspaces is discarded", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "ks1", + }, + { + Name: "ks2", + }, + }, + Error: nil, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + "ks2": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow_a", + }, + }, + }, + }, + }, + }, + }, + keyspaces: []string{"ks2"}, + opts: cluster.FindWorkflowsOptions{ + IgnoreKeyspaces: sets.NewString("ks2"), + }, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks2", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow_a", + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "ignore keyspaces", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "ks1", + }, + { + Name: "ks2", + }, + }, + Error: nil, + }, + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + "ks2": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow_a", + }, + }, + }, + }, + }, + }, + }, + keyspaces: nil, + opts: cluster.FindWorkflowsOptions{ + IgnoreKeyspaces: sets.NewString("ks2"), + }, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow2", + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "error getting workflows is fatal if all keyspaces fail", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Error: assert.AnError, + }, + }, + }, + }, + keyspaces: []string{"ks1"}, + expected: nil, + shouldErr: true, + }, + { + name: "error getting workflows is non-fatal if some keyspaces fail", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Error: assert.AnError, + }, + "ks2": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + }, + }, + }, + }, + }, + }, + keyspaces: []string{"ks1", "ks2"}, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks2", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow1", + }, + }, + }, + Warnings: []string{"something about ks1"}, + }, + shouldErr: false, + }, + { + name: "filtered workflows", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "include_me", + }, + { + Name: "dont_include_me", + }, + }, + }, + }, + }, + }, + }, + keyspaces: []string{"ks1"}, + opts: cluster.FindWorkflowsOptions{ + Filter: func(workflow *vtadminpb.Workflow) bool { + return strings.HasPrefix(workflow.Workflow.Name, "include_me") + }, + }, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "include_me", + }, + }, + }, + }, + shouldErr: false, + }, + } + + ctx := context.Background() + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + c := testutil.BuildCluster(tt.cfg) + workflows, err := c.FindWorkflows(ctx, tt.keyspaces, tt.opts) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + testutil.AssertClusterWorkflowsEqual(t, tt.expected, workflows) + }) + } +} + // This test only validates the error handling on dialing database connections. // Other cases are covered by one or both of TestFindTablets and TestFindTablet. func TestGetTablets(t *testing.T) { @@ -674,3 +1062,326 @@ func TestGetVSchema(t *testing.T) { }) } } + +func TestGetWorkflow(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cfg testutil.TestClusterConfig + keyspace string + workflow string + opts cluster.GetWorkflowOptions + expected *vtadminpb.Workflow + shouldErr bool + }{ + { + name: "found", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "workflow1", + }, + { + Name: "workflow2", + }, + }, + }, + }, + }, + }, + }, + keyspace: "ks1", + workflow: "workflow2", + expected: &vtadminpb.Workflow{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "workflow2", + }, + }, + shouldErr: false, + }, + { + name: "error getting workflows", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Error: assert.AnError, + }, + }, + }, + }, + keyspace: "ks1", + workflow: "workflow2", + expected: nil, + shouldErr: true, + }, + { + name: "no workflows found", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{}, + }, + }, + }, + }, + }, + keyspace: "ks1", + workflow: "workflow2", + expected: nil, + shouldErr: true, + }, + { + name: "multiple workflows found", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "duplicate", + }, + { + Name: "duplicate", + }, + }, + }, + }, + }, + }, + }, + keyspace: "ks1", + workflow: "duplicate", + expected: nil, + shouldErr: true, + }, + } + + ctx := context.Background() + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + c := testutil.BuildCluster(tt.cfg) + workflow, err := c.GetWorkflow(ctx, tt.keyspace, tt.workflow, tt.opts) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + assert.Equal(t, tt.expected, workflow) + }) + } +} + +func TestGetWorkflows(t *testing.T) { + t.Parallel() + + // Note: GetWorkflows is almost entirely a passthrough to FindWorkflows, so + // these test cases mostly just verify we're calling that function more or + // less correctly. + + tests := []struct { + name string + cfg testutil.TestClusterConfig + keyspaces []string + opts cluster.GetWorkflowsOptions + expected *vtadminpb.ClusterWorkflows + shouldErr bool + }{ + { + name: "success", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "ks1-workflow1", + }, + }, + }, + }, + "ks2": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "ks2-workflow1", + }, + }, + }, + }, + }, + }, + }, + keyspaces: []string{"ks1", "ks2"}, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "ks1-workflow1", + }, + }, + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks2", + Workflow: &vtctldatapb.Workflow{ + Name: "ks2-workflow1", + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "partial error", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Response: &vtctldatapb.GetWorkflowsResponse{ + Workflows: []*vtctldatapb.Workflow{ + { + Name: "ks1-workflow1", + }, + }, + }, + }, + "ks2": { + Error: assert.AnError, + }, + }, + }, + }, + keyspaces: []string{"ks1", "ks2"}, + expected: &vtadminpb.ClusterWorkflows{ + Workflows: []*vtadminpb.Workflow{ + { + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + Keyspace: "ks1", + Workflow: &vtctldatapb.Workflow{ + Name: "ks1-workflow1", + }, + }, + }, + Warnings: []string{"something about ks2"}, + }, + shouldErr: false, + }, + { + name: "error", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + }, + VtctldClient: &testutil.VtctldClient{ + GetWorkflowsResults: map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + }{ + "ks1": { + Error: assert.AnError, + }, + }, + }, + }, + keyspaces: []string{"ks1"}, + expected: nil, + shouldErr: true, + }, + } + + ctx := context.Background() + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + c := testutil.BuildCluster(tt.cfg) + workflows, err := c.GetWorkflows(ctx, tt.keyspaces, tt.opts) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + testutil.AssertClusterWorkflowsEqual(t, tt.expected, workflows) + }) + } +} diff --git a/go/vt/vtadmin/errors/errors.go b/go/vt/vtadmin/errors/errors.go index a896554e685..8a6a1f088e0 100644 --- a/go/vt/vtadmin/errors/errors.go +++ b/go/vt/vtadmin/errors/errors.go @@ -25,6 +25,10 @@ var ( // ErrAmbiguousTablet occurs when more than one tablet is found for a given // set of filter criteria. ErrAmbiguousTablet = errors.New("multiple tablets found") + // ErrAmbiguousWorkflow occurs when more than one workflow is found for a + // set of filter criteria that should ordinarily never return more than one + // workflow. + ErrAmbiguousWorkflow = errors.New("multiple workflows found") // ErrInvalidRequest occurs when a request is invalid for any reason. // For example, if mandatory parameters are undefined. ErrInvalidRequest = errors.New("Invalid request") @@ -36,6 +40,9 @@ var ( // ErrNoTablet occurs when a tablet cannot be found for a given set of // filter criteria. ErrNoTablet = errors.New("no such tablet") + // ErrNoWorkflow occurs when a workflow cannot be found for a given set of + // filter criteria. + ErrNoWorkflow = errors.New("no such workflow") // ErrUnsupportedCluster occurs when a cluster parameter is invalid. ErrUnsupportedCluster = errors.New("unsupported cluster(s)") ) diff --git a/go/vt/vtadmin/errors/typed_error.go b/go/vt/vtadmin/errors/typed_error.go index f5174cbaeae..eec521990c7 100644 --- a/go/vt/vtadmin/errors/typed_error.go +++ b/go/vt/vtadmin/errors/typed_error.go @@ -30,6 +30,17 @@ type TypedError interface { HTTPStatus() int } +// BadRequest is returned when some request parameter is invalid. +type BadRequest struct { + Err error + ErrDetails interface{} +} + +func (e *BadRequest) Error() string { return e.Err.Error() } +func (e *BadRequest) Code() string { return "bad request" } +func (e *BadRequest) Details() interface{} { return e.ErrDetails } +func (e *BadRequest) HTTPStatus() int { return 400 } + // Unknown is the generic error, used when a more specific error is either // unspecified or inappropriate. type Unknown struct { diff --git a/go/vt/vtadmin/http/request.go b/go/vt/vtadmin/http/request.go index 6c0b7181c47..cdf4f006a17 100644 --- a/go/vt/vtadmin/http/request.go +++ b/go/vt/vtadmin/http/request.go @@ -17,9 +17,13 @@ limitations under the License. package http import ( + "fmt" "net/http" + "strconv" "github.com/gorilla/mux" + + "vitess.io/vitess/go/vt/vtadmin/errors" ) // Request wraps an *http.Request to provide some convenience functions for @@ -31,3 +35,22 @@ type Request struct{ *http.Request } func (r Request) Vars() map[string]string { return mux.Vars(r.Request) } + +// ParseQueryParamAsBool attempts to parse the query parameter of the given name +// into a boolean value. If the parameter is not set, the provided default value +// is returned. +func (r Request) ParseQueryParamAsBool(name string, defaultVal bool) (bool, error) { + if param := r.URL.Query().Get(name); param != "" { + val, err := strconv.ParseBool(param) + if err != nil { + return defaultVal, &errors.BadRequest{ + Err: err, + ErrDetails: fmt.Sprintf("could not parse query parameter %s (= %v) into bool value", name, param), + } + } + + return val, nil + } + + return defaultVal, nil +} diff --git a/go/vt/vtadmin/http/request_test.go b/go/vt/vtadmin/http/request_test.go new file mode 100644 index 00000000000..ba235a4877f --- /dev/null +++ b/go/vt/vtadmin/http/request_test.go @@ -0,0 +1,98 @@ +/* +Copyright 2021 The Vitess Authors. + +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 http + +import ( + "fmt" + "net/http" + "net/url" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestParseQueryParamAsBool(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + fragment string + param string + defaultValue bool + expected bool + shouldErr bool + }{ + { + name: "successful parse", + fragment: "?a=true&b=false", + param: "a", + defaultValue: false, + expected: true, + shouldErr: false, + }, + { + name: "no query fragment", + fragment: "", + param: "active_only", + defaultValue: false, + expected: false, + shouldErr: false, + }, + { + name: "param not set", + fragment: "?foo=bar", + param: "baz", + defaultValue: true, + expected: true, + shouldErr: false, + }, + { + name: "param not bool-like", + fragment: "?foo=bar", + param: "foo", + defaultValue: false, + shouldErr: true, + }, + } + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + rawurl := fmt.Sprintf("http://example.com/%s", tt.fragment) + u, err := url.Parse(rawurl) + require.NoError(t, err, "could not parse %s", rawurl) + + r := Request{ + &http.Request{URL: u}, + } + + val, err := r.ParseQueryParamAsBool(tt.param, tt.defaultValue) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + assert.NoError(t, err) + assert.Equal(t, tt.expected, val) + }) + } +} diff --git a/go/vt/vtadmin/http/workflows.go b/go/vt/vtadmin/http/workflows.go new file mode 100644 index 00000000000..2a6fed4766e --- /dev/null +++ b/go/vt/vtadmin/http/workflows.go @@ -0,0 +1,71 @@ +/* +Copyright 2021 The Vitess Authors. + +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 http + +import ( + "context" + + vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" +) + +// GetWorkflow implements the http wrapper for the VTAdminServer.GetWorkflow +// method. +// +// Its route is /workflow/{cluster_id}/{keyspace}/{name}[?active_only=]. +func GetWorkflow(ctx context.Context, r Request, api *API) *JSONResponse { + vars := r.Vars() + + activeOnly, err := r.ParseQueryParamAsBool("active_only", false) + if err != nil { + return NewJSONResponse(nil, err) + } + + workflow, err := api.server.GetWorkflow(ctx, &vtadminpb.GetWorkflowRequest{ + ClusterId: vars["cluster_id"], + Keyspace: vars["keyspace"], + Name: vars["name"], + ActiveOnly: activeOnly, + }) + + return NewJSONResponse(workflow, err) +} + +// GetWorkflows implements the http wrapper for the VTAdminServer.GetWorkflows +// method. +// +// Its route is /workflows, with query params: +// - cluster: repeated, cluster IDs +// - active_only +// - keyspace: repeated +// - ignore_keyspace: repeated +func GetWorkflows(ctx context.Context, r Request, api *API) *JSONResponse { + query := r.URL.Query() + + activeOnly, err := r.ParseQueryParamAsBool("active_only", false) + if err != nil { + return NewJSONResponse(nil, err) + } + + workflows, err := api.server.GetWorkflows(ctx, &vtadminpb.GetWorkflowsRequest{ + ClusterIds: query["cluster"], + Keyspaces: query["keyspace"], + IgnoreKeyspaces: query["ignore_keyspace"], + ActiveOnly: activeOnly, + }) + + return NewJSONResponse(workflows, err) +} diff --git a/go/vt/vtadmin/testutil/vtctldclient.go b/go/vt/vtadmin/testutil/vtctldclient.go index b957bbd873b..b38eea5b83f 100644 --- a/go/vt/vtadmin/testutil/vtctldclient.go +++ b/go/vt/vtadmin/testutil/vtctldclient.go @@ -46,6 +46,10 @@ type VtctldClient struct { Response *vtctldatapb.GetVSchemaResponse Error error } + GetWorkflowsResults map[string]struct { + Response *vtctldatapb.GetWorkflowsResponse + Error error + } } // Compile-time type assertion to make sure we haven't overriden a method @@ -85,7 +89,7 @@ func (fake *VtctldClient) GetSchema(ctx context.Context, req *vtctldatapb.GetSch // GetVSchema is part of the vtctldclient.VtctldClient interface. func (fake *VtctldClient) GetVSchema(ctx context.Context, req *vtctldatapb.GetVSchemaRequest, opts ...grpc.CallOption) (*vtctldatapb.GetVSchemaResponse, error) { if fake.GetVSchemaResults == nil { - return nil, fmt.Errorf("%w: GetVSchemaResults not set of fake vtctldclient", assert.AnError) + return nil, fmt.Errorf("%w: GetVSchemaResults not set on fake vtctldclient", assert.AnError) } if result, ok := fake.GetVSchemaResults[req.Keyspace]; ok { @@ -94,3 +98,16 @@ func (fake *VtctldClient) GetVSchema(ctx context.Context, req *vtctldatapb.GetVS return nil, fmt.Errorf("%w: no result set for keyspace %s", assert.AnError, req.Keyspace) } + +// GetWorkflows is part of the vtctldclient.VtctldClient interface. +func (fake *VtctldClient) GetWorkflows(ctx context.Context, req *vtctldatapb.GetWorkflowsRequest, opts ...grpc.CallOption) (*vtctldatapb.GetWorkflowsResponse, error) { + if fake.GetWorkflowsResults == nil { + return nil, fmt.Errorf("%w: GetWorkflowsResults not set on fake vtctldclient", assert.AnError) + } + + if result, ok := fake.GetWorkflowsResults[req.Keyspace]; ok { + return result.Response, result.Error + } + + return nil, fmt.Errorf("%w: no result set for keyspace %s", assert.AnError, req.Keyspace) +} diff --git a/go/vt/vtadmin/testutil/workflows.go b/go/vt/vtadmin/testutil/workflows.go new file mode 100644 index 00000000000..de6e27744a4 --- /dev/null +++ b/go/vt/vtadmin/testutil/workflows.go @@ -0,0 +1,75 @@ +/* +Copyright 2021 The Vitess Authors. + +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 testutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" +) + +// AssertClusterWorkflowsEqual is a test helper for asserting that two +// ClusterWorkflows objects are equal. +func AssertClusterWorkflowsEqual(t *testing.T, expected *vtadminpb.ClusterWorkflows, actual *vtadminpb.ClusterWorkflows, msgAndArgs ...interface{}) { + t.Helper() + + if expected == nil && actual == nil { + return + } + + require.NotNil(t, expected, msgAndArgs...) + require.NotNil(t, actual, msgAndArgs...) + + if expected.Warnings != nil && actual.Warnings != nil { + assert.Equal(t, len(expected.Warnings), len(actual.Warnings), msgAndArgs...) + } + + assert.ElementsMatch(t, expected.Workflows, actual.Workflows, msgAndArgs...) +} + +// AssertGetWorkflowsResponsesEqual is a test helper for asserting that two +// GetWorkflowsResponse objects are equal. +func AssertGetWorkflowsResponsesEqual(t *testing.T, expected *vtadminpb.GetWorkflowsResponse, actual *vtadminpb.GetWorkflowsResponse, msgAndArgs ...interface{}) { + t.Helper() + + if expected == nil && actual == nil { + return + } + + require.NotNil(t, expected, msgAndArgs...) + require.NotNil(t, actual, msgAndArgs...) + + keysLeft := make([]string, 0, len(expected.WorkflowsByCluster)) + keysRight := make([]string, 0, len(actual.WorkflowsByCluster)) + + for k := range expected.WorkflowsByCluster { + keysLeft = append(keysLeft, k) + } + + for k := range actual.WorkflowsByCluster { + keysRight = append(keysRight, k) + } + + require.ElementsMatch(t, keysLeft, keysRight, msgAndArgs...) + + for _, k := range keysLeft { + AssertClusterWorkflowsEqual(t, expected.WorkflowsByCluster[k], actual.WorkflowsByCluster[k], msgAndArgs...) + } +} diff --git a/proto/vtadmin.proto b/proto/vtadmin.proto index 91a2939aabc..456ea8bcc6f 100644 --- a/proto/vtadmin.proto +++ b/proto/vtadmin.proto @@ -59,6 +59,11 @@ service VTAdmin { rpc GetVSchema(GetVSchemaRequest) returns (VSchema) {}; // GetVSchemas returns the VSchemas for all specified clusters. rpc GetVSchemas(GetVSchemasRequest) returns (GetVSchemasResponse) {}; + // GetWorkflow returns a single Workflow for a given cluster, keyspace, and + // workflow name. + rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) {}; + // GetWorkflows returns the Workflows for all specified clusters. + rpc GetWorkflows(GetWorkflowsRequest) returns (GetWorkflowsResponse) {}; // VTExplain provides information on how Vitess plans to execute a particular query. rpc VTExplain(VTExplainRequest) returns (VTExplainResponse) {}; } @@ -71,6 +76,13 @@ message Cluster { string name = 2; } +message ClusterWorkflows { + repeated Workflow workflows = 1; + // Warnings is a list of non-fatal errors encountered when fetching + // workflows for a particular cluster. + repeated string warnings = 2; +} + // Keyspace represents information about a keyspace in a particular Vitess // cluster. message Keyspace { @@ -131,6 +143,12 @@ message VTGate { repeated string keyspaces = 5; } +message Workflow { + Cluster cluster = 1; + string keyspace = 2; + vtctldata.Workflow workflow = 3; +} + /* Request/Response types */ message FindSchemaRequest { @@ -203,6 +221,39 @@ message GetVSchemasResponse { repeated VSchema v_schemas = 1; } +message GetWorkflowRequest { + string cluster_id = 1; + string keyspace = 2; + string name = 3; + bool active_only = 4; +} + +message GetWorkflowsRequest { + repeated string cluster_ids = 1; + // ActiveOnly specifies whether to return workflows that are currently + // active (running or paused) instead of all workflows. + bool active_only = 2; + // Keyspaces is a list of keyspaces to restrict the workflow search to. Note + // that the keyspaces list applies across all cluster IDs in the request. + // + // If, for example, you have two clusters, each with a keyspace called "foo" + // and want the workflows from "foo" in cluster1 but not from cluster2, you + // must make two requests. + // + // Keyspaces and IgnoreKeyspaces are mutually-exclusive, and Keyspaces takes + // precedence; if Keyspaces is a non-empty list, then IgnoreKeyspaces is + // ignored completely. + repeated string keyspaces = 3; + // IgnoreKeyspaces is a list of keyspaces to skip during the workflow + // search. It has the same semantics as the Keyspaces parameter, so refer to + // that documentation for more details. + repeated string ignore_keyspaces = 4; +} + +message GetWorkflowsResponse { + map workflows_by_cluster = 1; +} + message VTExplainRequest { string cluster = 1; string keyspace = 2; diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index 633a0639b48..0a27f81915d 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -162,6 +162,34 @@ export namespace vtadmin { */ public getVSchemas(request: vtadmin.IGetVSchemasRequest): Promise; + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Workflow + */ + public getWorkflow(request: vtadmin.IGetWorkflowRequest, callback: vtadmin.VTAdmin.GetWorkflowCallback): void; + + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @returns Promise + */ + public getWorkflow(request: vtadmin.IGetWorkflowRequest): Promise; + + /** + * Calls GetWorkflows. + * @param request GetWorkflowsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetWorkflowsResponse + */ + public getWorkflows(request: vtadmin.IGetWorkflowsRequest, callback: vtadmin.VTAdmin.GetWorkflowsCallback): void; + + /** + * Calls GetWorkflows. + * @param request GetWorkflowsRequest message or plain object + * @returns Promise + */ + public getWorkflows(request: vtadmin.IGetWorkflowsRequest): Promise; + /** * Calls VTExplain. * @param request VTExplainRequest message or plain object @@ -249,6 +277,20 @@ export namespace vtadmin { */ type GetVSchemasCallback = (error: (Error|null), response?: vtadmin.GetVSchemasResponse) => void; + /** + * Callback as used by {@link vtadmin.VTAdmin#getWorkflow}. + * @param error Error, if any + * @param [response] Workflow + */ + type GetWorkflowCallback = (error: (Error|null), response?: vtadmin.Workflow) => void; + + /** + * Callback as used by {@link vtadmin.VTAdmin#getWorkflows}. + * @param error Error, if any + * @param [response] GetWorkflowsResponse + */ + type GetWorkflowsCallback = (error: (Error|null), response?: vtadmin.GetWorkflowsResponse) => void; + /** * Callback as used by {@link vtadmin.VTAdmin#vTExplain}. * @param error Error, if any @@ -353,6 +395,102 @@ export namespace vtadmin { public toJSON(): { [k: string]: any }; } + /** Properties of a ClusterWorkflows. */ + interface IClusterWorkflows { + + /** ClusterWorkflows workflows */ + workflows?: (vtadmin.IWorkflow[]|null); + + /** ClusterWorkflows warnings */ + warnings?: (string[]|null); + } + + /** Represents a ClusterWorkflows. */ + class ClusterWorkflows implements IClusterWorkflows { + + /** + * Constructs a new ClusterWorkflows. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IClusterWorkflows); + + /** ClusterWorkflows workflows. */ + public workflows: vtadmin.IWorkflow[]; + + /** ClusterWorkflows warnings. */ + public warnings: string[]; + + /** + * Creates a new ClusterWorkflows instance using the specified properties. + * @param [properties] Properties to set + * @returns ClusterWorkflows instance + */ + public static create(properties?: vtadmin.IClusterWorkflows): vtadmin.ClusterWorkflows; + + /** + * Encodes the specified ClusterWorkflows message. Does not implicitly {@link vtadmin.ClusterWorkflows.verify|verify} messages. + * @param message ClusterWorkflows message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IClusterWorkflows, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClusterWorkflows message, length delimited. Does not implicitly {@link vtadmin.ClusterWorkflows.verify|verify} messages. + * @param message ClusterWorkflows message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IClusterWorkflows, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClusterWorkflows message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClusterWorkflows + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.ClusterWorkflows; + + /** + * Decodes a ClusterWorkflows message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClusterWorkflows + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.ClusterWorkflows; + + /** + * Verifies a ClusterWorkflows message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClusterWorkflows message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClusterWorkflows + */ + public static fromObject(object: { [k: string]: any }): vtadmin.ClusterWorkflows; + + /** + * Creates a plain object from a ClusterWorkflows message. Also converts values to other types if specified. + * @param message ClusterWorkflows + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.ClusterWorkflows, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClusterWorkflows to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Keyspace. */ interface IKeyspace { @@ -981,6 +1119,108 @@ export namespace vtadmin { public toJSON(): { [k: string]: any }; } + /** Properties of a Workflow. */ + interface IWorkflow { + + /** Workflow cluster */ + cluster?: (vtadmin.ICluster|null); + + /** Workflow keyspace */ + keyspace?: (string|null); + + /** Workflow workflow */ + workflow?: (vtctldata.IWorkflow|null); + } + + /** Represents a Workflow. */ + class Workflow implements IWorkflow { + + /** + * Constructs a new Workflow. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IWorkflow); + + /** Workflow cluster. */ + public cluster?: (vtadmin.ICluster|null); + + /** Workflow keyspace. */ + public keyspace: string; + + /** Workflow workflow. */ + public workflow?: (vtctldata.IWorkflow|null); + + /** + * Creates a new Workflow instance using the specified properties. + * @param [properties] Properties to set + * @returns Workflow instance + */ + public static create(properties?: vtadmin.IWorkflow): vtadmin.Workflow; + + /** + * Encodes the specified Workflow message. Does not implicitly {@link vtadmin.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link vtadmin.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.Workflow; + + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.Workflow; + + /** + * Verifies a Workflow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Workflow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Workflow + */ + public static fromObject(object: { [k: string]: any }): vtadmin.Workflow; + + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @param message Workflow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.Workflow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Workflow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a FindSchemaRequest. */ interface IFindSchemaRequest { @@ -2445,6 +2685,312 @@ export namespace vtadmin { public toJSON(): { [k: string]: any }; } + /** Properties of a GetWorkflowRequest. */ + interface IGetWorkflowRequest { + + /** GetWorkflowRequest cluster_id */ + cluster_id?: (string|null); + + /** GetWorkflowRequest keyspace */ + keyspace?: (string|null); + + /** GetWorkflowRequest name */ + name?: (string|null); + + /** GetWorkflowRequest active_only */ + active_only?: (boolean|null); + } + + /** Represents a GetWorkflowRequest. */ + class GetWorkflowRequest implements IGetWorkflowRequest { + + /** + * Constructs a new GetWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IGetWorkflowRequest); + + /** GetWorkflowRequest cluster_id. */ + public cluster_id: string; + + /** GetWorkflowRequest keyspace. */ + public keyspace: string; + + /** GetWorkflowRequest name. */ + public name: string; + + /** GetWorkflowRequest active_only. */ + public active_only: boolean; + + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWorkflowRequest instance + */ + public static create(properties?: vtadmin.IGetWorkflowRequest): vtadmin.GetWorkflowRequest; + + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link vtadmin.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.GetWorkflowRequest; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.GetWorkflowRequest; + + /** + * Verifies a GetWorkflowRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): vtadmin.GetWorkflowRequest; + + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @param message GetWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.GetWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetWorkflowsRequest. */ + interface IGetWorkflowsRequest { + + /** GetWorkflowsRequest cluster_ids */ + cluster_ids?: (string[]|null); + + /** GetWorkflowsRequest active_only */ + active_only?: (boolean|null); + + /** GetWorkflowsRequest keyspaces */ + keyspaces?: (string[]|null); + + /** GetWorkflowsRequest ignore_keyspaces */ + ignore_keyspaces?: (string[]|null); + } + + /** Represents a GetWorkflowsRequest. */ + class GetWorkflowsRequest implements IGetWorkflowsRequest { + + /** + * Constructs a new GetWorkflowsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IGetWorkflowsRequest); + + /** GetWorkflowsRequest cluster_ids. */ + public cluster_ids: string[]; + + /** GetWorkflowsRequest active_only. */ + public active_only: boolean; + + /** GetWorkflowsRequest keyspaces. */ + public keyspaces: string[]; + + /** GetWorkflowsRequest ignore_keyspaces. */ + public ignore_keyspaces: string[]; + + /** + * Creates a new GetWorkflowsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWorkflowsRequest instance + */ + public static create(properties?: vtadmin.IGetWorkflowsRequest): vtadmin.GetWorkflowsRequest; + + /** + * Encodes the specified GetWorkflowsRequest message. Does not implicitly {@link vtadmin.GetWorkflowsRequest.verify|verify} messages. + * @param message GetWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IGetWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWorkflowsRequest message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowsRequest.verify|verify} messages. + * @param message GetWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IGetWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWorkflowsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.GetWorkflowsRequest; + + /** + * Decodes a GetWorkflowsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.GetWorkflowsRequest; + + /** + * Verifies a GetWorkflowsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWorkflowsRequest + */ + public static fromObject(object: { [k: string]: any }): vtadmin.GetWorkflowsRequest; + + /** + * Creates a plain object from a GetWorkflowsRequest message. Also converts values to other types if specified. + * @param message GetWorkflowsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.GetWorkflowsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWorkflowsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetWorkflowsResponse. */ + interface IGetWorkflowsResponse { + + /** GetWorkflowsResponse workflows_by_cluster */ + workflows_by_cluster?: ({ [k: string]: vtadmin.IClusterWorkflows }|null); + } + + /** Represents a GetWorkflowsResponse. */ + class GetWorkflowsResponse implements IGetWorkflowsResponse { + + /** + * Constructs a new GetWorkflowsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IGetWorkflowsResponse); + + /** GetWorkflowsResponse workflows_by_cluster. */ + public workflows_by_cluster: { [k: string]: vtadmin.IClusterWorkflows }; + + /** + * Creates a new GetWorkflowsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWorkflowsResponse instance + */ + public static create(properties?: vtadmin.IGetWorkflowsResponse): vtadmin.GetWorkflowsResponse; + + /** + * Encodes the specified GetWorkflowsResponse message. Does not implicitly {@link vtadmin.GetWorkflowsResponse.verify|verify} messages. + * @param message GetWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IGetWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWorkflowsResponse message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowsResponse.verify|verify} messages. + * @param message GetWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IGetWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWorkflowsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.GetWorkflowsResponse; + + /** + * Decodes a GetWorkflowsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.GetWorkflowsResponse; + + /** + * Verifies a GetWorkflowsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWorkflowsResponse + */ + public static fromObject(object: { [k: string]: any }): vtadmin.GetWorkflowsResponse; + + /** + * Creates a plain object from a GetWorkflowsResponse message. Also converts values to other types if specified. + * @param message GetWorkflowsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.GetWorkflowsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWorkflowsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a VTExplainRequest. */ interface IVTExplainRequest { diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index 261f288cc9d..615793e2de1 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -380,6 +380,72 @@ $root.vtadmin = (function() { * @variation 2 */ + /** + * Callback as used by {@link vtadmin.VTAdmin#getWorkflow}. + * @memberof vtadmin.VTAdmin + * @typedef GetWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {vtadmin.Workflow} [response] Workflow + */ + + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof vtadmin.VTAdmin + * @instance + * @param {vtadmin.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @param {vtadmin.VTAdmin.GetWorkflowCallback} callback Node-style callback called with the error, if any, and Workflow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VTAdmin.prototype.getWorkflow = function getWorkflow(request, callback) { + return this.rpcCall(getWorkflow, $root.vtadmin.GetWorkflowRequest, $root.vtadmin.Workflow, request, callback); + }, "name", { value: "GetWorkflow" }); + + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof vtadmin.VTAdmin + * @instance + * @param {vtadmin.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link vtadmin.VTAdmin#getWorkflows}. + * @memberof vtadmin.VTAdmin + * @typedef GetWorkflowsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {vtadmin.GetWorkflowsResponse} [response] GetWorkflowsResponse + */ + + /** + * Calls GetWorkflows. + * @function getWorkflows + * @memberof vtadmin.VTAdmin + * @instance + * @param {vtadmin.IGetWorkflowsRequest} request GetWorkflowsRequest message or plain object + * @param {vtadmin.VTAdmin.GetWorkflowsCallback} callback Node-style callback called with the error, if any, and GetWorkflowsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(VTAdmin.prototype.getWorkflows = function getWorkflows(request, callback) { + return this.rpcCall(getWorkflows, $root.vtadmin.GetWorkflowsRequest, $root.vtadmin.GetWorkflowsResponse, request, callback); + }, "name", { value: "GetWorkflows" }); + + /** + * Calls GetWorkflows. + * @function getWorkflows + * @memberof vtadmin.VTAdmin + * @instance + * @param {vtadmin.IGetWorkflowsRequest} request GetWorkflowsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link vtadmin.VTAdmin#vTExplain}. * @memberof vtadmin.VTAdmin @@ -626,6 +692,253 @@ $root.vtadmin = (function() { return Cluster; })(); + vtadmin.ClusterWorkflows = (function() { + + /** + * Properties of a ClusterWorkflows. + * @memberof vtadmin + * @interface IClusterWorkflows + * @property {Array.|null} [workflows] ClusterWorkflows workflows + * @property {Array.|null} [warnings] ClusterWorkflows warnings + */ + + /** + * Constructs a new ClusterWorkflows. + * @memberof vtadmin + * @classdesc Represents a ClusterWorkflows. + * @implements IClusterWorkflows + * @constructor + * @param {vtadmin.IClusterWorkflows=} [properties] Properties to set + */ + function ClusterWorkflows(properties) { + this.workflows = []; + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClusterWorkflows workflows. + * @member {Array.} workflows + * @memberof vtadmin.ClusterWorkflows + * @instance + */ + ClusterWorkflows.prototype.workflows = $util.emptyArray; + + /** + * ClusterWorkflows warnings. + * @member {Array.} warnings + * @memberof vtadmin.ClusterWorkflows + * @instance + */ + ClusterWorkflows.prototype.warnings = $util.emptyArray; + + /** + * Creates a new ClusterWorkflows instance using the specified properties. + * @function create + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {vtadmin.IClusterWorkflows=} [properties] Properties to set + * @returns {vtadmin.ClusterWorkflows} ClusterWorkflows instance + */ + ClusterWorkflows.create = function create(properties) { + return new ClusterWorkflows(properties); + }; + + /** + * Encodes the specified ClusterWorkflows message. Does not implicitly {@link vtadmin.ClusterWorkflows.verify|verify} messages. + * @function encode + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {vtadmin.IClusterWorkflows} message ClusterWorkflows message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClusterWorkflows.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflows != null && message.workflows.length) + for (var i = 0; i < message.workflows.length; ++i) + $root.vtadmin.Workflow.encode(message.workflows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.warnings[i]); + return writer; + }; + + /** + * Encodes the specified ClusterWorkflows message, length delimited. Does not implicitly {@link vtadmin.ClusterWorkflows.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {vtadmin.IClusterWorkflows} message ClusterWorkflows message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClusterWorkflows.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClusterWorkflows message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.ClusterWorkflows} ClusterWorkflows + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClusterWorkflows.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.ClusterWorkflows(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.workflows && message.workflows.length)) + message.workflows = []; + message.workflows.push($root.vtadmin.Workflow.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClusterWorkflows message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.ClusterWorkflows} ClusterWorkflows + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClusterWorkflows.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClusterWorkflows message. + * @function verify + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClusterWorkflows.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflows != null && message.hasOwnProperty("workflows")) { + if (!Array.isArray(message.workflows)) + return "workflows: array expected"; + for (var i = 0; i < message.workflows.length; ++i) { + var error = $root.vtadmin.Workflow.verify(message.workflows[i]); + if (error) + return "workflows." + error; + } + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) + if (!$util.isString(message.warnings[i])) + return "warnings: string[] expected"; + } + return null; + }; + + /** + * Creates a ClusterWorkflows message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.ClusterWorkflows} ClusterWorkflows + */ + ClusterWorkflows.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.ClusterWorkflows) + return object; + var message = new $root.vtadmin.ClusterWorkflows(); + if (object.workflows) { + if (!Array.isArray(object.workflows)) + throw TypeError(".vtadmin.ClusterWorkflows.workflows: array expected"); + message.workflows = []; + for (var i = 0; i < object.workflows.length; ++i) { + if (typeof object.workflows[i] !== "object") + throw TypeError(".vtadmin.ClusterWorkflows.workflows: object expected"); + message.workflows[i] = $root.vtadmin.Workflow.fromObject(object.workflows[i]); + } + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".vtadmin.ClusterWorkflows.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) + message.warnings[i] = String(object.warnings[i]); + } + return message; + }; + + /** + * Creates a plain object from a ClusterWorkflows message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.ClusterWorkflows + * @static + * @param {vtadmin.ClusterWorkflows} message ClusterWorkflows + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClusterWorkflows.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.workflows = []; + object.warnings = []; + } + if (message.workflows && message.workflows.length) { + object.workflows = []; + for (var j = 0; j < message.workflows.length; ++j) + object.workflows[j] = $root.vtadmin.Workflow.toObject(message.workflows[j], options); + } + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = message.warnings[j]; + } + return object; + }; + + /** + * Converts this ClusterWorkflows to JSON. + * @function toJSON + * @memberof vtadmin.ClusterWorkflows + * @instance + * @returns {Object.} JSON object + */ + ClusterWorkflows.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClusterWorkflows; + })(); + vtadmin.Keyspace = (function() { /** @@ -2201,26 +2514,26 @@ $root.vtadmin = (function() { return VTGate; })(); - vtadmin.FindSchemaRequest = (function() { + vtadmin.Workflow = (function() { /** - * Properties of a FindSchemaRequest. + * Properties of a Workflow. * @memberof vtadmin - * @interface IFindSchemaRequest - * @property {string|null} [table] FindSchemaRequest table - * @property {Array.|null} [cluster_ids] FindSchemaRequest cluster_ids + * @interface IWorkflow + * @property {vtadmin.ICluster|null} [cluster] Workflow cluster + * @property {string|null} [keyspace] Workflow keyspace + * @property {vtctldata.IWorkflow|null} [workflow] Workflow workflow */ /** - * Constructs a new FindSchemaRequest. + * Constructs a new Workflow. * @memberof vtadmin - * @classdesc Represents a FindSchemaRequest. - * @implements IFindSchemaRequest + * @classdesc Represents a Workflow. + * @implements IWorkflow * @constructor - * @param {vtadmin.IFindSchemaRequest=} [properties] Properties to set + * @param {vtadmin.IWorkflow=} [properties] Properties to set */ - function FindSchemaRequest(properties) { - this.cluster_ids = []; + function Workflow(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2228,63 +2541,305 @@ $root.vtadmin = (function() { } /** - * FindSchemaRequest table. - * @member {string} table - * @memberof vtadmin.FindSchemaRequest + * Workflow cluster. + * @member {vtadmin.ICluster|null|undefined} cluster + * @memberof vtadmin.Workflow * @instance */ - FindSchemaRequest.prototype.table = ""; + Workflow.prototype.cluster = null; /** - * FindSchemaRequest cluster_ids. - * @member {Array.} cluster_ids - * @memberof vtadmin.FindSchemaRequest + * Workflow keyspace. + * @member {string} keyspace + * @memberof vtadmin.Workflow * @instance */ - FindSchemaRequest.prototype.cluster_ids = $util.emptyArray; + Workflow.prototype.keyspace = ""; /** - * Creates a new FindSchemaRequest instance using the specified properties. + * Workflow workflow. + * @member {vtctldata.IWorkflow|null|undefined} workflow + * @memberof vtadmin.Workflow + * @instance + */ + Workflow.prototype.workflow = null; + + /** + * Creates a new Workflow instance using the specified properties. * @function create - * @memberof vtadmin.FindSchemaRequest + * @memberof vtadmin.Workflow * @static - * @param {vtadmin.IFindSchemaRequest=} [properties] Properties to set - * @returns {vtadmin.FindSchemaRequest} FindSchemaRequest instance + * @param {vtadmin.IWorkflow=} [properties] Properties to set + * @returns {vtadmin.Workflow} Workflow instance */ - FindSchemaRequest.create = function create(properties) { - return new FindSchemaRequest(properties); + Workflow.create = function create(properties) { + return new Workflow(properties); }; /** - * Encodes the specified FindSchemaRequest message. Does not implicitly {@link vtadmin.FindSchemaRequest.verify|verify} messages. + * Encodes the specified Workflow message. Does not implicitly {@link vtadmin.Workflow.verify|verify} messages. * @function encode - * @memberof vtadmin.FindSchemaRequest + * @memberof vtadmin.Workflow * @static - * @param {vtadmin.IFindSchemaRequest} message FindSchemaRequest message or plain object to encode + * @param {vtadmin.IWorkflow} message Workflow message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FindSchemaRequest.encode = function encode(message, writer) { + Workflow.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.table != null && Object.hasOwnProperty.call(message, "table")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); - if (message.cluster_ids != null && message.cluster_ids.length) - for (var i = 0; i < message.cluster_ids.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.cluster_ids[i]); + if (message.cluster != null && Object.hasOwnProperty.call(message, "cluster")) + $root.vtadmin.Cluster.encode(message.cluster, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.keyspace != null && Object.hasOwnProperty.call(message, "keyspace")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.keyspace); + if (message.workflow != null && Object.hasOwnProperty.call(message, "workflow")) + $root.vtctldata.Workflow.encode(message.workflow, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified FindSchemaRequest message, length delimited. Does not implicitly {@link vtadmin.FindSchemaRequest.verify|verify} messages. + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link vtadmin.Workflow.verify|verify} messages. * @function encodeDelimited - * @memberof vtadmin.FindSchemaRequest + * @memberof vtadmin.Workflow * @static - * @param {vtadmin.IFindSchemaRequest} message FindSchemaRequest message or plain object to encode + * @param {vtadmin.IWorkflow} message Workflow message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FindSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { + Workflow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.Workflow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cluster = $root.vtadmin.Cluster.decode(reader, reader.uint32()); + break; + case 2: + message.keyspace = reader.string(); + break; + case 3: + message.workflow = $root.vtctldata.Workflow.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Workflow message. + * @function verify + * @memberof vtadmin.Workflow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Workflow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cluster != null && message.hasOwnProperty("cluster")) { + var error = $root.vtadmin.Cluster.verify(message.cluster); + if (error) + return "cluster." + error; + } + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + if (!$util.isString(message.keyspace)) + return "keyspace: string expected"; + if (message.workflow != null && message.hasOwnProperty("workflow")) { + var error = $root.vtctldata.Workflow.verify(message.workflow); + if (error) + return "workflow." + error; + } + return null; + }; + + /** + * Creates a Workflow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.Workflow + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.Workflow} Workflow + */ + Workflow.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.Workflow) + return object; + var message = new $root.vtadmin.Workflow(); + if (object.cluster != null) { + if (typeof object.cluster !== "object") + throw TypeError(".vtadmin.Workflow.cluster: object expected"); + message.cluster = $root.vtadmin.Cluster.fromObject(object.cluster); + } + if (object.keyspace != null) + message.keyspace = String(object.keyspace); + if (object.workflow != null) { + if (typeof object.workflow !== "object") + throw TypeError(".vtadmin.Workflow.workflow: object expected"); + message.workflow = $root.vtctldata.Workflow.fromObject(object.workflow); + } + return message; + }; + + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.Workflow + * @static + * @param {vtadmin.Workflow} message Workflow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Workflow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cluster = null; + object.keyspace = ""; + object.workflow = null; + } + if (message.cluster != null && message.hasOwnProperty("cluster")) + object.cluster = $root.vtadmin.Cluster.toObject(message.cluster, options); + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + object.keyspace = message.keyspace; + if (message.workflow != null && message.hasOwnProperty("workflow")) + object.workflow = $root.vtctldata.Workflow.toObject(message.workflow, options); + return object; + }; + + /** + * Converts this Workflow to JSON. + * @function toJSON + * @memberof vtadmin.Workflow + * @instance + * @returns {Object.} JSON object + */ + Workflow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Workflow; + })(); + + vtadmin.FindSchemaRequest = (function() { + + /** + * Properties of a FindSchemaRequest. + * @memberof vtadmin + * @interface IFindSchemaRequest + * @property {string|null} [table] FindSchemaRequest table + * @property {Array.|null} [cluster_ids] FindSchemaRequest cluster_ids + */ + + /** + * Constructs a new FindSchemaRequest. + * @memberof vtadmin + * @classdesc Represents a FindSchemaRequest. + * @implements IFindSchemaRequest + * @constructor + * @param {vtadmin.IFindSchemaRequest=} [properties] Properties to set + */ + function FindSchemaRequest(properties) { + this.cluster_ids = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FindSchemaRequest table. + * @member {string} table + * @memberof vtadmin.FindSchemaRequest + * @instance + */ + FindSchemaRequest.prototype.table = ""; + + /** + * FindSchemaRequest cluster_ids. + * @member {Array.} cluster_ids + * @memberof vtadmin.FindSchemaRequest + * @instance + */ + FindSchemaRequest.prototype.cluster_ids = $util.emptyArray; + + /** + * Creates a new FindSchemaRequest instance using the specified properties. + * @function create + * @memberof vtadmin.FindSchemaRequest + * @static + * @param {vtadmin.IFindSchemaRequest=} [properties] Properties to set + * @returns {vtadmin.FindSchemaRequest} FindSchemaRequest instance + */ + FindSchemaRequest.create = function create(properties) { + return new FindSchemaRequest(properties); + }; + + /** + * Encodes the specified FindSchemaRequest message. Does not implicitly {@link vtadmin.FindSchemaRequest.verify|verify} messages. + * @function encode + * @memberof vtadmin.FindSchemaRequest + * @static + * @param {vtadmin.IFindSchemaRequest} message FindSchemaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FindSchemaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.table != null && Object.hasOwnProperty.call(message, "table")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); + if (message.cluster_ids != null && message.cluster_ids.length) + for (var i = 0; i < message.cluster_ids.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.cluster_ids[i]); + return writer; + }; + + /** + * Encodes the specified FindSchemaRequest message, length delimited. Does not implicitly {@link vtadmin.FindSchemaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.FindSchemaRequest + * @static + * @param {vtadmin.IFindSchemaRequest} message FindSchemaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FindSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; @@ -5518,6 +6073,792 @@ $root.vtadmin = (function() { return GetVSchemasResponse; })(); + vtadmin.GetWorkflowRequest = (function() { + + /** + * Properties of a GetWorkflowRequest. + * @memberof vtadmin + * @interface IGetWorkflowRequest + * @property {string|null} [cluster_id] GetWorkflowRequest cluster_id + * @property {string|null} [keyspace] GetWorkflowRequest keyspace + * @property {string|null} [name] GetWorkflowRequest name + * @property {boolean|null} [active_only] GetWorkflowRequest active_only + */ + + /** + * Constructs a new GetWorkflowRequest. + * @memberof vtadmin + * @classdesc Represents a GetWorkflowRequest. + * @implements IGetWorkflowRequest + * @constructor + * @param {vtadmin.IGetWorkflowRequest=} [properties] Properties to set + */ + function GetWorkflowRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetWorkflowRequest cluster_id. + * @member {string} cluster_id + * @memberof vtadmin.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.cluster_id = ""; + + /** + * GetWorkflowRequest keyspace. + * @member {string} keyspace + * @memberof vtadmin.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.keyspace = ""; + + /** + * GetWorkflowRequest name. + * @member {string} name + * @memberof vtadmin.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.name = ""; + + /** + * GetWorkflowRequest active_only. + * @member {boolean} active_only + * @memberof vtadmin.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.active_only = false; + + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @function create + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {vtadmin.IGetWorkflowRequest=} [properties] Properties to set + * @returns {vtadmin.GetWorkflowRequest} GetWorkflowRequest instance + */ + GetWorkflowRequest.create = function create(properties) { + return new GetWorkflowRequest(properties); + }; + + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link vtadmin.GetWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {vtadmin.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cluster_id != null && Object.hasOwnProperty.call(message, "cluster_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.cluster_id); + if (message.keyspace != null && Object.hasOwnProperty.call(message, "keyspace")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.keyspace); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.active_only != null && Object.hasOwnProperty.call(message, "active_only")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.active_only); + return writer; + }; + + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {vtadmin.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.GetWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cluster_id = reader.string(); + break; + case 2: + message.keyspace = reader.string(); + break; + case 3: + message.name = reader.string(); + break; + case 4: + message.active_only = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetWorkflowRequest message. + * @function verify + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWorkflowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cluster_id != null && message.hasOwnProperty("cluster_id")) + if (!$util.isString(message.cluster_id)) + return "cluster_id: string expected"; + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + if (!$util.isString(message.keyspace)) + return "keyspace: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.active_only != null && message.hasOwnProperty("active_only")) + if (typeof message.active_only !== "boolean") + return "active_only: boolean expected"; + return null; + }; + + /** + * Creates a GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.GetWorkflowRequest} GetWorkflowRequest + */ + GetWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.GetWorkflowRequest) + return object; + var message = new $root.vtadmin.GetWorkflowRequest(); + if (object.cluster_id != null) + message.cluster_id = String(object.cluster_id); + if (object.keyspace != null) + message.keyspace = String(object.keyspace); + if (object.name != null) + message.name = String(object.name); + if (object.active_only != null) + message.active_only = Boolean(object.active_only); + return message; + }; + + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.GetWorkflowRequest + * @static + * @param {vtadmin.GetWorkflowRequest} message GetWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cluster_id = ""; + object.keyspace = ""; + object.name = ""; + object.active_only = false; + } + if (message.cluster_id != null && message.hasOwnProperty("cluster_id")) + object.cluster_id = message.cluster_id; + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + object.keyspace = message.keyspace; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.active_only != null && message.hasOwnProperty("active_only")) + object.active_only = message.active_only; + return object; + }; + + /** + * Converts this GetWorkflowRequest to JSON. + * @function toJSON + * @memberof vtadmin.GetWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + GetWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetWorkflowRequest; + })(); + + vtadmin.GetWorkflowsRequest = (function() { + + /** + * Properties of a GetWorkflowsRequest. + * @memberof vtadmin + * @interface IGetWorkflowsRequest + * @property {Array.|null} [cluster_ids] GetWorkflowsRequest cluster_ids + * @property {boolean|null} [active_only] GetWorkflowsRequest active_only + * @property {Array.|null} [keyspaces] GetWorkflowsRequest keyspaces + * @property {Array.|null} [ignore_keyspaces] GetWorkflowsRequest ignore_keyspaces + */ + + /** + * Constructs a new GetWorkflowsRequest. + * @memberof vtadmin + * @classdesc Represents a GetWorkflowsRequest. + * @implements IGetWorkflowsRequest + * @constructor + * @param {vtadmin.IGetWorkflowsRequest=} [properties] Properties to set + */ + function GetWorkflowsRequest(properties) { + this.cluster_ids = []; + this.keyspaces = []; + this.ignore_keyspaces = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetWorkflowsRequest cluster_ids. + * @member {Array.} cluster_ids + * @memberof vtadmin.GetWorkflowsRequest + * @instance + */ + GetWorkflowsRequest.prototype.cluster_ids = $util.emptyArray; + + /** + * GetWorkflowsRequest active_only. + * @member {boolean} active_only + * @memberof vtadmin.GetWorkflowsRequest + * @instance + */ + GetWorkflowsRequest.prototype.active_only = false; + + /** + * GetWorkflowsRequest keyspaces. + * @member {Array.} keyspaces + * @memberof vtadmin.GetWorkflowsRequest + * @instance + */ + GetWorkflowsRequest.prototype.keyspaces = $util.emptyArray; + + /** + * GetWorkflowsRequest ignore_keyspaces. + * @member {Array.} ignore_keyspaces + * @memberof vtadmin.GetWorkflowsRequest + * @instance + */ + GetWorkflowsRequest.prototype.ignore_keyspaces = $util.emptyArray; + + /** + * Creates a new GetWorkflowsRequest instance using the specified properties. + * @function create + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {vtadmin.IGetWorkflowsRequest=} [properties] Properties to set + * @returns {vtadmin.GetWorkflowsRequest} GetWorkflowsRequest instance + */ + GetWorkflowsRequest.create = function create(properties) { + return new GetWorkflowsRequest(properties); + }; + + /** + * Encodes the specified GetWorkflowsRequest message. Does not implicitly {@link vtadmin.GetWorkflowsRequest.verify|verify} messages. + * @function encode + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {vtadmin.IGetWorkflowsRequest} message GetWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cluster_ids != null && message.cluster_ids.length) + for (var i = 0; i < message.cluster_ids.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.cluster_ids[i]); + if (message.active_only != null && Object.hasOwnProperty.call(message, "active_only")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.active_only); + if (message.keyspaces != null && message.keyspaces.length) + for (var i = 0; i < message.keyspaces.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.keyspaces[i]); + if (message.ignore_keyspaces != null && message.ignore_keyspaces.length) + for (var i = 0; i < message.ignore_keyspaces.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignore_keyspaces[i]); + return writer; + }; + + /** + * Encodes the specified GetWorkflowsRequest message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {vtadmin.IGetWorkflowsRequest} message GetWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetWorkflowsRequest message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.GetWorkflowsRequest} GetWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.GetWorkflowsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cluster_ids && message.cluster_ids.length)) + message.cluster_ids = []; + message.cluster_ids.push(reader.string()); + break; + case 2: + message.active_only = reader.bool(); + break; + case 3: + if (!(message.keyspaces && message.keyspaces.length)) + message.keyspaces = []; + message.keyspaces.push(reader.string()); + break; + case 4: + if (!(message.ignore_keyspaces && message.ignore_keyspaces.length)) + message.ignore_keyspaces = []; + message.ignore_keyspaces.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetWorkflowsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.GetWorkflowsRequest} GetWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetWorkflowsRequest message. + * @function verify + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWorkflowsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cluster_ids != null && message.hasOwnProperty("cluster_ids")) { + if (!Array.isArray(message.cluster_ids)) + return "cluster_ids: array expected"; + for (var i = 0; i < message.cluster_ids.length; ++i) + if (!$util.isString(message.cluster_ids[i])) + return "cluster_ids: string[] expected"; + } + if (message.active_only != null && message.hasOwnProperty("active_only")) + if (typeof message.active_only !== "boolean") + return "active_only: boolean expected"; + if (message.keyspaces != null && message.hasOwnProperty("keyspaces")) { + if (!Array.isArray(message.keyspaces)) + return "keyspaces: array expected"; + for (var i = 0; i < message.keyspaces.length; ++i) + if (!$util.isString(message.keyspaces[i])) + return "keyspaces: string[] expected"; + } + if (message.ignore_keyspaces != null && message.hasOwnProperty("ignore_keyspaces")) { + if (!Array.isArray(message.ignore_keyspaces)) + return "ignore_keyspaces: array expected"; + for (var i = 0; i < message.ignore_keyspaces.length; ++i) + if (!$util.isString(message.ignore_keyspaces[i])) + return "ignore_keyspaces: string[] expected"; + } + return null; + }; + + /** + * Creates a GetWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.GetWorkflowsRequest} GetWorkflowsRequest + */ + GetWorkflowsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.GetWorkflowsRequest) + return object; + var message = new $root.vtadmin.GetWorkflowsRequest(); + if (object.cluster_ids) { + if (!Array.isArray(object.cluster_ids)) + throw TypeError(".vtadmin.GetWorkflowsRequest.cluster_ids: array expected"); + message.cluster_ids = []; + for (var i = 0; i < object.cluster_ids.length; ++i) + message.cluster_ids[i] = String(object.cluster_ids[i]); + } + if (object.active_only != null) + message.active_only = Boolean(object.active_only); + if (object.keyspaces) { + if (!Array.isArray(object.keyspaces)) + throw TypeError(".vtadmin.GetWorkflowsRequest.keyspaces: array expected"); + message.keyspaces = []; + for (var i = 0; i < object.keyspaces.length; ++i) + message.keyspaces[i] = String(object.keyspaces[i]); + } + if (object.ignore_keyspaces) { + if (!Array.isArray(object.ignore_keyspaces)) + throw TypeError(".vtadmin.GetWorkflowsRequest.ignore_keyspaces: array expected"); + message.ignore_keyspaces = []; + for (var i = 0; i < object.ignore_keyspaces.length; ++i) + message.ignore_keyspaces[i] = String(object.ignore_keyspaces[i]); + } + return message; + }; + + /** + * Creates a plain object from a GetWorkflowsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.GetWorkflowsRequest + * @static + * @param {vtadmin.GetWorkflowsRequest} message GetWorkflowsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWorkflowsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.cluster_ids = []; + object.keyspaces = []; + object.ignore_keyspaces = []; + } + if (options.defaults) + object.active_only = false; + if (message.cluster_ids && message.cluster_ids.length) { + object.cluster_ids = []; + for (var j = 0; j < message.cluster_ids.length; ++j) + object.cluster_ids[j] = message.cluster_ids[j]; + } + if (message.active_only != null && message.hasOwnProperty("active_only")) + object.active_only = message.active_only; + if (message.keyspaces && message.keyspaces.length) { + object.keyspaces = []; + for (var j = 0; j < message.keyspaces.length; ++j) + object.keyspaces[j] = message.keyspaces[j]; + } + if (message.ignore_keyspaces && message.ignore_keyspaces.length) { + object.ignore_keyspaces = []; + for (var j = 0; j < message.ignore_keyspaces.length; ++j) + object.ignore_keyspaces[j] = message.ignore_keyspaces[j]; + } + return object; + }; + + /** + * Converts this GetWorkflowsRequest to JSON. + * @function toJSON + * @memberof vtadmin.GetWorkflowsRequest + * @instance + * @returns {Object.} JSON object + */ + GetWorkflowsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetWorkflowsRequest; + })(); + + vtadmin.GetWorkflowsResponse = (function() { + + /** + * Properties of a GetWorkflowsResponse. + * @memberof vtadmin + * @interface IGetWorkflowsResponse + * @property {Object.|null} [workflows_by_cluster] GetWorkflowsResponse workflows_by_cluster + */ + + /** + * Constructs a new GetWorkflowsResponse. + * @memberof vtadmin + * @classdesc Represents a GetWorkflowsResponse. + * @implements IGetWorkflowsResponse + * @constructor + * @param {vtadmin.IGetWorkflowsResponse=} [properties] Properties to set + */ + function GetWorkflowsResponse(properties) { + this.workflows_by_cluster = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetWorkflowsResponse workflows_by_cluster. + * @member {Object.} workflows_by_cluster + * @memberof vtadmin.GetWorkflowsResponse + * @instance + */ + GetWorkflowsResponse.prototype.workflows_by_cluster = $util.emptyObject; + + /** + * Creates a new GetWorkflowsResponse instance using the specified properties. + * @function create + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {vtadmin.IGetWorkflowsResponse=} [properties] Properties to set + * @returns {vtadmin.GetWorkflowsResponse} GetWorkflowsResponse instance + */ + GetWorkflowsResponse.create = function create(properties) { + return new GetWorkflowsResponse(properties); + }; + + /** + * Encodes the specified GetWorkflowsResponse message. Does not implicitly {@link vtadmin.GetWorkflowsResponse.verify|verify} messages. + * @function encode + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {vtadmin.IGetWorkflowsResponse} message GetWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflows_by_cluster != null && Object.hasOwnProperty.call(message, "workflows_by_cluster")) + for (var keys = Object.keys(message.workflows_by_cluster), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.vtadmin.ClusterWorkflows.encode(message.workflows_by_cluster[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified GetWorkflowsResponse message, length delimited. Does not implicitly {@link vtadmin.GetWorkflowsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {vtadmin.IGetWorkflowsResponse} message GetWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetWorkflowsResponse message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.GetWorkflowsResponse} GetWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.GetWorkflowsResponse(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (message.workflows_by_cluster === $util.emptyObject) + message.workflows_by_cluster = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.vtadmin.ClusterWorkflows.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.workflows_by_cluster[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetWorkflowsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.GetWorkflowsResponse} GetWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetWorkflowsResponse message. + * @function verify + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWorkflowsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflows_by_cluster != null && message.hasOwnProperty("workflows_by_cluster")) { + if (!$util.isObject(message.workflows_by_cluster)) + return "workflows_by_cluster: object expected"; + var key = Object.keys(message.workflows_by_cluster); + for (var i = 0; i < key.length; ++i) { + var error = $root.vtadmin.ClusterWorkflows.verify(message.workflows_by_cluster[key[i]]); + if (error) + return "workflows_by_cluster." + error; + } + } + return null; + }; + + /** + * Creates a GetWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.GetWorkflowsResponse} GetWorkflowsResponse + */ + GetWorkflowsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.GetWorkflowsResponse) + return object; + var message = new $root.vtadmin.GetWorkflowsResponse(); + if (object.workflows_by_cluster) { + if (typeof object.workflows_by_cluster !== "object") + throw TypeError(".vtadmin.GetWorkflowsResponse.workflows_by_cluster: object expected"); + message.workflows_by_cluster = {}; + for (var keys = Object.keys(object.workflows_by_cluster), i = 0; i < keys.length; ++i) { + if (typeof object.workflows_by_cluster[keys[i]] !== "object") + throw TypeError(".vtadmin.GetWorkflowsResponse.workflows_by_cluster: object expected"); + message.workflows_by_cluster[keys[i]] = $root.vtadmin.ClusterWorkflows.fromObject(object.workflows_by_cluster[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a GetWorkflowsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.GetWorkflowsResponse + * @static + * @param {vtadmin.GetWorkflowsResponse} message GetWorkflowsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWorkflowsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.workflows_by_cluster = {}; + var keys2; + if (message.workflows_by_cluster && (keys2 = Object.keys(message.workflows_by_cluster)).length) { + object.workflows_by_cluster = {}; + for (var j = 0; j < keys2.length; ++j) + object.workflows_by_cluster[keys2[j]] = $root.vtadmin.ClusterWorkflows.toObject(message.workflows_by_cluster[keys2[j]], options); + } + return object; + }; + + /** + * Converts this GetWorkflowsResponse to JSON. + * @function toJSON + * @memberof vtadmin.GetWorkflowsResponse + * @instance + * @returns {Object.} JSON object + */ + GetWorkflowsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetWorkflowsResponse; + })(); + vtadmin.VTExplainRequest = (function() { /**