Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 785f689

Browse files
Cleaned up the readme file
1 parent 98af859 commit 785f689

File tree

1 file changed

+34
-60
lines changed
  • oci-objectstorage-put-object-python

1 file changed

+34
-60
lines changed

‎oci-objectstorage-put-object-python/README.md

Lines changed: 34 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,67 +13,51 @@ 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+
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
1922

20-
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
2124
logging into your [cloud account](https://console.us-ashburn-1.oraclecloud.com/),
2225
under your user profile, click on your Tenancy. Your Object Storage Namespace
2326
is shown there.
2427

2528

26-
## Context
27-
Switch to the correct context
29+
## List Applications
30+
31+
Assuming you have successfully completed the prerequisites, you should see your
32+
application in the list of applications.
2833

29-
![user input icon](../images/userinput.png)
30-
```
31-
fn use context <your context name>
32-
```
33-
Check using
3434
```
3535
fn ls apps
3636
```
3737

3838

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

44-
![user input icon](../images/userinput.png)
41+
In order to use other OCI Services, your function must be part of a dynamic
42+
group. For information on how to create a dynamic group, refer to the
43+
[documentation](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm#To).
44+
45+
When specifying the *Matching Rules*, we suggest matching all functions in a compartment with:
4546

46-
When specifying the *Matching Rules*, consider the following examples:
47-
* If you want all functions in a compartment to be able to access a resource,
48-
enter a rule similar to the following that adds all functions in the compartment
49-
with the specified compartment OCID to the dynamic group:
50-
```
51-
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaaaa23______smwa'}
52-
```
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 :
6247
```
63-
ALL {resource.type = 'fnfunc', tag.department.operations.value = '45'}
48+
ALL {resource.type = 'fnfunc', resource.compartment.id = 'ocid1.compartment.oc1..aaaaaxxxxx'}
6449
```
6550

6651

67-
## Create or Update Policies
68-
Now that your dynamic group is created, create a new policy that allows the
69-
dynamic group to manage any resources you are interested in updating, in this
70-
case we will grant access to `object-family` in the functions related compartment.
52+
## Create or Update IAM Policies
53+
54+
Create a new policy that allows the dynamic group to manage `object-family` in the functions related compartment.
7155

7256
![user input icon](../images/userinput.png)
7357

7458
Your policy should look something like this:
7559
```
76-
Allow dynamic-group <your dynamicgroupname> to manage object-family in compartment <your compartmentname>
60+
Allow dynamic-group <dynamic-group-name> to manage object-family in compartment <compartment-name>
7761
```
7862
e.g.
7963
```
@@ -82,25 +66,10 @@ Allow dynamic-group demo-func-dyn-group to manage object-family in compartment d
8266
For more information on how to create policies, go [here](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
8367

8468

85-
## Create an Application to run the function
86-
You can use an application already created or create a new one as follows:
69+
## Review and customize the function
8770

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-
102-
## Review the function
10371
Review the following files in the current folder:
72+
10473
- [requirements.txt](./requirements.txt) specifies all the dependencies for your function
10574
- [func.yaml](./func.yaml) that contains metadata about your function and declares properties
10675
- [func.py](./func.py) which is your actual Python function
@@ -109,25 +78,30 @@ The name of your function *oci-objectstorage-put-object-python* is specified in
10978

11079

11180
## Deploy the function
81+
82+
In Cloud Shell, run the `fn deploy` command to build the function and its dependencies as a Docker image,
83+
push the image to the specified Docker registry, and deploy the function to Oracle Functions
84+
in the application created earlier:
85+
11286
![user input icon](../images/userinput.png)
11387

114-
From the current folder, run the following command:
11588
```
116-
fn -v deploy --app <your appname>
89+
fn -v deploy --app <app-name>
11790
```
11891
e.g.
11992
```
120-
fn -v deploy --app object-crud
93+
fn -v deploy --app myapp
12194
```
12295

12396

124-
## Invoke the function
97+
## Test
98+
12599
![user input icon](../images/userinput.png)
126100
```
127-
echo -n <JSONobject> | fn invoke <your appname> <your functionname>
101+
echo -n <JSON-object> | fn invoke <app-name> <function-name>
128102
```
129103
e.g.
130104
```
131-
echo -n '{"objectName": "<object-name>", "bucketName": "<bucket-name>", "content": "<content>"}' | fn invoke object-crud oci-objectstorage-put-object-python
105+
echo -n '{"objectName": "<object-name>", "bucketName": "<bucket-name>", "content": "<content>"}' | fn invoke myapp oci-objectstorage-put-object-python
132106
```
133-
Upon success, you should see a success message appear in your terminal.
107+
You should see a success message appear in the terminal.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /