Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions blueprints-provider/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 0.1.0
- Init
22 changes: 22 additions & 0 deletions blueprints-provider/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Frinx Blueprints Provider Api in Python


Blueprints Provider Graphql Schema transformed to Pydantic basemodel.
This package has been tested with Python 3.10.


## Getting started

```python

```
### Prerequisites

- Python 3.10+ is required to use this package.
- Usage with grapqhl-pydantic-generator

### Install the package

```bash
poetry add git+https://github.com/FRINXio/frinx-services-python-api.git@main#subdirectory=blueprint-provider/python
```
Empty file.
Empty file.
275 changes: 275 additions & 0 deletions blueprints-provider/python/frinx_api/blueprints_provider/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
# generated by datamodel-codegen:
# filename: <stdin>
# timestamp: 2024-12-02T13:18:37+00:00

from __future__ import annotations

from enum import Enum
from typing import Literal
from typing import Optional
from typing import TypeAlias

from pydantic import BaseModel
from pydantic import Field

Boolean: TypeAlias = bool
"""
The `Boolean` scalar type represents `true` or `false`.
"""


DateTime: TypeAlias = str
"""
A type representing a formatted java.time.LocalDateTime (UTC).
"""


ID: TypeAlias = str
"""
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
"""


Int: TypeAlias = int
"""
The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
"""


JSON: TypeAlias = str
"""
A type representing a JSON type (JSON).
"""


String: TypeAlias = str
"""
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
"""


class BlueprintType(Enum):
"""
Specifies the type of blueprint.
"""

install = 'INSTALL'
performance = 'PERFORMANCE'
stream = 'STREAM'
topology_lldp = 'TOPOLOGY_LLDP'
topology_mpls = 'TOPOLOGY_MPLS'
topology_ptp = 'TOPOLOGY_PTP'
topology_synce = 'TOPOLOGY_SYNCE'


class ConnectionType(Enum):
"""
Management protocol used for creation of connection to the device.
"""

cli = 'CLI'
gnmi = 'GNMI'
netconf = 'NETCONF'
snmp = 'SNMP'


class Connection(BaseModel):
"""
Represents a connection in a graph.
"""

edges: list[Edge] = Field(
..., description='List of edges within the blueprint connection.'
)
page_info: PageInfo = Field(
...,
alias='pageInfo',
description='Pagination information for the blueprint connection.',
)
typename__: Optional[Literal['Connection']] = Field(
'Connection', alias='__typename'
)


class Edge(BaseModel):
"""
Represents an edge in the graph.
"""

cursor: Optional[String] = Field(None, description='Cursor for pagination.')
node: Node = Field(..., description='Node associated with the edge.')
typename__: Optional[Literal['Edge']] = Field('Edge', alias='__typename')


class BlueprintConnection(Connection):
"""
Represents a connection in the blueprint graph.
"""

edges: list[BlueprintEdge] = Field(
..., description='List of edges within the blueprint connection.'
) # type: ignore[assignment]
page_info: PageInfo = Field(
...,
alias='pageInfo',
description='Pagination information for the blueprint connection.',
)
typename__: Optional[Literal['BlueprintConnection']] = Field(
'BlueprintConnection', alias='__typename'
) # type: ignore[assignment]


class BlueprintEdge(Edge):
"""
Represents an edge in the blueprint graph.
"""

cursor: Optional[String] = Field(None, description='Cursor for pagination.')
node: BlueprintNode = Field(
..., description='Node associated with the blueprint edge.'
)
typename__: Optional[Literal['BlueprintEdge']] = Field(
'BlueprintEdge', alias='__typename'
) # type: ignore[assignment]


class BlueprintMetadata(BaseModel):
"""
Metadata associated with a blueprint.
"""

created_at: DateTime = Field(
..., alias='createdAt', description='Timestamp of the blueprint creation (UTC).'
)
updated_at: DateTime = Field(
...,
alias='updatedAt',
description='Timestamp of the last blueprint update (UTC).\nIf the blueprint was not updated, the value is equal to the creation timestamp.\nRemoving the blueprint is considered as an update.',
)
typename__: Optional[Literal['BlueprintMetadata']] = Field(
'BlueprintMetadata', alias='__typename'
)


class BlueprintNode(BaseModel):
"""
Information about the blueprint - identifier, patterns used for matching the device, and the template content.
"""

blueprint_type: BlueprintType = Field(
..., alias='blueprintType', description='Specifies the type of blueprint.'
)
connection_type: ConnectionType = Field(
...,
alias='connectionType',
description='Management protocol used for creation of connection to the device.',
)
model_pattern: Optional[String] = Field(
None,
alias='modelPattern',
description="Regular expression pattern for matching the model of the device (for example, 'vsr .+'",
)
name: String = Field(
..., description='Unique human-readable name of the blueprint.'
)
template: String = Field(
...,
description='Settings associated with the blueprint in JSON format (e.g. installation parameters or stream parameters).',
)
vendor_pattern: Optional[String] = Field(
None,
alias='vendorPattern',
description="Regular expression pattern for matching the vendor of the device (for example, '.*wrt').",
)
version_pattern: Optional[String] = Field(
None,
alias='versionPattern',
description="Regular expression pattern for matching the version of the device (for example, 'v[0-9]+').",
)
typename__: Optional[Literal['BlueprintNode']] = Field(
'BlueprintNode', alias='__typename'
)


class BlueprintOutput(BaseModel):
"""
Information about the persisted blueprint - generated identifier, blueprint content, and metadata.
"""

id: ID = Field(
...,
description="Unique identifier of the blueprint in the format 'blueprint/[id]', where [id] is represented by automatically generated database identifier.",
)
metadata: BlueprintMetadata = Field(
...,
description='Metadata associated with the blueprint - creation and update timestamps.',
)
node: BlueprintNode = Field(
...,
description='Blueprint content - name, connection type, template, and patterns.',
)
typename__: Optional[Literal['BlueprintOutput']] = Field(
'BlueprintOutput', alias='__typename'
)


class PageInfo(BaseModel):
"""
Contains pagination information for a connection. Indicates if there are more pages and the position of the last fetched item.
"""

end_cursor: Optional[String] = Field(
None,
alias='endCursor',
description='The cursor for the last item in the current page of results. Use this cursor to fetch the next set of items.',
)
has_next_page: Boolean = Field(
...,
alias='hasNextPage',
description='Indicates whether there is a next page of items available after the current one.',
)
typename__: Optional[Literal['PageInfo']] = Field('PageInfo', alias='__typename')


class BlueprintNodeInput(BaseModel):
"""
Information about the blueprint - identifier, patterns used for matching the device, and the template content.
"""

blueprint_type: BlueprintType = Field(
..., alias='blueprintType', description='Specifies the type of blueprint.'
)
connection_type: ConnectionType = Field(
...,
alias='connectionType',
description='Management protocol used for creation of connection to the device.',
)
model_pattern: Optional[String] = Field(
None,
alias='modelPattern',
description="Regular expression pattern for matching the model of the device (for example, 'vsr .+'",
)
name: String = Field(
..., description='Unique human-readable name of the blueprint.'
)
template: String = Field(
...,
description='Settings associated with the blueprint in JSON format (e.g. installation parameters or stream parameters).',
)
vendor_pattern: Optional[String] = Field(
None,
alias='vendorPattern',
description="Regular expression pattern for matching the vendor of the device (for example, '.*wrt').",
)
version_pattern: Optional[String] = Field(
None,
alias='versionPattern',
description="Regular expression pattern for matching the version of the device (for example, 'v[0-9]+').",
)
typename__: Optional[Literal['BlueprintNodeInput']] = Field(
'BlueprintNodeInput', alias='__typename'
)


# Represents a node in a graph.
Node: TypeAlias = BlueprintNode
Loading