Skip to content
Merged
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
54 changes: 54 additions & 0 deletions examples/device42_to_infrahub/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: from-device42

source:
name: genericrestapi
settings:
url: "http://swaggerdemo.device42.com"
auth_method: "basic"
username: "guest"
password: "device42_rocks!"
api_endpoint: "/api/1.0"
response_key_pattern: "objects"

destination:
name: infrahub
settings:
url: "http://localhost:8000"

order: [
"BuiltinTag",
"OrganizationTenant",
"LocationSite",
]

schema_mapping:
# Builtin Tags (Device42 tags)
- name: BuiltinTag
mapping: tags
identifiers: ["name"]
fields:
- name: name
mapping: name

# Organizations (Customers in Device42)
- name: OrganizationTenant
mapping: customers
identifiers: ["name"]
fields:
- name: name
mapping: name
- name: description
mapping: notes

# Locations (Buildings in Device42)
- name: LocationSite
mapping: buildings
identifiers: ["name"]
fields:
- name: name
mapping: name
- name: tags
mapping: tags
reference: BuiltinTag

18 changes: 18 additions & 0 deletions examples/device42_to_infrahub/genericrestapi/sync_adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from infrahub_sync.adapters.genericrestapi import GenericrestapiAdapter

from .sync_models import (
BuiltinTag,
LocationSite,
OrganizationTenant,
)


# -------------------------------------------------------
# AUTO-GENERATED FILE, DO NOT MODIFY
# This file has been generated with the command `infrahub-sync generate`
# All modifications will be lost the next time you reexecute this command
# -------------------------------------------------------
class GenericrestapiSync(GenericrestapiAdapter):
BuiltinTag = BuiltinTag
LocationSite = LocationSite
OrganizationTenant = OrganizationTenant
42 changes: 42 additions & 0 deletions examples/device42_to_infrahub/genericrestapi/sync_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import annotations

from typing import Any

from infrahub_sync.adapters.genericrestapi import GenericrestapiModel


# -------------------------------------------------------
# AUTO-GENERATED FILE, DO NOT MODIFY
# This file has been generated with the command `infrahub-sync generate`
# All modifications will be lost the next time you reexecute this command
# -------------------------------------------------------
class BuiltinTag(GenericrestapiModel):
_modelname = "BuiltinTag"
_identifiers = ("name",)
_attributes = ()
name: str

local_id: str | None = None
local_data: Any | None = None


class LocationSite(GenericrestapiModel):
_modelname = "LocationSite"
_identifiers = ("name",)
_attributes = ("tags",)
name: str
tags: list[str] | None = []

local_id: str | None = None
local_data: Any | None = None


class OrganizationTenant(GenericrestapiModel):
_modelname = "OrganizationTenant"
_identifiers = ("name",)
_attributes = ("description",)
description: str | None = None
name: str

local_id: str | None = None
local_data: Any | None = None
18 changes: 18 additions & 0 deletions examples/device42_to_infrahub/infrahub/sync_adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from infrahub_sync.adapters.infrahub import InfrahubAdapter

from .sync_models import (
BuiltinTag,
LocationSite,
OrganizationTenant,
)


# -------------------------------------------------------
# AUTO-GENERATED FILE, DO NOT MODIFY
# This file has been generated with the command `infrahub-sync generate`
# All modifications will be lost the next time you reexecute this command
# -------------------------------------------------------
class InfrahubSync(InfrahubAdapter):
BuiltinTag = BuiltinTag
LocationSite = LocationSite
OrganizationTenant = OrganizationTenant
42 changes: 42 additions & 0 deletions examples/device42_to_infrahub/infrahub/sync_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import annotations

from typing import Any

from infrahub_sync.adapters.infrahub import InfrahubModel


# -------------------------------------------------------
# AUTO-GENERATED FILE, DO NOT MODIFY
# This file has been generated with the command `infrahub-sync generate`
# All modifications will be lost the next time you reexecute this command
# -------------------------------------------------------
class BuiltinTag(InfrahubModel):
_modelname = "BuiltinTag"
_identifiers = ("name",)
_attributes = ()
name: str

local_id: str | None = None
local_data: Any | None = None


class LocationSite(InfrahubModel):
_modelname = "LocationSite"
_identifiers = ("name",)
_attributes = ("tags",)
name: str
tags: list[str] | None = []

local_id: str | None = None
local_data: Any | None = None


class OrganizationTenant(InfrahubModel):
_modelname = "OrganizationTenant"
_identifiers = ("name",)
_attributes = ("description",)
description: str | None = None
name: str

local_id: str | None = None
local_data: Any | None = None
28 changes: 0 additions & 28 deletions examples/peeringdb_to_infrahub/genenericrestapi/sync_adapter.py

This file was deleted.

141 changes: 0 additions & 141 deletions examples/peeringdb_to_infrahub/genenericrestapi/sync_models.py

This file was deleted.

28 changes: 0 additions & 28 deletions examples/peeringdb_to_infrahub/generic_rest_api/sync_adapter.py

This file was deleted.

Loading