Commit 010cf57e authored by Luc Yriarte's avatar Luc Yriarte
Browse files

Merge branch 'slb-code-push' into 'master'

Slb code push #3 + common lib registry

See merge request !4
parents 30940864 76ec20f4
Pipeline #29106 passed with stages
in 45 seconds
default:
image: python:3.7-slim-buster
include:
- project: "osdu/platform/domain-data-mgmt-services/wellbore/lib/lib-registry"
file: "registry-setup.yml"
stages:
- test
- deploy
......@@ -23,6 +28,6 @@ deploylib:
- pip3 install -r requirements.txt
- pip3 install twine
- python3 setup.py sdist bdist_wheel
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=${CI_REGISTRY_USER} python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=${CI_REGISTRY_USER} python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${WDMS_LIB_REGISTRY}/packages/pypi dist/*
rules:
- if: $CI_COMMIT_BRANCH == 'master'
......@@ -922,6 +922,43 @@
"ancestry" : {
"description" : "Record ancestry information.",
"$ref" : "#/definitions/RecordAncestry"
},
"tags": {
"title": "Tag Dictionary",
"description": "A generic dictionary of string keys mapping to string value. Only strings are permitted as keys and values.",
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"NameOfKey": "String value"
}
},
"createTime": {
"description": "Timestamp of the time at which initial version of this OSDU resource object was created. Set by the System. The value is a combined date-time string in ISO-8601 given in UTC.",
"title": "Resource Object Creation DateTime",
"type": "string",
"format": "date-time",
"example": "2020-12-16T11:46:20.163Z"
},
"createUser": {
"title": "Resource Object Creation User Reference",
"description": "The user reference, which created the first version of this resource object. Set by the System.",
"type": "string",
"example": "some-user@some-company-cloud.com"
},
"modifyTime": {
"description": "Timestamp of the time at which this version of the OSDU resource object was created. Set by the System. The value is a combined date-time string in ISO-8601 given in UTC.",
"title": "Resource Object Version Creation DateTime",
"type": "string",
"format": "date-time",
"example": "2020-12-16T11:52:24.477Z"
},
"modifyUser": {
"title": "Resource Object Version Creation User Reference",
"description": "The user reference, which created this version of this resource object. Set by the System.",
"type": "string",
"example": "some-user@some-company-cloud.com"
}
},
"description" : "Storage record",
......
import asyncio
from pprint import pprint
from odes_storage import AsyncApis as StorageApi
from odes_storage import AuthApiClient as StorageClient
from odes_storage.models import (
CreateUpdateRecordsResponse,
DatastoreQueryResult,
Legal,
Record,
StorageAcl,
)
from odes_storage import AsyncApis as StorageApi, AuthApiClient as StorageClient
from odes_storage.models import CreateUpdateRecordsResponse, Legal, Record, StorageAcl
HOSTNAME = "https://os-storage-dot-opendes.appspot.com/api/storage"
TOKEN = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImY5ZDk3YjRjYWU5MGJjZDc2YWViMjAwMjZmNmI3NzBjYWMyMjE3ODMiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiI0ODk1NzIxMDc2OTUtb2FjajI0ZnRlNWExN3JtM2VsZ2lsaGJuNDljaWVnaG8uYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiI0ODk1NzIxMDc2OTUtb2FjajI0ZnRlNWExN3JtM2VsZ2lsaGJuNDljaWVnaG8uYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMDM0MzY5NjA1NjQ3Njk2ODQzMzUiLCJoZCI6Im9wZW5kZXMucDRkLmNsb3VkLnNsYi1kcy5jb20iLCJlbWFpbCI6ImNsYWxsZW1lbnRAb3BlbmRlcy5wNGQuY2xvdWQuc2xiLWRzLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhdF9oYXNoIjoiV1RBb1lVLTI5YTU3QmpOaV9IajNndyIsImlhdCI6MTU4NzU0MDI3NCwiZXhwIjoxNTg3NTQzODc0fQ.l3OljSD9N5FhNRbj8E8Gd3dyDj8Qi40r6W4e473tfTvGHzuE6QLpm5Yhp-l43HHHcOt_Gnbm-hEq6l9XXyx4yGAhna8Wp9vgz2HRlQDcXAB1WeYkBhzJ2PCu8QrT_cqahPzH8pqN8mNuTpEzJTVKZQJIm0Crs9DVz2XyIvCaUxX9lEqHKIzCVeRYjdoBKundRw4WKVXtrLd4ZX56fP9s06aUmHdrdN8BFmSn1JS2I8XNtPHarv_kKiItWbZIjWkjvM_OOCwx38oZUztTBq9W-uMh-nIT59PGj7e_RxtGUiEBlvkZroKvHg1wF1WcPOBQ5-EvW1oU19fjWkhyfbuQFQ"
......
......@@ -29,7 +29,9 @@ class _RecordsApi:
headers = {"data-partition-id": str(data_partition_id)}
body = jsonable_encoder(record)
#Warning this part is edited manually, keeping unset values breaks the storage service
#POST new data seems ok but when getting them storage 500 if for instance we push createTime with a null value
body = jsonable_encoder(record, exclude_unset=True)
return self.api_client.request(
type_=m.CreateUpdateRecordsResponse,
......
......@@ -11,6 +11,11 @@ Name | Type | Description | Notes
**meta** | **List[dict]** | | [optional]
**data** | [**dict(str, Any)**](Any.md) | Record payload represented as a list of key-value pairs. |
**ancestry** | [**RecordAncestry**](RecordAncestry.md) | | [optional]
**tags** | **dict(str, str)** | A generic dictionary of string keys mapping to string value. Only strings are permitted as keys and values. | [optional]
**create_time** | **datetime** | Timestamp of the time at which initial version of this OSDU resource object was created. Set by the System. The value is a combined date-time string in ISO-8601 given in UTC. | [optional]
**create_user** | **str** | The user reference, which created the first version of this resource object. Set by the System. | [optional]
**modify_time** | **datetime** | Timestamp of the time at which this version of the OSDU resource object was created. Set by the System. The value is a combined date-time string in ISO-8601 given in UTC. | [optional]
**modify_user** | **str** | The user reference, which created this version of this resource object. Set by the System. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
......
from datetime import datetime
from typing import Any # noqa
from typing import Dict, List, Optional
......@@ -30,9 +31,7 @@ class DatastoreQueryResult(BaseModel):
class Legal(BaseModel):
legaltags: "Optional[List[str]]" = Field(None, alias="legaltags")
other_relevant_data_countries: "Optional[List[str]]" = Field(
None, alias="otherRelevantDataCountries"
)
other_relevant_data_countries: "Optional[List[str]]" = Field(None, alias="otherRelevantDataCountries")
class MultiRecordIds(BaseModel):
......@@ -53,9 +52,7 @@ class MultiRecordRequest(BaseModel):
class MultiRecordResponse(BaseModel):
records: "Optional[List[str]]" = Field(None, alias="records")
not_found: "Optional[List[str]]" = Field(None, alias="notFound")
conversion_statuses: "Optional[List[ConversionStatus]]" = Field(
None, alias="conversionStatuses"
)
conversion_statuses: "Optional[List[ConversionStatus]]" = Field(None, alias="conversionStatuses")
class Record(BaseModel):
......@@ -67,6 +64,11 @@ class Record(BaseModel):
meta: "Optional[List[Dict[str, Any]]]" = Field(None, alias="meta")
data: "Dict[str, Any]" = Field(..., alias="data")
ancestry: "Optional[RecordAncestry]" = Field(None, alias="ancestry")
tags: "Optional[Dict[str, str]]" = Field(None, alias="tags")
create_time: "Optional[datetime]" = Field(None, alias="createTime")
create_user: "Optional[str]" = Field(None, alias="createUser")
modify_time: "Optional[datetime]" = Field(None, alias="modifyTime")
modify_user: "Optional[str]" = Field(None, alias="modifyUser")
class RecordAncestry(BaseModel):
......
......@@ -833,6 +833,43 @@ components:
type: object
ancestry:
$ref: "#/components/schemas/RecordAncestry"
tags:
title: Tag Dictionary
description: A generic dictionary of string keys mapping to string value. Only
strings are permitted as keys and values.
type: object
additionalProperties:
type: string
example:
NameOfKey: String value
createTime:
description: Timestamp of the time at which initial version of this OSDU
resource object was created. Set by the System. The value is a
combined date-time string in ISO-8601 given in UTC.
title: Resource Object Creation DateTime
type: string
format: date-time
example: 2020-12-16T11:46:20.163Z
createUser:
title: Resource Object Creation User Reference
description: The user reference, which created the first version of this
resource object. Set by the System.
type: string
example: some-user@some-company-cloud.com
modifyTime:
description: Timestamp of the time at which this version of the OSDU resource
object was created. Set by the System. The value is a combined
date-time string in ISO-8601 given in UTC.
title: Resource Object Version Creation DateTime
type: string
format: date-time
example: 2020-12-16T11:52:24.477Z
modifyUser:
title: Resource Object Version Creation User Reference
description: The user reference, which created this version of this resource
object. Set by the System.
type: string
example: some-user@some-company-cloud.com
description: Storage record
example:
- id: common:welldb:123456
......
......@@ -9,7 +9,7 @@ with open("README.md", "r") as fh:
long_description = fh.read()
NAME = "osdu-data-ecosystem-storage"
VERSION = "1.0.0"
VERSION = "1.1.0"
# To install the library, run the following
#
# python setup.py install
......
......@@ -28,6 +28,11 @@ valid_record = {
},
"data": {"msg": "hello world"},
"meta": [{"kind": "Unit", "persistableReference": "ref"}],
"tags": {'NameOfKey': 'String value', 'OtherKey': 'Other value'},
"createTime": "2021-02-11T17:01:23.214000+00:00",
"createUser": "me@slb.com",
"modifyTime": "2021-02-23T14:53:08.758000+00:00",
"modifyUser": "ze@slb.com"
}
invalid_record = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment