-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31f38df
commit fc38135
Showing
53 changed files
with
1,424 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ces/models/oci.container_instances.models.CreateLinuxSecurityContextDetails.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CreateLinuxSecurityContextDetails | ||
================================= | ||
|
||
.. currentmodule:: oci.container_instances.models | ||
|
||
.. autoclass:: CreateLinuxSecurityContextDetails | ||
:show-inheritance: | ||
:special-members: __init__ | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
11 changes: 11 additions & 0 deletions
11
...nstances/models/oci.container_instances.models.CreateSecurityContextDetails.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CreateSecurityContextDetails | ||
============================ | ||
|
||
.. currentmodule:: oci.container_instances.models | ||
|
||
.. autoclass:: CreateSecurityContextDetails | ||
:show-inheritance: | ||
:special-members: __init__ | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
11 changes: 11 additions & 0 deletions
11
...tainer_instances/models/oci.container_instances.models.LinuxSecurityContext.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
LinuxSecurityContext | ||
==================== | ||
|
||
.. currentmodule:: oci.container_instances.models | ||
|
||
.. autoclass:: LinuxSecurityContext | ||
:show-inheritance: | ||
:special-members: __init__ | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
11 changes: 11 additions & 0 deletions
11
...i/container_instances/models/oci.container_instances.models.SecurityContext.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SecurityContext | ||
=============== | ||
|
||
.. currentmodule:: oci.container_instances.models | ||
|
||
.. autoclass:: SecurityContext | ||
:show-inheritance: | ||
:special-members: __init__ | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
docs/api/core/models/oci.core.models.ClusterConfigurationDetails.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ClusterConfigurationDetails | ||
=========================== | ||
|
||
.. currentmodule:: oci.core.models | ||
|
||
.. autoclass:: ClusterConfigurationDetails | ||
:show-inheritance: | ||
:special-members: __init__ | ||
:members: | ||
:undoc-members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# coding: utf-8 | ||
# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. | ||
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. | ||
|
||
# Goal of Script!!! | ||
# By avoiding API calls without dependencies to be processed in serial in our code, we get a significant performance increase on API collections. | ||
# This code sends the API call to the thread pool so we do not have to wait for the previous API call to finish before going to the next API call. | ||
|
||
import oci | ||
import concurrent.futures | ||
import time | ||
|
||
config = oci.config.from_file() | ||
identity_client = oci.identity.IdentityClient(config) | ||
# Time How Long the the API Calls Take. | ||
timer = time.time() | ||
|
||
# Run the "List Users" call to get all of the configured users. This will get the dependencies for the "List API Keys" call. | ||
list_users_response = identity_client.list_users(config['tenancy']) | ||
|
||
# Save the active API keys to this list. | ||
active_api_keys = [] | ||
|
||
# Function that executes the "list_api_keys" call. | ||
# If the user has an active API key, the function will add it to the active_api_keys list. | ||
|
||
|
||
def api_function(user_ocid): | ||
list_api_keys_response = identity_client.list_api_keys(user_ocid) | ||
if list_api_keys_response.data: | ||
active_api_keys.extend(list_api_keys_response.data) | ||
|
||
|
||
# Create a Thread Pool to submit tasks. The Max Workers is how many threads can be executed at one time. | ||
thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10) | ||
|
||
# Iterate through each user and get the API keys. | ||
# Submit the call to the thread pool with the user.id argument to the list_api_keys API call. | ||
for user in list_users_response.data: | ||
thread_pool.submit(api_function, user.id) | ||
|
||
# Wait for all of the tasks in the thread pool to complete before finishing the script. | ||
thread_pool.shutdown(wait=True) | ||
|
||
# Show How Many Keys Were Found | ||
print(len(active_api_keys)) | ||
|
||
# See How Long the Call Took. Enjoy your speed enhancement on your OCI API calls :) | ||
print(f"Script took {(time.time()- timer)}s") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.