fdk 0.0.20 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/fdk/call.rb +17 -2
- data/lib/fdk/context.rb +20 -4
- data/lib/fdk/function.rb +17 -0
- data/lib/fdk/listener.rb +17 -1
- data/lib/fdk/runner.rb +16 -0
- data/lib/fdk/support_classes.rb +16 -0
- data/lib/fdk/version.rb +17 -1
- data/lib/fdk.rb +16 -0
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 962f4bb9230b63e9209958f22baa093975dbc5a8bb6281eb5ce32d7a9daa651e
|
4
|
+
data.tar.gz: caaf91e233e1cba31a45ae98ec885826a15deace00965a2418a8e4dc415160bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a71baf72d9ce5b242019a8346e683f55bbd7262b20e1a0c82709473e52c355c23f9afd1ba74e904be4be816afd94035a136575d21a9b96e3fea087b8193afb
|
7
|
+
data.tar.gz: 98da75369366c113ef3662b58771ead32f7d7802a73639ad937cb1ac6f768524047b433b43ec0178cdd72563ea395277b5498a8a039e6dc3d599d5e5b47aa948
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# Function Development Kit for Ruby
|
2
|
+
The Function Development Kit for Ruby (FDK for Ruby) provides a Ruby framework for developing functions for use with [Fn](https://fnproject.github.io).
|
3
3
|
|
4
4
|
[![CircleCI](https://circleci.com/gh/fnproject/fdk-ruby.svg?style=svg)](https://circleci.com/gh/fnproject/fdk-ruby)
|
5
5
|
|
data/lib/fdk/call.rb
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
module FDK
|
4
20
|
# Call represents a call to the target function or lambda
|
5
21
|
class Call
|
6
|
-
FILTER_HEADERS = [
|
7
|
-
"upgrade", "trailer"].freeze
|
22
|
+
FILTER_HEADERS = %w[content-length te transfer-encoding upgrade trailer].freeze
|
8
23
|
|
9
24
|
attr_reader :request, :response
|
10
25
|
attr_accessor :error
|
data/lib/fdk/context.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
require "date"
|
4
20
|
|
5
21
|
module FDK
|
@@ -35,6 +51,8 @@ module FDK
|
|
35
51
|
# Represents outbound HTTP headers
|
36
52
|
class OutHeaders < InHeaders
|
37
53
|
def initialize(headers, key_in_fn)
|
54
|
+
headers["Fn-Fdk-Version"] = ["fdk-ruby/#{FDK::VERSION}"]
|
55
|
+
headers["Fn-Fdk-Runtime"] = ["ruby/#{RUBY_VERSION}"]
|
38
56
|
super(headers, key_in_fn)
|
39
57
|
end
|
40
58
|
|
@@ -64,8 +82,7 @@ module FDK
|
|
64
82
|
# Replace X with the upper cased name of the config variable you set.
|
65
83
|
# e.g. minio_secret=secret will be exposed via MINIO_SECRET env var.
|
66
84
|
|
67
|
-
attr_reader :headers
|
68
|
-
attr_reader :response_headers
|
85
|
+
attr_reader :headers, :response_headers
|
69
86
|
|
70
87
|
def initialize(headers_in, headers_out)
|
71
88
|
@headers = headers_in
|
@@ -105,8 +122,7 @@ module FDK
|
|
105
122
|
# Represents the context data (inbound && outbound)
|
106
123
|
# for the execution passed as HTTP headers
|
107
124
|
class HTTPContext
|
108
|
-
attr_reader :headers
|
109
|
-
attr_reader :response_headers
|
125
|
+
attr_reader :headers, :response_headers
|
110
126
|
|
111
127
|
def initialize(ctx)
|
112
128
|
fn_http_h_ = "fn-http-h-"
|
data/lib/fdk/function.rb
CHANGED
@@ -1,9 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
module FDK
|
4
20
|
# Function represents a function function or lambda
|
5
21
|
class Function
|
6
22
|
attr_reader :format, :function
|
23
|
+
|
7
24
|
def initialize(function:, format:)
|
8
25
|
raise "'#{format}' not supported in Ruby FDK." unless format == "http-stream"
|
9
26
|
|
data/lib/fdk/listener.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
module FDK
|
4
20
|
# Represents the socket that Fn uses to communicate
|
5
21
|
# with the FDK (and thence the function)
|
@@ -73,7 +89,7 @@ module FDK
|
|
73
89
|
end
|
74
90
|
|
75
91
|
def private_socket_path
|
76
|
-
socket_path
|
92
|
+
"#{socket_path}.private"
|
77
93
|
end
|
78
94
|
|
79
95
|
def log_frame_header(headers)
|
data/lib/fdk/runner.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
require "webrick"
|
4
20
|
require "fileutils"
|
5
21
|
require "json"
|
data/lib/fdk/support_classes.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
module FDK
|
4
20
|
# ParsedInput stores raw input and can parse it as
|
5
21
|
# JSON (add extra formats as required)
|
data/lib/fdk/version.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
module FDK
|
4
|
-
VERSION = "0.0.
|
20
|
+
VERSION = "0.0.27"
|
5
21
|
end
|
data/lib/fdk.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
require_relative "fdk/version"
|
4
20
|
require_relative "fdk/runner"
|
5
21
|
require_relative "fdk/context"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -10,48 +10,48 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - ">="
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.1.0
|
22
19
|
- - "~>"
|
23
20
|
- !ruby/object:Gem::Version
|
24
|
-
version: '2.
|
21
|
+
version: '2.5'
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.5.1
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
|
-
- - ">="
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: 2.1.0
|
32
29
|
- - "~>"
|
33
30
|
- !ruby/object:Gem::Version
|
34
|
-
version: '2.
|
31
|
+
version: '2.5'
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.5.1
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: webrick
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '1.
|
41
|
+
version: '1.7'
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.
|
44
|
+
version: 1.7.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '1.
|
51
|
+
version: '1.7'
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: net_http_unix
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version: '0.2'
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.2.
|
64
|
+
version: 0.2.2
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,21 +71,21 @@ dependencies:
|
|
71
71
|
version: '0.2'
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.2.
|
74
|
+
version: 0.2.2
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rubocop
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '1.21'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '1.21'
|
89
89
|
description: Ruby Function Developer Kit for Fn Project.
|
90
90
|
email:
|
91
91
|
- treeder@gmail.com
|
@@ -118,14 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '2.
|
121
|
+
version: '2.5'
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.1.6
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Ruby FDK for Fn Project
|