Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
doosuu committed Aug 25, 2023
1 parent 80acec8 commit 221c0a7
Showing 1 changed file with 297 additions and 0 deletions.
297 changes: 297 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
<a id="velocitas_lib"></a>

# velocitas\_lib

<a id="velocitas_lib.require_env"></a>

#### require\_env

```python
def require_env(name: str) -> str
```

Require and return an environment variable.

**Arguments**:

- `name` _str_ - The name of the variable.


**Raises**:

- `ValueError` - In case the environment variable is not set.


**Returns**:

- `str` - The value of the variable.

<a id="velocitas_lib.get_workspace_dir"></a>

#### get\_workspace\_dir

```python
def get_workspace_dir() -> str
```

Return the workspace directory.

<a id="velocitas_lib.get_script_path"></a>

#### get\_script\_path

```python
def get_script_path() -> str
```

Return the absolute path to the directory the invoked Python script
is located in.

<a id="velocitas_lib.get_package_path"></a>

#### get\_package\_path

```python
def get_package_path() -> str
```

Return the absolute path to the package directory the invoked Python
script belongs to.

<a id="velocitas_lib.get_cache_data"></a>

#### get\_cache\_data

```python
def get_cache_data() -> Dict[str, Any]
```

Return the data of the cache as Python object.

<a id="velocitas_lib.get_log_file_name"></a>

#### get\_log\_file\_name

```python
def get_log_file_name(service_id: str, runtime_id: str) -> str
```

Build the log file name for the given service and runtime.

**Arguments**:

- `service_id` _str_ - The ID of the service to log.
- `runtime_id` _str_ - The ID of the runtime to log.


**Returns**:

- `str` - The log file name.

<a id="velocitas_lib.create_log_file"></a>

#### create\_log\_file

```python
def create_log_file(service_id: str, runtime_id: str) -> TextIOWrapper
```

Create a log file for the given service and runtime.

**Arguments**:

- `service_id` _str_ - The ID of the service to log.
- `runtime_id` _str_ - The ID of the runtime to log.


**Returns**:

- `TextIOWrapper` - The log file.

<a id="velocitas_lib.services"></a>

# velocitas\_lib.services

<a id="velocitas_lib.services.parse_service_config"></a>

#### parse\_service\_config

```python
def parse_service_config(service_id: str,
service_spec_config: Dict) -> ServiceSpecConfig
```

Parse service spec configuration and return it as an named tuple.

**Arguments**:

- `service_id` - The ID of the service to be parsed.
- `service_spec_config` - The specificon of the services from config file.

<a id="velocitas_lib.services.get_services"></a>

#### get\_services

```python
def get_services(verbose: bool = True) -> List[Service]
```

Return all specified services as Python object.

<a id="velocitas_lib.services.get_specific_service"></a>

#### get\_specific\_service

```python
def get_specific_service(service_id: str) -> Service
```

Return the specified service as Python object.

**Arguments**:

- `service_id` - The ID of the service to be parsed.

<a id="velocitas_lib.services.get_service_port"></a>

#### get\_service\_port

```python
def get_service_port(service_id: str) -> str
```

Return the service port as string for the specified service.

**Arguments**:

- `service_id` - The ID of the service to be parsed.

<a id="velocitas_lib.variables"></a>

# velocitas\_lib.variables

<a id="velocitas_lib.variables.json_obj_to_flat_map"></a>

#### json\_obj\_to\_flat\_map

```python
def json_obj_to_flat_map(obj,
prefix: str = "",
separator: str = ".") -> Dict[str, str]
```

Flatten a JSON Object into a one dimensional dict by joining the keys
with the specified separator.

<a id="velocitas_lib.variables.ProjectVariables"></a>

## ProjectVariables Objects

```python
class ProjectVariables()
```

<a id="velocitas_lib.variables.ProjectVariables.replace_occurrences"></a>

#### replace\_occurrences

```python
def replace_occurrences(input_str: str) -> str
```

Replace all occurrences of the defined variables in the input string

<a id="velocitas_lib.docker"></a>

# velocitas\_lib.docker

<a id="velocitas_lib.docker.build_vehicleapp_image"></a>

#### build\_vehicleapp\_image

```python
def build_vehicleapp_image(log_output: TextIOWrapper
| int = subprocess.DEVNULL)
```

Build VehicleApp docker image and display the progress using a spinner.

**Arguments**:

- `log_output` _TextIOWrapper | int_ - Logfile to write or DEVNULL by default.

<a id="velocitas_lib.docker.is_docker_image_build_locally"></a>

#### is\_docker\_image\_build\_locally

```python
def is_docker_image_build_locally(app_name: str) -> bool
```

Check if vehicle app docker image is locally available

**Arguments**:

- `app_name` _str_ - App name to check for

<a id="velocitas_lib.docker.push_docker_image_to_registry"></a>

#### push\_docker\_image\_to\_registry

```python
def push_docker_image_to_registry(app_name: str,
log_output: TextIOWrapper
| int = subprocess.DEVNULL)
```

Push docker image to local image registry

**Arguments**:

- `app_name` _str_ - App name to push to registry
- `log_output` _TextIOWrapper | int_ - Logfile to write or DEVNULL by default.

<a id="velocitas_lib.docker.container_exists"></a>

#### container\_exists

```python
def container_exists(
name: str,
log_output: TextIOWrapper | int = subprocess.DEVNULL) -> bool
```

Check if a container with a given name exists.

**Arguments**:

- `log_output` _TextIOWrapper | int_ - Logfile to write or DEVNULL by default.


**Returns**:

- `bool` - True if the container exists, False if not.

<a id="velocitas_lib.middleware"></a>

# velocitas\_lib.middleware

<a id="velocitas_lib.middleware.MiddlewareType"></a>

## MiddlewareType Objects

```python
class MiddlewareType(Enum)
```

Enumeration containing all possible middleware types.

<a id="velocitas_lib.middleware.get_middleware_type"></a>

#### get\_middleware\_type

```python
def get_middleware_type() -> MiddlewareType
```

Return the current middleware type.

0 comments on commit 221c0a7

Please sign in to comment.