Skip to content

Commit

Permalink
Add and publish Python SDK (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschepis authored May 28, 2024
1 parent d34c864 commit 95b1e9e
Show file tree
Hide file tree
Showing 49 changed files with 17,561 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNETVERSION }}
# - if: matrix.language == 'python'
# name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: ${{ env.PYTHONVERSION }}
- if: matrix.language == 'python'
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHONVERSION }}
- if: matrix.language == 'java'
name: Setup Java
uses: actions/setup-java@v4
Expand All @@ -136,8 +136,8 @@ jobs:
- nodejs
- dotnet
- java
- python
# - go
# - python

# - name: Download provider + tfgen binaries
# uses: actions/download-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

## Unreleased

- Create and publish Python SDK

9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ development: install_plugins provider build_sdks install_sdks

build: install_plugins provider build_sdks install_sdks

# TODO: get python and go SDKs building
# TODO: get go SDK building
# build_sdks: build_nodejs build_python build_go build_dotnet build_java
build_sdks: build_nodejs build_dotnet build_java
build_sdks: build_nodejs build_python build_dotnet build_java

install_go_sdk:

Expand Down Expand Up @@ -64,14 +64,15 @@ build_nodejs:
build_python: PYPI_VERSION := $(shell pulumictl get version --language python)
build_python: export PULUMI_HOME := $(WORKING_DIR)/.pulumi
build_python: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)
#build_python: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache
build_python: export PULUMI_CONVERT_EXAMPLES_CACHE_DIR := $(WORKING_DIR)/.pulumi/examples-cache
build_python:
rm -rf sdk/python/
PULUMI_CONVERT=$(PULUMI_CONVERT) PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) python --out sdk/python/
cd sdk/python/ && \
printf "module fake_python_module // Exclude this directory from Go tools\n\ngo 1.21\n" > go.mod && \
cp ../../README.md . && \
rm -rf ./bin/ ../python.bin/ && cp -R . ../python.bin && mv ../python.bin ./bin && \
cp ../../pyproject.toml ./bin/ && \
sed -i.bak -e 's/^ version = .*/ version = "$(PYPI_VERSION)"/g' ./bin/pyproject.toml && \
rm ./bin/pyproject.toml.bak && rm ./bin/go.mod && \
python3 -m venv venv && \
Expand Down Expand Up @@ -142,4 +143,4 @@ bin/pulumi-java-gen:
@cd provider && go list -f "{{slice .Version 1}}" -m github.com/pulumi/pulumi/pkg/v3 | tee ../$@

# .PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen test_provider
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_go build_nodejs clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen test_provider
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen test_provider
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[project]
name = "pulumi_chronosphere"
description = "A Pulumi package for creating and managing Chronosphere resources."
dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"]
keywords = ["pulumi", "chronosphere"]
readme = "README.md"
requires-python = ">=3.8"
version = "0.0.0"
[project.license]
text = "Apache-2.0"
[project.urls]
Homepage = "https://chronosphere.io"
Repository = "https://github.com/chronosphereio/pulumi-chronosphere"

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool]
[tool.setuptools]
[tool.setuptools.package-data]
pulumi_chronosphere = ["py.typed", "pulumi-plugin.json"]
Empty file added sdk/python/Pulumi.yaml
Empty file.
9 changes: 9 additions & 0 deletions sdk/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A Pulumi Resource Provider for Chronosphere

The Chronosphere Pulumi Provider allows [Pulumi](https://www.pulumi.com/) to manage supported [Chronosphere resources](https://docs.chronosphere.io/administer).

- [Documentation](https://docs.chronosphere.io/administer)

## Contact support

[Contact Chronosphere support](https://docs.chronosphere.io/support/contact-support) to ask questions, report bugs, or suggest feature requests.
4 changes: 4 additions & 0 deletions sdk/python/chronosphereio_chronosphere/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> This provider is a derived work of the [Terraform Provider](https://github.com/chronosphereio/terraform-provider-chronosphere)
> distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,
> first check the [`pulumi-chronosphere` repo](https://github.com/chronosphereio/pulumi-chronosphere/issues); however, if that doesn't turn up anything,
> please consult the source [`terraform-provider-chronosphere` repo](https://github.com/chronosphereio/terraform-provider-chronosphere/issues).
280 changes: 280 additions & 0 deletions sdk/python/chronosphereio_chronosphere/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

from . import _utilities
import typing
# Export this package's modules as members:
from .blackhole_alert_notifier import *
from .bucket import *
from .bucket_data_source import *
from .classic_dashboard import *
from .collection import *
from .dashboard import *
from .derived_label import *
from .derived_metric import *
from .drop_rule import *
from .email_alert_notifier import *
from .gcp_metrics_integration import *
from .grafana_dashboard import *
from .mapping_rule import *
from .monitor import *
from .notification_policy import *
from .notification_policy_data_source import *
from .opsgenie_alert_notifier import *
from .pagerduty_alert_notifier import *
from .provider import *
from .recording_rule import *
from .resource_pools_config import *
from .rollup_rule import *
from .service_account import *
from .service_data_source import *
from .slack_alert_notifier import *
from .team import *
from .trace_jaeger_remote_sampling_strategy import *
from .trace_metrics_rule import *
from .trace_tail_sampling_rules import *
from .victorops_alert_notifier import *
from .webhook_alert_notifier import *
from ._inputs import *
from . import outputs

# Make subpackages available:
if typing.TYPE_CHECKING:
import chronosphereio_chronosphere.config as __config
config = __config
else:
config = _utilities.lazy_import('chronosphereio_chronosphere.config')

_utilities.register(
resource_modules="""
[
{
"pkg": "chronosphere",
"mod": "index/blackholeAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/blackholeAlertNotifier:BlackholeAlertNotifier": "BlackholeAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/bucket",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/bucket:Bucket": "Bucket"
}
},
{
"pkg": "chronosphere",
"mod": "index/classicDashboard",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/classicDashboard:ClassicDashboard": "ClassicDashboard"
}
},
{
"pkg": "chronosphere",
"mod": "index/collection",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/collection:Collection": "Collection"
}
},
{
"pkg": "chronosphere",
"mod": "index/dashboard",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/dashboard:Dashboard": "Dashboard"
}
},
{
"pkg": "chronosphere",
"mod": "index/derivedLabel",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/derivedLabel:DerivedLabel": "DerivedLabel"
}
},
{
"pkg": "chronosphere",
"mod": "index/derivedMetric",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/derivedMetric:DerivedMetric": "DerivedMetric"
}
},
{
"pkg": "chronosphere",
"mod": "index/dropRule",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/dropRule:DropRule": "DropRule"
}
},
{
"pkg": "chronosphere",
"mod": "index/emailAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/emailAlertNotifier:EmailAlertNotifier": "EmailAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/gcpMetricsIntegration",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/gcpMetricsIntegration:GcpMetricsIntegration": "GcpMetricsIntegration"
}
},
{
"pkg": "chronosphere",
"mod": "index/grafanaDashboard",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/grafanaDashboard:GrafanaDashboard": "GrafanaDashboard"
}
},
{
"pkg": "chronosphere",
"mod": "index/mappingRule",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/mappingRule:MappingRule": "MappingRule"
}
},
{
"pkg": "chronosphere",
"mod": "index/monitor",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/monitor:Monitor": "Monitor"
}
},
{
"pkg": "chronosphere",
"mod": "index/notificationPolicy",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/notificationPolicy:NotificationPolicy": "NotificationPolicy"
}
},
{
"pkg": "chronosphere",
"mod": "index/opsgenieAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/opsgenieAlertNotifier:OpsgenieAlertNotifier": "OpsgenieAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/pagerdutyAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/pagerdutyAlertNotifier:PagerdutyAlertNotifier": "PagerdutyAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/recordingRule",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/recordingRule:RecordingRule": "RecordingRule"
}
},
{
"pkg": "chronosphere",
"mod": "index/resourcePoolsConfig",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/resourcePoolsConfig:ResourcePoolsConfig": "ResourcePoolsConfig"
}
},
{
"pkg": "chronosphere",
"mod": "index/rollupRule",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/rollupRule:RollupRule": "RollupRule"
}
},
{
"pkg": "chronosphere",
"mod": "index/serviceAccount",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/serviceAccount:ServiceAccount": "ServiceAccount"
}
},
{
"pkg": "chronosphere",
"mod": "index/slackAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/slackAlertNotifier:SlackAlertNotifier": "SlackAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/team",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/team:Team": "Team"
}
},
{
"pkg": "chronosphere",
"mod": "index/traceJaegerRemoteSamplingStrategy",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/traceJaegerRemoteSamplingStrategy:TraceJaegerRemoteSamplingStrategy": "TraceJaegerRemoteSamplingStrategy"
}
},
{
"pkg": "chronosphere",
"mod": "index/traceMetricsRule",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/traceMetricsRule:TraceMetricsRule": "TraceMetricsRule"
}
},
{
"pkg": "chronosphere",
"mod": "index/traceTailSamplingRules",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/traceTailSamplingRules:TraceTailSamplingRules": "TraceTailSamplingRules"
}
},
{
"pkg": "chronosphere",
"mod": "index/victoropsAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/victoropsAlertNotifier:VictoropsAlertNotifier": "VictoropsAlertNotifier"
}
},
{
"pkg": "chronosphere",
"mod": "index/webhookAlertNotifier",
"fqn": "chronosphereio_chronosphere",
"classes": {
"chronosphere:index/webhookAlertNotifier:WebhookAlertNotifier": "WebhookAlertNotifier"
}
}
]
""",
resource_packages="""
[
{
"pkg": "chronosphere",
"token": "pulumi:providers:chronosphere",
"fqn": "chronosphereio_chronosphere",
"class": "Provider"
}
]
"""
)
Loading

0 comments on commit 95b1e9e

Please sign in to comment.