Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
SDKs
Python SDK
Commits
e07ba497
Commit
e07ba497
authored
Feb 23, 2021
by
Bill Wang
Browse files
Add basic schema retrieval api
parent
8eb69808
Changes
4
Hide whitespace changes
Inline
Side-by-side
osdu_api/clients/base_client.py
View file @
e07ba497
...
...
@@ -63,7 +63,7 @@ class BaseClient:
self
.
entitlements_url
=
config_parser
.
get
(
'environment'
,
'entitlements_url'
)
self
.
dataset_url
=
config_parser
.
get
(
'environment'
,
'dataset_url'
)
self
.
use_service_principal
=
config_parser
.
get
(
'environment'
,
'use_service_principal'
)
self
.
schema_url
=
config_parser
.
get
(
'environment'
,
'schema_url'
)
self
.
provider
=
config_parser
.
get
(
'provider'
,
'name'
)
self
.
service_principal_module_name
=
config_parser
.
get
(
'provider'
,
'service_principal_module_name'
)
...
...
@@ -112,4 +112,4 @@ class BaseClient:
self
.
unauth_retries
=
0
return
response
\ No newline at end of file
return
response
osdu_api/clients/schema/__init__.py
0 → 100644
View file @
e07ba497
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
osdu_api/clients/schema/schema_client.py
0 → 100644
View file @
e07ba497
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
json
from
typing
import
List
from
osdu_api.clients.base_client
import
BaseClient
from
osdu_api.model.http_method
import
HttpMethod
#from osdu_api.model.storage.schema.schema import Schema
#from osdu_api.model.storage.schema.schema_attribute import SchemaAttribute
class
SchemaClient
(
BaseClient
):
"""
Holds the logic for interfacing with Schema API
"""
def
get_schema_by_id
(
self
,
schema_id
:
str
,
bearer_token
=
None
):
return
self
.
make_request
(
method
=
HttpMethod
.
GET
,
url
=
'{}/{}/{}'
.
format
(
self
.
schema_url
,
'schema'
,
schema_id
),
data
=
{},
bearer_token
=
bearer_token
)
osdu_api/examples/osdu_api.ini
View file @
e07ba497
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[environment]
data_partition_id
=
opendes
storage_url
=
%(BASE_URL)s/api/storage/v2
search_url
=
%(BASE_URL)s/api/search/v2
legal_url
=
%(BASE_URL)s/api/legal/v1
data_workflow_url
=
%(BASE_URL)s/api/data-workflow/v1
file_dms_url
=
%(BASE_URL)s/api/filedms/v2
dataset_url
=
%(BASE_URL)s/api/dataset-registry/v1
entitlements_url
=
%(BASE_URL)s/api/entitlements/v1
use_service_principal
=
False
[provider]
name
=
aws
service_principal_module_name
=
service_principal_util
token_url_ssm_path
=
/osdu/%(ENVIRONMENT)s/oauth-token-uri
aws_oauth_custom_scope_ssm_path
=
/osdu/%(ENVIRONMENT)s/oauth-custom-scope
client_id_ssm_path
=
/osdu/%(ENVIRONMENT)s/client-credentials-client-id
client_secret_name
=
/osdu/%(ENVIRONMENT)s/client_credentials_secret
client_secret_dict_key
=
client_credentials_client_secret
region_name
=
%(AWS_REGION)s
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[environment]
data_partition_id
=
opendes
storage_url
=
%(BASE_URL)s/api/storage/v2
search_url
=
%(BASE_URL)s/api/search/v2
legal_url
=
%(BASE_URL)s/api/legal/v1
data_workflow_url
=
%(BASE_URL)s/api/data-workflow/v1
file_dms_url
=
%(BASE_URL)s/api/filedms/v2
dataset_url
=
%(BASE_URL)s/api/dataset-registry/v1
entitlements_url
=
%(BASE_URL)s/api/entitlements/v1
schema_url
=
%(BASE_URL)s/api/schema-service/v1
use_service_principal
=
False
[provider]
name
=
aws
service_principal_module_name
=
service_principal_util
token_url_ssm_path
=
/osdu/%(ENVIRONMENT)s/oauth-token-uri
aws_oauth_custom_scope_ssm_path
=
/osdu/%(ENVIRONMENT)s/oauth-custom-scope
client_id_ssm_path
=
/osdu/%(ENVIRONMENT)s/client-credentials-client-id
client_secret_name
=
/osdu/%(ENVIRONMENT)s/client_credentials_secret
client_secret_dict_key
=
client_credentials_client_secret
region_name
=
%(AWS_REGION)s
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment