Skip to content

Commit cdf657d

Browse files
committed
Renamed the function and cleaned up the readme
1 parent bc17d20 commit cdf657d

File tree

8 files changed

+57
-136
lines changed

8 files changed

+57
-136
lines changed

oci-objectstorage-get-object-java/README.md

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,27 @@ As you make your way through this tutorial, look out for this icon ![user input
1212
Whenever you see it, it's time for you to perform an action.
1313

1414

15-
## Pre-requisites
16-
1. Start by making sure all of your policies are correct from this [guide](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionscreatingpolicies.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Tenancy%20for%20Function%20Development%7C_____4)
15+
## Prerequisites
16+
![user input icon](./images/userinput.png)
1717

18-
2. Have [Fn CLI setup with Oracle Functions](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionsconfiguringclient.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Client%20Environment%20for%20Function%20Development%7C_____0)
18+
1. Before you deploy this sample function, make sure you have run steps A, B
19+
and C of the [Oracle Functions Quick Start Guide for Cloud Shell](https://www.oracle.com/webfolder/technetwork/tutorials/infographics/oci_functions_cloudshell_quickview/functions_quickview_top/functions_quickview/index.html)
20+
* A - Set up your tenancy
21+
* B - Create application
22+
* C - Set up your Cloud Shell dev environment
1923

20-
3. Have your Oracle Object Storage Namespace available. This can be found by
24+
2. Have your Oracle Object Storage Namespace available. This can be found by
2125
logging into your [cloud account](https://console.us-ashburn-1.oraclecloud.com/),
2226
under your user profile, click on your Tenancy. Your Object Storage Namespace
2327
is shown there.
2428

2529

26-
## Context
27-
Switch to the correct context
28-
30+
## List Applications
2931
![user input icon](../images/userinput.png)
30-
```
31-
fn use context <your context name>
32-
```
33-
Check using
32+
33+
Assuming your have successfully completed the prerequisites, you should see your
34+
application in the list of applications.
35+
3436
```
3537
fn ls apps
3638
```
@@ -43,25 +45,13 @@ click [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingd
4345

4446
![user input icon](../images/userinput.png)
4547

46-
When specifying the *Matching Rules*, consider the following examples:
48+
When specifying the *Matching Rules*, consider the following example:
4749
* If you want all functions in a compartment to be able to access a resource,
4850
enter a rule similar to the following that adds all functions in the compartment
4951
with the specified compartment OCID to the dynamic group:
5052
```
5153
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
5254
```
53-
* If you want a specific function to be able to access a resource, enter a rule
54-
similar to the following that adds the function with the specified OCID to the
55-
dynamic group:
56-
```
57-
resource.id = 'ocid1.fnfunc.oc1.iad.aaaaaaaaacq______dnya'
58-
```
59-
* If you want all functions with a specific defined tag (free-form tags are
60-
not supported) to be able to access a resource, enter a rule similar to the
61-
following that adds all functions with the defined tag to the dynamic group :
62-
```
63-
ALL {resource.type = 'fnfunc', tag.department.operations.value = '45'}
64-
```
6555

6656

6757
## Create or Update Policies
@@ -83,30 +73,13 @@ Allow dynamic-group demo-func-dyn-group to read object-family in compartment dem
8373
For more information on how to create policies, go [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
8474

8575

86-
## Create an Application to run the function
87-
You can use an application already created or create a new one as follows:
88-
89-
![user input icon](../images/userinput.png)
90-
```
91-
fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]
92-
```
93-
You can find the subnet-ocid by logging on to [cloud.oracle.com](https://cloud.oracle.com/en_US/sign-in),
94-
navigating to Core Infrastructure > Networking > Virtual Cloud Networks. Make
95-
sure you are in the correct Region and Compartment, click on your VNC and
96-
select the subnet you wish to use.
97-
e.g.
98-
```
99-
fn create app object-crud --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaacnh..."]'
100-
```
101-
102-
10376
## Review the function
10477
Review the following files in the current folder:
10578
- [pom.xml](./pom.xml) specifies all the dependencies for your function
10679
- [func.yaml](./func.yaml) that contains metadata about your function and declares properties
10780
- [src/main/java/com/example/fn/ObjectStorageGetObjects.java](./src/main/java/com/example/fn/ObjectStorageGetObjects.java) which contains the Java code
10881

109-
The name of your function *oci-objectstorage-get-object* is specified in [func.yaml](./func.yaml).
82+
The name of your function *oci-objectstorage-get-object-java* is specified in [func.yaml](./func.yaml).
11083

11184

11285
## Deploy the function
@@ -150,10 +123,10 @@ Use the *fn* CLI to invoke your function with your own object name, bucket name
150123

151124
![user input icon](../images/userinput.png)
152125
```
153-
echo -n '{"name": "<object_name>", "bucketName":"<bucket_name>"}' | fn invoke <app_name> oci-objectstorage-get-object
126+
echo -n '{"name": "<object_name>", "bucketName":"<bucket_name>"}' | fn invoke <app_name> <function_name>
154127
```
155128
e.g.
156129
```
157-
echo -n '{"name": "file1.txt", "bucketName":"mybucket"}' | fn invoke object-crud oci-objectstorage-get-object
130+
echo -n '{"name": "file1.txt", "bucketName":"mybucket"}' | fn invoke object-crud oci-objectstorage-get-object-java
158131
```
159132
Upon success, you should see the content of the object appear in your terminal.

oci-objectstorage-get-object-java/func.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
schema_version: 20180708
2-
name: oci-objectstorage-get-object
2+
name: oci-objectstorage-get-object-java
33
version: 0.0.1
44
runtime: java
55
build_image: fnproject/fn-java-fdk-build:jdk11-1.0.105

oci-objectstorage-list-objects-java/README.md

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ The function calls the following OCI Java SDK classes:
1111
As you make your way through this tutorial, look out for this icon ![user input icon](../images/userinput.png).
1212
Whenever you see it, it's time for you to perform an action.
1313

14-
## Pre-requisites
15-
1. Start by making sure all of your policies are correct from this [guide](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionscreatingpolicies.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Tenancy%20for%20Function%20Development%7C_____4)
14+
## Prerequisites
15+
![user input icon](./images/userinput.png)
1616

17-
2. Have [Fn CLI setup with Oracle Functions](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionsconfiguringclient.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Client%20Environment%20for%20Function%20Development%7C_____0)
17+
1. Before you deploy this sample function, make sure you have run steps A, B
18+
and C of the [Oracle Functions Quick Start Guide for Cloud Shell](https://www.oracle.com/webfolder/technetwork/tutorials/infographics/oci_functions_cloudshell_quickview/functions_quickview_top/functions_quickview/index.html)
19+
* A - Set up your tenancy
20+
* B - Create application
21+
* C - Set up your Cloud Shell dev environment
1822

19-
3. Have your Oracle Object Storage Namespace available. This can be found by
23+
2. Have your Oracle Object Storage Namespace available. This can be found by
2024
logging into your [cloud account](https://console.us-ashburn-1.oraclecloud.com/),
2125
under your user profile, click on your Tenancy. Your Object Storage Namespace
2226
is shown there.
@@ -32,44 +36,32 @@ This folder includes files for both Java 11 and Java 8:
3236

3337
Rename `func-jdkXX.yaml` to `func.yaml` and `pom-jdkXX.xml` to `pom.xml`
3438

35-
## Context
36-
Switch to the correct context
3739

40+
## List Applications
3841
![user input icon](../images/userinput.png)
39-
```
40-
fn use context <your context name>
41-
```
42-
Check using
42+
43+
Assuming your have successfully completed the prerequisites, you should see your
44+
application in the list of applications.
45+
4346
```
4447
fn ls apps
4548
```
4649

50+
4751
## Create or Update your Dynamic Group
4852
In order to use and retrieve information about other OCI Services, your function
4953
must be part of a dynamic group. For information on how to create a dynamic group,
5054
click [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#To).
5155

5256
![user input icon](../images/userinput.png)
5357

54-
When specifying the *Matching Rules*, consider the following examples:
58+
When specifying the *Matching Rules*, consider the following example:
5559
* If you want all functions in a compartment to be able to access a resource,
5660
enter a rule similar to the following that adds all functions in the compartment
5761
with the specified compartment OCID to the dynamic group:
5862
```
5963
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
6064
```
61-
* If you want a specific function to be able to access a resource, enter a rule
62-
similar to the following that adds the function with the specified OCID to the
63-
dynamic group:
64-
```
65-
resource.id = 'ocid1.fnfunc.oc1.iad.aaaaaaaaacq______dnya'
66-
```
67-
* If you want all functions with a specific defined tag (free-form tags are
68-
not supported) to be able to access a resource, enter a rule similar to the
69-
following that adds all functions with the defined tag to the dynamic group :
70-
```
71-
ALL {resource.type = 'fnfunc', tag.department.operations.value = '45'}
72-
```
7365

7466

7567
## Create or Update Policies
@@ -91,30 +83,13 @@ Allow dynamic-group demo-func-dyn-group to inspect object-family in compartment
9183
For more information on how to create policies, go [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
9284

9385

94-
## Create an Application to run the function
95-
You can use an application already created or create a new one as follows:
96-
97-
![user input icon](../images/userinput.png)
98-
```
99-
fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]
100-
```
101-
You can find the subnet-ocid by logging on to [cloud.oracle.com](https://cloud.oracle.com/en_US/sign-in),
102-
navigating to Core Infrastructure > Networking > Virtual Cloud Networks. Make
103-
sure you are in the correct Region and Compartment, click on your VNC and
104-
select the subnet you wish to use.
105-
e.g.
106-
```
107-
fn create app object-crud --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaacnh..."]'
108-
```
109-
110-
11186
## Review the function
11287
Review the following files in the current folder:
11388
- `pom.xml` specifies all the dependencies for your function
11489
- `func.yaml` that contains metadata about your function and declares properties
11590
- `src/main/java/com/example/fn/ObjectStorageListObjects.java` which contains the Java code
11691

117-
The name of your function *oci-objectstorage-list-objects* is specified in `func.yaml`.
92+
The name of your function *oci-objectstorage-list-objects-java* is specified in `func.yaml`.
11893

11994
## Deploy the function
12095
![user input icon](../images/userinput.png)
@@ -156,10 +131,10 @@ Use the *fn* CLI to invoke your function with your own bucket name and app name:
156131

157132
![user input icon](../images/userinput.png)
158133
```
159-
echo -n '<bucket_name>' | fn invoke <app_name> oci-objectstorage-list-objects
134+
echo -n '<bucket_name>' | fn invoke <app_name> <function_name>
160135
```
161136
e.g.
162137
```
163-
echo -n 'mybucket' | fn invoke object-crud oci-objectstorage-list-objects
138+
echo -n 'mybucket' | fn invoke object-crud oci-objectstorage-list-objects-java
164139
```
165140
Upon success, you should see either a list of objects on your terminal.

oci-objectstorage-list-objects-java/func-jdk11.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
schema_version: 20180708
2-
name: oci-objectstorage-list-objects
2+
name: oci-objectstorage-list-objects-java
33
version: 0.0.1
44
runtime: java
55
build_image: fnproject/fn-java-fdk-build:jdk11-1.0.105

oci-objectstorage-list-objects-java/func-jdk8.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
schema_version: 20180708
2-
name: oci-objectstorage-list-objects
2+
name: oci-objectstorage-list-objects-java
33
version: 0.0.1
44
runtime: java8
55
build_image: fnproject/fn-java-fdk-build:1.0.98

oci-objectstorage-list-objects-java/func.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
schema_version: 20180708
2-
name: oci-objectstorage-list-objects
2+
name: oci-objectstorage-list-objects-java
33
version: 0.0.5
44
runtime: java
55
build_image: fnproject/fn-java-fdk-build:jdk11-1.0.105

oci-objectstorage-put-object-java/README.md

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,27 @@ As you make your way through this tutorial, look out for this icon ![user input
1212
Whenever you see it, it's time for you to perform an action.
1313

1414

15-
## Pre-requisites
16-
1. Start by making sure all of your policies are correct from this [guide](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionscreatingpolicies.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Tenancy%20for%20Function%20Development%7C_____4)
15+
## Prerequisites
16+
![user input icon](./images/userinput.png)
1717

18-
2. Have [Fn CLI setup with Oracle Functions](https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionsconfiguringclient.htm?tocpath=Services%7CFunctions%7CPreparing%20for%20Oracle%20Functions%7CConfiguring%20Your%20Client%20Environment%20for%20Function%20Development%7C_____0)
18+
1. Before you deploy this sample function, make sure you have run steps A, B
19+
and C of the [Oracle Functions Quick Start Guide for Cloud Shell](https://www.oracle.com/webfolder/technetwork/tutorials/infographics/oci_functions_cloudshell_quickview/functions_quickview_top/functions_quickview/index.html)
20+
* A - Set up your tenancy
21+
* B - Create application
22+
* C - Set up your Cloud Shell dev environment
1923

20-
3. Have your Oracle Object Storage Namespace available. This can be found by
24+
2. Have your Oracle Object Storage Namespace available. This can be found by
2125
logging into your [cloud account](https://console.us-ashburn-1.oraclecloud.com/),
2226
under your user profile, click on your Tenancy. Your Object Storage Namespace
2327
is shown there.
2428

2529

26-
## Context
27-
Switch to the correct context
28-
30+
## List Applications
2931
![user input icon](../images/userinput.png)
30-
```
31-
fn use context <your context name>
32-
```
33-
Check using
32+
33+
Assuming your have successfully completed the prerequisites, you should see your
34+
application in the list of applications.
35+
3436
```
3537
fn ls apps
3638
```
@@ -43,25 +45,13 @@ click [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingd
4345

4446
![user input icon](../images/userinput.png)
4547

46-
When specifying the *Matching Rules*, consider the following examples:
48+
When specifying the *Matching Rules*, consider the following example:
4749
* If you want all functions in a compartment to be able to access a resource,
4850
enter a rule similar to the following that adds all functions in the compartment
4951
with the specified compartment OCID to the dynamic group:
5052
```
5153
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
5254
```
53-
* If you want a specific function to be able to access a resource, enter a rule
54-
similar to the following that adds the function with the specified OCID to the
55-
dynamic group:
56-
```
57-
resource.id = 'ocid1.fnfunc.oc1.iad.aaaaaaaaacq______dnya'
58-
```
59-
* If you want all functions with a specific defined tag (free-form tags are
60-
not supported) to be able to access a resource, enter a rule similar to the
61-
following that adds all functions with the defined tag to the dynamic group :
62-
```
63-
ALL {resource.type = 'fnfunc', tag.department.operations.value = '45'}
64-
```
6555

6656

6757
## Create or Update Policies
@@ -82,30 +72,13 @@ Allow dynamic-group demo-func-dyn-group to manage object-family in compartment d
8272
For more information on how to create policies, go [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
8373

8474

85-
## Create an Application to run the function
86-
You can use an application already created or create a new one as follows:
87-
88-
![user input icon](../images/userinput.png)
89-
```
90-
fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]
91-
```
92-
You can find the subnet-ocid by logging on to [cloud.oracle.com](https://cloud.oracle.com/en_US/sign-in),
93-
navigating to Core Infrastructure > Networking > Virtual Cloud Networks. Make
94-
sure you are in the correct Region and Compartment, click on your VNC and
95-
select the subnet you wish to use.
96-
e.g.
97-
```
98-
fn create app object-crud --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaacnh..."]'
99-
```
100-
101-
10275
## Review the function
10376
Review the following files in the current folder:
10477
- [pom.xml](./pom.xml) specifies all the dependencies for your function
10578
- [func.yaml](./func.yaml) that contains metadata about your function and declares properties
10679
- [src/main/java/com/example/fn/ObjectStoragePutObject.java](./src/main/java/com/example/fn/ObjectStoragePutObject.java) which contains the Java code
10780

108-
The name of your function *oci-objectstorage-put-object* is specified in [func.yaml](./func.yaml).
81+
The name of your function *oci-objectstorage-put-object-java* is specified in [func.yaml](./func.yaml).
10982

11083

11184
## Deploy the function
@@ -148,10 +121,10 @@ Use the *fn* CLI to invoke your function with your own bucket name and app name:
148121

149122
![user input icon](../images/userinput.png)
150123
```
151-
echo -n '{"name": "<object_name>", "bucketName":"<bucket_name>", "content": "<text_content>"}' | fn invoke <your app> oci-objectstorage-put-object
124+
echo -n '{"name": "<object_name>", "bucketName":"<bucket_name>", "content": "<text_content>"}' | fn invoke <app_name> <function_name>
152125
```
153126
e.g.
154127
```
155-
echo -n '{"name": "file1.txt", "bucketName":"test", "content": "This file was created in OCI object storage bucket using Oracle Functions"}' | fn invoke object-crud oci-objectstorage-put-object
128+
echo -n '{"name": "file1.txt", "bucketName":"test", "content": "This file was created in OCI object storage bucket using Oracle Functions"}' | fn invoke object-crud oci-objectstorage-put-object-java
156129
```
157130
Upon success, you should see a success message appear in your terminal.

oci-objectstorage-put-object-java/func.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
schema_version: 20180708
2-
name: oci-objectstorage-put-object
2+
name: oci-objectstorage-put-object-java
33
version: 0.0.1
44
runtime: java
55
build_image: fnproject/fn-java-fdk-build:jdk11-1.0.105

0 commit comments

Comments
 (0)