Giter Club home page Giter Club logo

Comments (6)

bsquizz avatar bsquizz commented on July 21, 2024

Based on my research, there's no reliable way to discover the storage endpoint suffix or key vault suffix, so we will still need to require the admin to manually specify those values.

We could do a "blend" of trying to discover, and falling back to requiring the values to be manually specified if they can't be determined.

A possible way to discover these is by looking at storage account info via ARM at /subscriptions/<subscription ID>/resourceGroups/<resource group name>/providers/Microsoft.Storage/storageaccounts and looking a the URL suffixes of primaryEndpoints. However if there's no storage accounts, this obviously won't work :)

Same goes for Key Vaults, which could be listed at /subscriptions/<subscription ID>/resourceGroups/<resource group name>/providers/Microsoft.KeyVault/vaults and looking at the suffix of the vaultUri.

Example storage acct JSON:

{
    "sku": {
        "name": "Standard_LRS",
        "tier": "Standard"
    },
    "kind": "Storage",
    "id": "/subscriptions/ca3444ad-9e61-4360-85f6-fc71368a73e4/resourcegroups/resourcegroup/providers/Microsoft.Storage/storageaccounts/storageacct",
    "type": "Microsoft.Storage/storageaccounts",
    "name": "storageacct",
    "location": "westus",
    "properties": {
        "provisioningState": "Succeeded",
        "primaryEndpoints": {
            "blob": "https://storageacct.blob.westus.stackpoc.com/",
            "queue": "https://storageacct.queue.westus.stackpoc.com/",
            "table": "https://storageacct.table.westus.stackpoc.com/"
        },
        "primaryLocation": "westus",
        "statusOfPrimary": "Available",
        "encryption": {
            "services": {
                "blob": {
                    "enabled": true,
                    "lastEnabledTime": "2018-03-29T14:53:30.9400000"
                }
            },
            "keySource": "Microsoft.Storage"
        },
        "creationTime": "2018-03-29T14:53:30.9400000"
    }
}

Example Vault JSON:

{
    "id": "/subscriptions/ca3444ad-9e61-4360-85f6-fc71368a73e4/resourceGroups/resourcegroup/providers/Microsoft.KeyVault/vaults/vault",
    "name": "vault",
    "type": "Microsoft.KeyVault/vaults",
    "location": "westus",
    "tags": {},
    "properties": {
        "sku": {
            "family": "A",
            "name": "Standard"
        },
        "tenantId": "a3f33ab9-6362-4609-b44d-a669107ebd9d",
        "accessPolicies": [
            {
                "tenantId": "a3f33ab9-6362-4609-b44d-a669107ebd9d",
                "objectId": "7ad1f39b-75d9-48ba-9ff7-7158c6a4b9b3",
                "permissions": {
                    "keys": [
                        "Get",
                        "List",
                        "Update",
                        "Create",
                        "Import",
                        "Delete",
                        "Recover",
                        "Backup",
                        "Restore"
                    ],
                    "secrets": [
                        "Get",
                        "List",
                        "Set",
                        "Delete",
                        "Recover",
                        "Backup",
                        "Restore"
                    ],
                    "certificates": [
                        "Get",
                        "List",
                        "Update",
                        "Create",
                        "Import",
                        "Delete",
                        "Recover",
                        "ManageContacts",
                        "ManageIssuers",
                        "GetIssuers",
                        "ListIssuers",
                        "SetIssuers",
                        "DeleteIssuers"
                    ]
                }
            }
        ],
        "enabledForDeployment": false,
        "enabledForDiskEncryption": false,
        "enabledForTemplateDeployment": false,
        "vaultUri": "https://vault.vault.westus.stackpoc.com/"
    }
}

from azure-armrest.

bsquizz avatar bsquizz commented on July 21, 2024

We can discover supported API versions/API profiles using ARM as well, using /providers/<provider type>, for example, here's a snip of the JSON for /providers/Microsoft.Network:

{
    "namespace": "Microsoft.Network",
    "resourceTypes": [
        {
            "resourceType": "connections",
            "locations": [
                "westus"
            ],
            "apiVersions": [
                "2015-06-15",
                "2015-05-01-preview"
            ],
            "apiProfiles": [
                {
                    "profileVersion": "2017-03-09-profile",
                    "apiVersion": "2015-06-15"
                }
            ]
        },
        {
            "resourceType": "loadBalancers",
            "locations": [
                "westus"
            ],
            "apiVersions": [
                "2015-06-15",
                "2015-05-01-preview"
            ],
            "apiProfiles": [
                {
                    "profileVersion": "2017-03-09-profile",
                    "apiVersion": "2015-06-15"
                }
            ]
        },

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

@bsquizz The library will automatically determine the latest api-version for each service. For manageiq, we'll need to decide on the semantics. At the moment it looks like this:

:ems:
  :ems_azure:
    :api_versions:
      :availability_set: "2017-12-01"
      :ip_address: "2017-11-01"

As I mentioned on the call, I'm thinking we change it to something like this:

:ems:
  :ems_azure:
    :default
      :api_versions:
        :availability_set: "2017-12-01"
        :ip_address: "2017-11-01"
    :your_provider
        :availability_set: "2016-11-30" # or whatever
        :ip_address: "2016-07-30" # ditto

If the provider name matches a config entry, we use those api-version strings. Otherwise we use the default settings.

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

@bsquizz Let's take the discussion on how to handle this over at the Azure provider repo. For now, as long as the gem has the ability to autodiscover, we can close this issue.

Once the PR is merged, I can push out a new version of the gem, and update the gemspec, and we can start using the new methods.

from azure-armrest.

bsquizz avatar bsquizz commented on July 21, 2024

Sure, that's fine, just wanted to collect all 'discovery' related info I had looked into here in 1 place. I wasn't 100% certain if we did the version discovery or not.

from azure-armrest.

djberg96 avatar djberg96 commented on July 21, 2024

Now part of 0.9.11, which is also set in the current azure provider gemspec.

from azure-armrest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.