Class: Retab::WorkflowSpecs

Inherits:
Object
  • Object
show all
Defined in:
lib/retab/workflow_specs.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WorkflowSpecs

Returns a new instance of WorkflowSpecs.



9
10
11
# File 'lib/retab/workflow_specs.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#apply(yaml_definition:, request_options: {}) ⇒ Retab::DeclarativeApplyResponse

Apply Workflow Spec

Parameters:

  • yaml_definition (String)

    Workflow YAML definition

  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/retab/workflow_specs.rb', line 63

def apply(
  yaml_definition:,
  request_options: {}
)
  body = {
    'yaml_definition' => yaml_definition
  }
  response = @client.request(
    method: :post,
    path: '/v1/workflows/spec/apply',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Retab::DeclarativeApplyResponse.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#get(workflow_id:, request_options: {}) ⇒ Retab::DeclarativeExportResponse

Export Workflow Spec

Parameters:

  • workflow_id (String)
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/retab/workflow_specs.rb', line 86

def get(
  workflow_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/workflows/#{Retab::Util.encode_path(workflow_id)}/spec",
    auth: true,
    request_options: request_options
  )
  result = Retab::DeclarativeExportResponse.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#plan(yaml_definition:, request_options: {}) ⇒ Retab::DeclarativePlanResponse

Plan Workflow Spec

Parameters:

  • yaml_definition (String)

    Workflow YAML definition

  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/retab/workflow_specs.rb', line 40

def plan(
  yaml_definition:,
  request_options: {}
)
  body = {
    'yaml_definition' => yaml_definition
  }
  response = @client.request(
    method: :post,
    path: '/v1/workflows/spec/plan',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Retab::DeclarativePlanResponse.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#validate(yaml_definition:, request_options: {}) ⇒ Retab::DeclarativeValidationResponse

Validate Workflow Spec

Parameters:

  • yaml_definition (String)

    Workflow YAML definition

  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/retab/workflow_specs.rb', line 17

def validate(
  yaml_definition:,
  request_options: {}
)
  body = {
    'yaml_definition' => yaml_definition
  }
  response = @client.request(
    method: :post,
    path: '/v1/workflows/spec/validate',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Retab::DeclarativeValidationResponse.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end