Skip to content

Commit a3a44d2

Browse files
committed
Cleaned up the readme file
1 parent cdf657d commit a3a44d2

File tree

2 files changed

+52
-92
lines changed

2 files changed

+52
-92
lines changed

oci-list-compartments-python/README.md

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This function uses Resource Principals to securely authorize a function to make
44
API calls to OCI services using the [OCI Python SDK](https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/index.html).
5-
It returns a list of all compartments within the tenancy regardless of region.
5+
It returns a list of all compartments within the tenancy.
66

77
The function calls the following OCI Python SDK classes:
88
* [Resource Principals Signer](https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/signing.html#resource-principals-signer) to authenticate
@@ -13,74 +13,41 @@ Whenever you see it, it's time for you to perform an action.
1313

1414

1515
## Prerequisites
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)
1716

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)
17+
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_faas_gettingstarted_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
1922

2023

21-
## Context
22-
Switch to the correct context
24+
## List Applications
25+
26+
Assuming you have successfully completed the prerequisites, you should see your
27+
application in the list of applications.
2328

24-
![user input icon](../images/userinput.png)
25-
```
26-
fn use context <your context name>
27-
```
28-
Check using
2929
```
3030
fn ls apps
3131
```
3232

3333

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

39-
![user input icon](../images/userinput.png)
36+
In order to use other OCI Services, your function must be part of a dynamic
37+
group. For information on how to create a dynamic group, refer to the
38+
[documentation](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#To).
4039

41-
When specifying the *Matching Rules*, consider the following examples:
42-
* If you want all functions in a compartment to be able to access a resource,
43-
enter a rule similar to the following that adds all functions in the compartment
44-
with the specified compartment OCID to the dynamic group:
40+
When specifying the *Matching Rules*, we suggest matching all functions in a compartment with:
4541
```
46-
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
47-
```
48-
* If you want a specific function to be able to access a resource, enter a rule
49-
similar to the following that adds the function with the specified OCID to the
50-
dynamic group:
51-
```
52-
resource.id = 'ocid1.fnfunc.oc1.iad.aaaaaaaaacq______dnya'
53-
```
54-
* If you want all functions with a specific defined tag (free-form tags are
55-
not supported) to be able to access a resource, enter a rule similar to the
56-
following that adds all functions with the defined tag to the dynamic group :
57-
```
58-
ALL {resource.type = 'fnfunc', tag.department.operations.value = '45'}
42+
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaxxxxx'}
5943
```
6044

6145

6246
## Create or Update Policies
6347
This function does not require any particular IAM policy.
6448

6549

66-
## Create an Application to run your function
67-
You can use an application already created or create a new one as follow:
68-
![user input icon](../images/userinput.png)
69-
```
70-
fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]'
71-
```
72-
You can find the subnet-ocid by logging on to [cloud.oracle.com](https://cloud.oracle.com/en_US/sign-in),
73-
navigating to Core Infrastructure > Networking > Virtual Cloud Networks. Make
74-
sure you are in the correct Region and Compartment, click on your VCN and
75-
select the subnet you wish to use.
76-
77-
e.g.
78-
```
79-
fn create app myapp --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx.aaaaaaaacnh..."]'
80-
```
81-
82-
83-
## Review and customize your function
50+
## Review and customize the function
8451
Review the following files in the current folder:
8552
- [requirements.txt](./requirements.txt) which specifies all the dependencies for your function
8653
- [func.yaml](./func.yaml) which contains metadata about your function and declares properties
@@ -90,9 +57,14 @@ The name of your function *oci-list-compartments-python* is specified in [func.y
9057

9158

9259
## Deploy the function
60+
61+
In Cloud Shell, run the *fn deploy* command to build the function and its dependencies as a Docker image,
62+
push the image to the specified Docker registry, and deploy the function to Oracle Functions
63+
in the application created earlier:
64+
9365
![user input icon](../images/userinput.png)
9466
```
95-
fn -v deploy --app <your app name>
67+
fn -v deploy --app <app-name>
9668
```
9769
e.g.
9870
```
@@ -103,10 +75,10 @@ fn -v deploy --app myapp
10375
## Invoke the function
10476
![user input icon](../images/userinput.png)
10577
```
106-
fn invoke <your app name> <your function name>
78+
fn invoke <app-name> <function-name>
10779
```
10880
e.g.
10981
```
11082
fn invoke myapp oci-list-compartments-python
11183
```
112-
Upon success, you should see all of the compartments in your tenancy appear in your terminal.
84+
You should see all the compartments in your tenancy listed in the terminal.

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

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Whenever you see it, it's time for you to perform an action.
1313

1414

1515
## Prerequisites
16-
![user input icon](./images/userinput.png)
1716

1817
1. Before you deploy this sample function, make sure you have run steps A, B
1918
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)
@@ -28,9 +27,8 @@ is shown there.
2827

2928

3029
## List Applications
31-
![user input icon](../images/userinput.png)
3230

33-
Assuming your have successfully completed the prerequisites, you should see your
31+
Assuming you have successfully completed the prerequisites, you should see your
3432
application in the list of applications.
3533

3634
```
@@ -39,41 +37,35 @@ fn ls apps
3937

4038

4139
## Create or Update your Dynamic Group
42-
In order to use and retrieve information about other OCI Services, your function
43-
must be part of a dynamic group. For information on how to create a dynamic group,
44-
click [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#To).
45-
46-
![user input icon](../images/userinput.png)
40+
In order to use other OCI Services, your function must be part of a dynamic
41+
group. For information on how to create a dynamic group, refer to the
42+
[documentation](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#To).
4743

48-
When specifying the *Matching Rules*, consider the following example:
49-
* If you want all functions in a compartment to be able to access a resource,
50-
enter a rule similar to the following that adds all functions in the compartment
51-
with the specified compartment OCID to the dynamic group:
44+
When specifying the *Matching Rules*, we suggest matching all functions in a compartment with:
5245
```
53-
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
46+
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaxxxxx'}
5447
```
5548

5649

5750
## Create or Update Policies
58-
Now that your dynamic group is created, create a new policy that allows the
59-
dynamic group to read any resources you are interested in receiving
60-
information about, in this case we will grant access to `object-family` in
51+
Create a new policy that allows the dynamic group to read `object-family` in
6152
the functions related compartment.
6253

6354
![user input icon](../images/userinput.png)
6455

6556
Your policy should look something like this:
6657
```
67-
Allow dynamic-group <your dynamic group name> to read object-family in compartment <your compartment name>
58+
Allow dynamic-group <dynamic-group-name> to read object-family in compartment <compartment-name>
6859
```
6960
e.g.
7061
```
7162
Allow dynamic-group demo-func-dyn-group to read object-family in compartment demo-func-compartment
7263
```
73-
For more information on how to create policies, go [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
64+
For more information on how to create policies, check the
65+
[documentation](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
7466

7567

76-
## Review the function
68+
## Review and customize the function
7769
Review the following files in the current folder:
7870
- [pom.xml](./pom.xml) specifies all the dependencies for your function
7971
- [func.yaml](./func.yaml) that contains metadata about your function and declares properties
@@ -83,15 +75,15 @@ The name of your function *oci-objectstorage-get-object-java* is specified in [f
8375

8476

8577
## Deploy the function
78+
79+
In Cloud Shell, run the *fn deploy* command to build the function and its dependencies as a Docker image,
80+
push the image to the specified Docker registry, and deploy the function to Oracle Functions
81+
in the application created earlier:
82+
8683
![user input icon](../images/userinput.png)
8784

88-
From the current folder, run the following command:
89-
```
90-
fn -v deploy --app <your app name>
91-
```
92-
e.g.
9385
```
94-
fn -v deploy --app object-crud
86+
fn -v deploy --app <app-name>
9587
```
9688

9789

@@ -100,33 +92,29 @@ The function requires the config value *NAMESPACE* to be set.
10092

10193
![user input icon](../images/userinput.png)
10294

103-
Use the *fn* CLI to set the config value:
104-
```
105-
fn config function <your app name> <function name> NAMESPACE <your namespace>
106-
```
107-
e.g.
108-
```
109-
fn config function object-crud get-object NAMESPACE mytenancy
110-
```
111-
Note that the config value can also be set at the application level:
95+
Use the *fn* CLI to set the config value at the application level (if multiple
96+
functions need the same config value):
97+
11298
```
113-
fn config app <your app name> NAMESPACE <your namespace>
99+
fn config app <app-name> NAMESPACE <object-storage-namespace>
114100
```
115101
e.g.
116102
```
117-
fn config app object-crud NAMESPACE mytenancy
103+
fn config app myapp NAMESPACE mynamespace
118104
```
119105

106+
Note that the config value can also be set at the function level.
107+
120108

121-
## Invoke the function
122-
Use the *fn* CLI to invoke your function with your own object name, bucket name and app name:
109+
## Test
110+
Use the *fn* CLI to test your function with your own object name, bucket name and app name:
123111

124112
![user input icon](../images/userinput.png)
125113
```
126-
echo -n '{"name": "<object_name>", "bucketName":"<bucket_name>"}' | fn invoke <app_name> <function_name>
114+
echo -n '{"name": "<object-name>", "bucketName":"<bucket-name>"}' | fn invoke <app-name> <function-name>
127115
```
128116
e.g.
129117
```
130118
echo -n '{"name": "file1.txt", "bucketName":"mybucket"}' | fn invoke object-crud oci-objectstorage-get-object-java
131119
```
132-
Upon success, you should see the content of the object appear in your terminal.
120+
You should see the contents of the object appear in the terminal.

0 commit comments

Comments
 (0)