You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please check the [Accessing Other Oracle Cloud Infrastructure Resources from Running Functions](https://docs.cloud.oracle.com/en-us/iaas/Content/Functions/Tasks/functionsaccessingociresources.htm) for other *Matching Rules* options.
35
35
36
36
37
-
## Create or Update IAM Policies
38
-
Create a new policy that allows the dynamic group to manage compute instances. We will grant `inspect/use/manage` access to `xxx` in the compartment.
37
+
## Create or Update IAM Policies for Dynamic Groups
38
+
Create a new policy that allows the dynamic group to manage the Object Storage resource. We will grant `manage` access to allow our function to put objects into the Object Storage in the compartment.
39
39
40
40

41
41
42
42
Your policy should look something like this:
43
43
```
44
-
Allow dynamic-group <dynamic-group-name> to xxx XXX in compartment <compartment-name>
44
+
Allow dynamic-group <dynamic-group-name> to manage object-family in compartment id <compartment-id>
45
+
```
46
+
e.g.
47
+
```
48
+
Allow dynamic-group oci-oic-fn-dynamic-group to manage object-family in compartment id ocid1.compartment.oc1..aaaaaaaa4233
45
49
```
46
50
47
51
For more information on how to create policies, check the [documentation](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policysyntax.htm).
48
52
49
-
50
53
## Review and customize the function
51
54
Review the following files in the current folder:
52
55
* the code of the function, [func.py](./processEmployee/func.py)
@@ -66,22 +69,26 @@ fn -v deploy --app <app-name>
66
69
## Set the function configuration values
67
70
The function requires the following configuration values to be set:
68
71
- OCI_NAMESPACE
72
+
- OCI_BUCKETNAME
69
73
70
74

71
75
72
76
Use the *fn CLI* to set the config value:
73
77
```
74
78
fn config function <app-name> <function-name> OCI_NAMESPACE <NAMESPACE>
79
+
fn config function <app-name> <function-name> OCI_BUCKETNAME <BUCKETNAME>
75
80
```
76
81
e.g.
77
82
```
78
83
fn config function myapp OCI_NAMESPACE mynamespace
84
+
fn config function myapp OCI_BUCKETNAME mybucket
79
85
```
80
86
81
87
## Test the function
82
-
```bash
83
-
# After deploying the function and configuring the namespace, you can test the function by invoking:
88
+
After deploying the function and configuring the namespace and the bucketname, you can test the function by invoking the function with a JSON payload as shown below.
84
89
90
+

91
+
```bash
85
92
echo -n "{
86
93
'firstname': '',
87
94
'lastname': '',
@@ -90,15 +97,19 @@ echo -n "{
90
97
'effectivestartdate': '',
91
98
'personid': ''
92
99
}"| fn invoke <app-name><function-name>
93
-
94
-
# where the json is the expected payload structure
95
100
```
96
101
97
102
## Calling the function from OIC
98
103
To call the function from OIC, you will have to have an integration using a REST adapter connection pointing to this function.
99
104
100
105
101
-
To setup your REST connection in your integration, the option `Configure a request payload for this endpoint` in the Basic Info page must be *checked*. On the next tab, `Requests`, the below sample json needs to be set for the target data to appear inside the mapper.
106
+
To setup your REST connection in your integration, the option `Configure a request payload for this endpoint` in the Basic Info page must be *checked*.
107
+
108
+

109
+
110
+
On the next tab, `Requests`, the below sample json needs to be set for the target data to appear inside the mapper. Enter a sample JSON like the one below to describe the HTTP message payload. You can set this definition by click on `inline` as shown below.
111
+
112
+

102
113
103
114
```bash
104
115
{
@@ -113,6 +124,6 @@ To setup your REST connection in your integration, the option `Configure a reque
113
124
114
125
In the mapper connecting to the REST adapter connection, the data in the source needs to be mapped to the target. In this case, the source data is from a GET request pulling the information from Oracle Human Capital Management (HCM).
115
126
116
-

127
+

117
128
118
129
An example of how this invocation is done from OIC can be found in this [documentation](https://docs.oracle.com/en/cloud/paas/integration-cloud/rest-adapter/configure-rest-adapter-consume-oracle-functions.html).
0 commit comments