Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubFrejlach committed May 7, 2024
1 parent f6b4a9b commit 5688b36
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 140 deletions.
15 changes: 11 additions & 4 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ OSIDB uses token (JWT) authentication on most of the endpoints. Bindings handles
session = osidb_bindings.new_session(osidb_server_uri="http://localhost:8000/")
```

Some operations mentioned in [operations section](#session-operations) (mainly unsafe operations which creates or modify content) will require Bugzilla API key to work properly. Valid Bugzilla API key is provided via `BUGZILLA_API_KEY` environment variable.
Some operations mentioned in [operations section](#session-operations) (mainly unsafe operations which creates or modify content) will require Bugzilla API key or Jira Access Token to work properly.

```bash
export BUGZILLA_API_KEY="bugzilla api key"
```
* Valid Bugzilla API key is provided via `BUGZILLA_API_KEY` environment variable.

```bash
export BUGZILLA_API_KEY="bugzilla api key"
```
* Valid Jira Access Token is provided via `JIRA_ACCESS_TOKEN` environment variable.

```bash
export JIRA_ACCESS_TOKEN="jira access token"
```

The SSL verification is enabled by the default and in order to work properly you should export the `REQUESTS_CA_BUNDLE` environment variable to point to the location with the proper CA bundle. For example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ def _get_kwargs(
form_data: AffectPost,
multipart_data: AffectPost,
json_body: AffectPost,
bugzilla_api_key: str,
) -> Dict[str, Any]:
url = "{}/osidb/api/v1/affects".format(
client.base_url,
)

headers: Dict[str, Any] = client.get_headers()

headers["bugzilla-api-key"] = bugzilla_api_key

json_json_body: Dict[str, Any] = UNSET
if not isinstance(json_body, Unset):
json_body.to_dict()
Expand Down Expand Up @@ -76,14 +73,12 @@ def sync_detailed(
form_data: AffectPost,
multipart_data: AffectPost,
json_body: AffectPost,
bugzilla_api_key: str,
) -> Response[OsidbApiV1AffectsCreateResponse201]:
kwargs = _get_kwargs(
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)

response = requests.post(
Expand All @@ -103,7 +98,6 @@ def sync(
form_data: AffectPost,
multipart_data: AffectPost,
json_body: AffectPost,
bugzilla_api_key: str,
) -> Optional[OsidbApiV1AffectsCreateResponse201]:
""" """

Expand All @@ -112,7 +106,6 @@ def sync(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
).parsed


Expand All @@ -122,14 +115,12 @@ async def async_detailed(
form_data: AffectPost,
multipart_data: AffectPost,
json_body: AffectPost,
bugzilla_api_key: str,
) -> Response[OsidbApiV1AffectsCreateResponse201]:
kwargs = _get_kwargs(
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)

async with client.get_async_session().post(
Expand All @@ -149,7 +140,6 @@ async def async_(
form_data: AffectPost,
multipart_data: AffectPost,
json_body: AffectPost,
bugzilla_api_key: str,
) -> Optional[OsidbApiV1AffectsCreateResponse201]:
""" """

Expand All @@ -159,6 +149,5 @@ async def async_(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)
).parsed
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def _get_kwargs(
form_data: Affect,
multipart_data: Affect,
json_body: Affect,
bugzilla_api_key: str,
) -> Dict[str, Any]:
url = "{}/osidb/api/v1/affects/{uuid}".format(
client.base_url,
Expand All @@ -29,8 +28,6 @@ def _get_kwargs(

headers: Dict[str, Any] = client.get_headers()

headers["bugzilla-api-key"] = bugzilla_api_key

json_json_body: Dict[str, Any] = UNSET
if not isinstance(json_body, Unset):
json_body.to_dict()
Expand Down Expand Up @@ -79,15 +76,13 @@ def sync_detailed(
form_data: Affect,
multipart_data: Affect,
json_body: Affect,
bugzilla_api_key: str,
) -> Response[OsidbApiV1AffectsUpdateResponse200]:
kwargs = _get_kwargs(
uuid=uuid,
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)

response = requests.put(
Expand All @@ -108,7 +103,6 @@ def sync(
form_data: Affect,
multipart_data: Affect,
json_body: Affect,
bugzilla_api_key: str,
) -> Optional[OsidbApiV1AffectsUpdateResponse200]:
""" """

Expand All @@ -118,7 +112,6 @@ def sync(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
).parsed


Expand All @@ -129,15 +122,13 @@ async def async_detailed(
form_data: Affect,
multipart_data: Affect,
json_body: Affect,
bugzilla_api_key: str,
) -> Response[OsidbApiV1AffectsUpdateResponse200]:
kwargs = _get_kwargs(
uuid=uuid,
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)

async with client.get_async_session().put(
Expand All @@ -158,7 +149,6 @@ async def async_(
form_data: Affect,
multipart_data: Affect,
json_body: Affect,
bugzilla_api_key: str,
) -> Optional[OsidbApiV1AffectsUpdateResponse200]:
""" """

Expand All @@ -169,6 +159,5 @@ async def async_(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
)
).parsed
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ def _get_kwargs(
form_data: FlawPost,
multipart_data: FlawPost,
json_body: FlawPost,
bugzilla_api_key: str,
jira_api_key: str,
) -> Dict[str, Any]:
url = "{}/osidb/api/v1/flaws".format(
client.base_url,
)

headers: Dict[str, Any] = client.get_headers()

headers["bugzilla-api-key"] = bugzilla_api_key
headers["jira-api-key"] = jira_api_key

json_json_body: Dict[str, Any] = UNSET
if not isinstance(json_body, Unset):
json_body.to_dict()
Expand Down Expand Up @@ -78,16 +73,12 @@ def sync_detailed(
form_data: FlawPost,
multipart_data: FlawPost,
json_body: FlawPost,
bugzilla_api_key: str,
jira_api_key: str,
) -> Response[OsidbApiV1FlawsCreateResponse201]:
kwargs = _get_kwargs(
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
jira_api_key=jira_api_key,
)

response = requests.post(
Expand All @@ -107,8 +98,6 @@ def sync(
form_data: FlawPost,
multipart_data: FlawPost,
json_body: FlawPost,
bugzilla_api_key: str,
jira_api_key: str,
) -> Optional[OsidbApiV1FlawsCreateResponse201]:
""" """

Expand All @@ -117,8 +106,6 @@ def sync(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
jira_api_key=jira_api_key,
).parsed


Expand All @@ -128,16 +115,12 @@ async def async_detailed(
form_data: FlawPost,
multipart_data: FlawPost,
json_body: FlawPost,
bugzilla_api_key: str,
jira_api_key: str,
) -> Response[OsidbApiV1FlawsCreateResponse201]:
kwargs = _get_kwargs(
client=client,
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
jira_api_key=jira_api_key,
)

async with client.get_async_session().post(
Expand All @@ -157,8 +140,6 @@ async def async_(
form_data: FlawPost,
multipart_data: FlawPost,
json_body: FlawPost,
bugzilla_api_key: str,
jira_api_key: str,
) -> Optional[OsidbApiV1FlawsCreateResponse201]:
""" """

Expand All @@ -168,7 +149,5 @@ async def async_(
form_data=form_data,
multipart_data=multipart_data,
json_body=json_body,
bugzilla_api_key=bugzilla_api_key,
jira_api_key=jira_api_key,
)
).parsed
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def _get_kwargs(
flaw_id: str,
*,
client: AuthenticatedClient,
jira_api_key: str,
) -> Dict[str, Any]:
url = "{}/osidb/api/v1/flaws/{flaw_id}/promote".format(
client.base_url,
Expand All @@ -24,8 +23,6 @@ def _get_kwargs(

headers: Dict[str, Any] = client.get_headers()

headers["jira-api-key"] = jira_api_key

return {
"url": url,
"headers": headers,
Expand Down Expand Up @@ -64,12 +61,10 @@ def sync_detailed(
flaw_id: str,
*,
client: AuthenticatedClient,
jira_api_key: str,
) -> Response[OsidbApiV1FlawsPromoteCreateResponse200]:
kwargs = _get_kwargs(
flaw_id=flaw_id,
client=client,
jira_api_key=jira_api_key,
)

response = requests.post(
Expand All @@ -87,7 +82,6 @@ def sync(
flaw_id: str,
*,
client: AuthenticatedClient,
jira_api_key: str,
) -> Optional[OsidbApiV1FlawsPromoteCreateResponse200]:
"""workflow promotion API endpoint
Expand All @@ -97,20 +91,17 @@ def sync(
return sync_detailed(
flaw_id=flaw_id,
client=client,
jira_api_key=jira_api_key,
).parsed


async def async_detailed(
flaw_id: str,
*,
client: AuthenticatedClient,
jira_api_key: str,
) -> Response[OsidbApiV1FlawsPromoteCreateResponse200]:
kwargs = _get_kwargs(
flaw_id=flaw_id,
client=client,
jira_api_key=jira_api_key,
)

async with client.get_async_session().post(
Expand All @@ -128,7 +119,6 @@ async def async_(
flaw_id: str,
*,
client: AuthenticatedClient,
jira_api_key: str,
) -> Optional[OsidbApiV1FlawsPromoteCreateResponse200]:
"""workflow promotion API endpoint
Expand All @@ -139,6 +129,5 @@ async def async_(
await async_detailed(
flaw_id=flaw_id,
client=client,
jira_api_key=jira_api_key,
)
).parsed
Loading

0 comments on commit 5688b36

Please sign in to comment.