Skip to content

Commit 9c14bdd

Browse files
authored
Merge pull request #1405 from oracle-devrel/review-and-fixes-5
reviewed
2 parents ddf6de2 + 9a35b70 commit 9c14bdd

File tree

15 files changed

+102
-23
lines changed

15 files changed

+102
-23
lines changed

app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
SOFTWARE.
3737
-->
3838

39-
## Functions overview
40-
[Document functions-overview](files/Fn.pdf)
39+
# API Gateway authorizer function context var example
4140

42-
### Author
41+
Reviewed: 31.10.2024
42+
43+
# When to use this asset?
44+
45+
Anyone who wants to test OCI Queue service using OCI SDK in JavaScript and do this from GitHub Actions.
46+
47+
# Author
4348
<a href="https://github.com/mikarinneoracle">mikarinneoracle</a>
4449

45-
# API Gateway authorizer function context var example
50+
# How to use this asset?
4651

4752
## Build and deploy the functions
4853

@@ -59,23 +64,23 @@ fdk.handle(function(input){
5964
"principal": "myprincipal",
6065
"scope": ["fnsimplejs"],
6166
"clientId": "clientIdFromHeader",
62-
"expiresAt": "2023-12-31T00:00:00+00:00",
67+
"expiresAt": "2025-12-31T00:00:00+00:00",
6368
"context": {
6469
"username": input.token
6570
}
6671
}
6772
} else {
6873
json = {
6974
"active": false,
70-
"expiresAt": "2023-12-31T00:00:00+00:00",
75+
"expiresAt": "2025-12-31T00:00:00+00:00",
7176
"wwwAuthenticate": "Bearer realm=\"www.com\""
7277
}
7378
}
7479
return json;
7580
})
7681
</pre>
7782

78-
The authorizer function will pass on the <code>username</code> in <code>auth context</code> as a custom variable. The value for it is set from REST call input as <code>token</code> on the <a href="fnauthjs/func.js#L52">line 52</a>.
83+
The authorizer function will pass on the <code>username</code> in <code>auth context</code> as a custom variable. The value for it is set from REST call input as <code>token</code> on the <a href="files/fnauthjs/func.js#L52">line 52</a>.
7984
<br>
8085
Here's the call using API Gateway:
8186
<pre>
@@ -94,7 +99,7 @@ fdk.handle(function(input, ctx){
9499

95100
The secondary / backend function will get the authorizer passed variable <code>username</code>
96101
as a transformed header variable <code>Fn-Http-H-Username</code> and will print it out as the
97-
function REST call result on the <a href="fnsimplejs/func.js#L42">line 42</a>.
102+
function REST call result on the <a href="files/fnsimplejs/func.js#L42">line 42</a>.
98103
<br>
99104
Here's the call using API Gateway:
100105
<pre>
@@ -144,4 +149,17 @@ curl https://drp....56kvgu.apigateway.eu-amsterdam-1.oci.customer-oci.com/
144149
{"code":401,"message":"Unauthorized"}
145150
</pre>
146151

152+
# Useful Links
153+
154+
- [OCI Functions](https://docs.oracle.com/en-us/iaas/Content/Functions/Concepts/functionsoverview.htm)
155+
- Learn how the Functions service lets you create, run, and scale business logic without managing any infrastructure
156+
- [Oracle](https://www.oracle.com/)
157+
- Oracle Website
158+
159+
### License
160+
161+
Copyright (c) 2024 Oracle and/or its affiliates.
162+
163+
Licensed under the Universal Permissive License (UPL), Version 1.0.
147164

165+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Binary file not shown.

app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/fnsimplejs/package.json renamed to app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/files/fnsimplejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "hellofn",
2+
"name": "fnsimplejs",
33
"version": "1.0.0",
44
"description": "example function",
55
"main": "func.js",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Copyright (c) 2024 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
36+

app-dev/devops-and-containers/functions/os-replication/README.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,46 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
SOFTWARE.
3737
-->
3838

39-
## Functions overview
40-
[Document functions-overview](files/Fn.pdf)
39+
# Example function to copy a file from an Object Storage bucket to multiple other buckets when uploaded
4140

42-
### Author
43-
<a href="https://github.com/mikarinneoracle">mikarinneoracle</a>
41+
Reviewed: 31.10.2024
42+
43+
# When to use this asset?
44+
45+
Anyone who wants to implement content distribution in Object Storage buckets across multiple regions. This function is triggered by the upload CloudEvent of the source bucket and then copies the received file to multiple (1-n) other buckets that are replicated to other regions using the Object Storage buckets automatic replication feature. This way we can implement content distribution in Object Storage buckets across multiple regions.
4446

45-
# Example function to copy a file from an Object Storage bucket to multiple other buckets when uploaded
47+
# Author
48+
<a href="https://github.com/mikarinneoracle">mikarinneoracle</a>
4649

47-
### The Use case
50+
# How to use this asset?
4851

49-
The use case is that this function will be triggered by the upload CloudEvent of the source bucket
50-
and then it copies the received file to multiple (1-n) other buckets that are replicated to other regions
51-
using the Object Storage buckets automatic replication feature. This way we can implement content distribution
52-
in Object Storage buckets across multiple regions.
52+
## Function configuration
5353

54-
<p>
55-
<h3>Function configuration</h3>
56-
<img src="images/config.png" width="800">
54+
<img src="files/config.png" width="800">
5755
<ul>
5856
<li><code>TENANCY</code> is the tenancy os namespace name e.g. what you get when running <code>oci os ns get</code></li>
5957
<li><code>SOURCE_BUCKET</code> is the bucket where the file is uploaded and triggers this function using a CloudEvent</li>
6058
<li><code>TARGET_BUCKETS</code> are the comma delimited buckets to where the file is copied from the source bucket are replicatyed to other regions using the Object Storage replication feature</li>
6159
</ul>
6260

6361
<h3>Function example log when triggered by the Object Storage file upload (create/update) CloudEvent</h3>
64-
<img src="images/log.png" width="800">
62+
<img src="files/log.png" width="800">
63+
64+
65+
# Useful Links
66+
67+
- [OCI Functions](https://docs.oracle.com/en-us/iaas/Content/Functions/Concepts/functionsoverview.htm)
68+
- Learn how the Functions service lets you create, run, and scale business logic without managing any infrastructure
69+
- [OCI SDK for JavaScript](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/typescriptsdk.htm)
70+
- The Oracle Cloud Infrastructure SDK for TypeScript and JavaScript enables you to write code to manage Oracle Cloud Infrastructure resources
71+
- [Oracle](https://www.oracle.com/)
72+
- Oracle Website
73+
74+
### License
75+
76+
Copyright (c) 2024 Oracle and/or its affiliates.
77+
78+
Licensed under the Universal Permissive License (UPL), Version 1.0.
79+
80+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
6581

0 commit comments

Comments
 (0)