Skip to content

Commit 414241d

Browse files
committed
debug: try a notebook ipynb
1 parent 2d0bb80 commit 414241d

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "28fb3454",
6+
"metadata": {},
7+
"source": [
8+
"# Introduction to Secret Manager\n",
9+
"\n",
10+
"TODO(glasnt): write secret intro"
11+
]
12+
},
13+
{
14+
"cell_type": "markdown",
15+
"id": "1fbaf44f",
16+
"metadata": {},
17+
"source": [
18+
"## Before you begin\n",
19+
"\n",
20+
"1. [Enable the Secret Manager API](https://cloud.google.com/secret-manager/docs/configuring-secret-manager)\n",
21+
"1. Set up authentication\n",
22+
" * TODO(glasnt): details\n",
23+
"\n",
24+
"## Required roles\n",
25+
"\n",
26+
"TODO(glasnt): `roles/secretmanager.admin`\n",
27+
"\n",
28+
"## Install dependencies"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"id": "fa2c0cb5",
35+
"metadata": {
36+
"vscode": {
37+
"languageId": "shellscript"
38+
}
39+
},
40+
"outputs": [],
41+
"source": [
42+
"%%capture\n",
43+
"%pip install google-cloud-secret-manager"
44+
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"id": "ea877cf5",
49+
"metadata": {},
50+
"source": [
51+
"## Create a secret"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": null,
57+
"id": "21414ea1",
58+
"metadata": {},
59+
"outputs": [],
60+
"source": [
61+
"# [START secret_create_secret_notebook]\n",
62+
"from google.cloud import secretmanager\n",
63+
"\n",
64+
"project_id = \"PROJECT_ID\"\n",
65+
"secret_id = \"SECRET_ID\"\n",
66+
"\n",
67+
"client = secretmanager.SecretManagerServiceClient()\n",
68+
"response = client.create_secret(\n",
69+
" parent=f\"projects/{project_id}\",\n",
70+
" secret_id=secret_id,\n",
71+
" secret={\"replication\": {\"automatic\": {}}},\n",
72+
")\n",
73+
"\n",
74+
"print(f\"Created secret: {response.name}\")\n",
75+
"# [END secret_create_secret_notebook]"
76+
]
77+
},
78+
{
79+
"cell_type": "markdown",
80+
"id": "2ba37c38",
81+
"metadata": {},
82+
"source": [
83+
"## Dev Notes\n",
84+
"\n",
85+
"* `# @param {type:\"string\"}` only works for Google Colabs. "
86+
]
87+
}
88+
],
89+
"metadata": {
90+
"language_info": {
91+
"name": "python"
92+
}
93+
},
94+
"nbformat": 4,
95+
"nbformat_minor": 5
96+
}

0 commit comments

Comments
 (0)