Skip to main content

TBD

Project description

CSP Billing Adapter Microsoft Plugin

This is a plugin for csp-billing-adapter that provides CSP hook implementations. This includes the hooks defined in the csp_hookspecs.py module.

Meter billing

The meter_billing function accepts a dictionary mapping of dimension name to usage quantity. This information is used to bill the customer for the product ID that is configured in the adapter. If there is an exception with metered billing the exception is raised.

Get CSP Name

The get_csp_name function returns the name of the CSP provider. In this case it is microsoft.

Get Account Info

The get_account_info function provides metadata information for the running instance or container. The structure of this information is as follows:

{
    "compute": {
        "azEnvironment": "AzurePublicCloud",
        "customData": "",
        "isHostCompatibilityLayerVm": "false",
        "licenseType": "",
        "location": "eastus",
        "name": "csp-adapter-test",
        "offer": "sles-15-sp4-byos",
        "osProfile": {
            "adminUsername": "foo",
            "computerName": "csp-adapter-test"
        },
        "osType": "Linux",
        "placementGroupId": "",
        "plan": {
            "name": "",
            "product": "",
            "publisher": ""
        },
        "platformFaultDomain": "0",
        "platformUpdateDomain": "0",
        "provider": "Microsoft.Compute",
        "publicKeys": [
            {
                "keyData": ssh_public_key,
                "path": "/home/foo/.ssh/authorized_keys"
            }
        ],
        "publisher": "suse",
        "resourceGroupName": "foo",
        "resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/foo/providers/Microsoft.Compute/virtualMachines/csp-adapter-test",
        "securityProfile": {
            "secureBootEnabled": "false",
            "virtualTpmEnabled": "false"
        },
        "sku": "gen2",
        "storageProfile": {
            "dataDisks": [],
            "imageReference": {
                "id": "",
                "offer": "sles-15-sp4-byos",
                "publisher": "suse",
                "sku": "gen2",
                "version": "2023.05.06"
            },
            "osDisk": {
                "caching": "ReadWrite",
                "createOption": "FromImage",
                "diffDiskSettings": {
                    "option": ""
                },
                "diskSizeGB": "30",
                "encryptionSettings": {
                    "enabled": "false"
                },
                "image": {
                    "uri": ""
                },
                "managedDisk": {
                    "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/foo/providers/Microsoft.Compute/disks/csp-adapter-test_Os_Disk_1_12345678901234567890",
                    "storageAccountType": "Premium_LRS"
                },
                "name": "csp-adapter-test_Os_Disk_1_12345678901234567890",
                "osType": "Linux",
                "vhd": {
                    "uri": ""
                },
                "writeAcceleratorEnabled": "false"
            }
        },
        "subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "tags": "Cost Center:123456789;Department:foo;Environment:foo;Finance Business Partner:foo;General Ledger Code:123456789;Group:foo;Owner:foo;Stakeholder:foo",
        "tagsList": [
            {
                "name": "Cost Center",
                "value": "12345678"
            },
            {
                "name": "Department",
                "value": "foo"
            },
            {
                "name": "Environment",
                "value": "foo"
            },
            {
                "name": "Finance Business Partner",
                "value": "foo"
            },
            {
                "name": "General Ledger Code",
                "value": "123456789"
            },
            {
                "name": "Group",
                "value": "foo"
            },
            {
                "name": "Owner",
                "value": "foo"
            },
            {
                "name": "Stakeholder",
                "value": "foo"
            }
        ],
        "version": "2023.05.06",
        "vmId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "vmScaleSetName": "",
        "vmSize": "Standard_B2s",
        "zone": ""
    },
    "network": {
        "interface": [
            {
                "ipv4": {
                    "ipAddress": [
                        {
                            "privateIpAddress": "10.0.0.8",
                            "publicIpAddress": "192.168.1.1"
                        }
                    ],
                    "subnet": [
                        {
                            "address": "10.0.0.0",
                            "prefix": "24"
                        }
                    ]
                },
                "ipv6": {
                    "ipAddress": []
                },
                "macAddress": "123456789ABCD"
            }
        ]
    },
    "attestedData": {
        "encoding": "pkcs7",
        "signature": signature
    },
    "cloud_provider": "microsoft"
}

This information is pulled from the Azure Instance metadata endpoint: http://169.254.169.254/metadata/instance?api-version=2021-02-01. Note: the exact information in the document entry may vary.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csp_billing_adapter_microsoft-1.3.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csp_billing_adapter_microsoft-1.3.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file csp_billing_adapter_microsoft-1.3.1.tar.gz.

File metadata

File hashes

Hashes for csp_billing_adapter_microsoft-1.3.1.tar.gz
Algorithm Hash digest
SHA256 2ded3903f1ab1778025a4fdc5cdf6bfcdb402ca149d1649f2fa2f78f15ef2de0
MD5 8d00e0d400575d84504acdc7a8e9acfe
BLAKE2b-256 2927b7836a4e24b59fb193e9cb3f57c6dfe5d6fc89cb8076c1be6b62f6f8099a

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp_billing_adapter_microsoft-1.3.1.tar.gz:

Publisher: pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-microsoft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp_billing_adapter_microsoft-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for csp_billing_adapter_microsoft-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61ea73986aab2edfa354187626e073e0cb0b97073c94cb25f45ddc223dd62dfd
MD5 85a0ff126ad57450ad808963fec12e5f
BLAKE2b-256 2fc6d12b4760626cba97489d7768cd596ab5e480d31028dcfdb65cc259647248

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp_billing_adapter_microsoft-1.3.1-py3-none-any.whl:

Publisher: pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-microsoft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page