Skip to content

Conversation

@erezrokah
Copy link
Member

@erezrokah erezrokah commented Feb 2, 2023

Summary

Fixes #7628.

Notes

  1. Took a bit of time to figure out how to create these resources, but it's working on our playground account
  2. Had to create a resource group multiplexer (and fix the code that retrieves those), as the API to list the new tables requires a resource group. Please note that these are different from other tables that we get the resource group from the parent, for example:
    , as here we need only a resource group and not a parent id for example.

@github-actions
Copy link

github-actions bot commented Feb 2, 2023

This PR has the following changes to source plugin(s) tables:

  • Table azure_network_virtual_network_gateway_connections was added
  • Table azure_network_virtual_network_gateways was added

logger zerolog.Logger
registeredNamespaces map[string]map[string]bool
resourceGroups map[string][]*armresources.GenericResourceExpanded
resourceGroups map[string][]string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need the group names, no reason to keep the whole object


func (c *Client) disocverResourceGroups(ctx context.Context) error {
c.resourceGroups = make(map[string][]*armresources.GenericResourceExpanded, len(c.subscriptions))
filter := "resourceType eq 'Microsoft.Resources/resourceGroups'"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query wasn't working (returned 0 results). There's a dedicated client to get the resource groups so I used that one


func (c *Client) ID() string {
return c.SubscriptionId
if c.ResourceGroup != "" {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follows the Azure convention, see

const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)`

client := meta.(*Client)
var c = make([]schema.ClientMeta, 0)
for _, subId := range client.subscriptions {
if _, ok := client.registeredNamespaces[subId][namespace]; ok {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept the logic as SubscriptionMultiplexRegisteredNamespace to skip non registered namespaces

return err
}

pager := svc.NewListPager(cl.ResourceGroup, nil)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here that we only pass the resource group unlike other resources that pass other parent's fields

return err
}

pager := svc.NewListPager(cl.ResourceGroup, nil)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here that we only pass the resource group unlike other resources that pass other parent's fields

@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Feb 2, 2023
@kodiakhq kodiakhq bot merged commit 97a9254 into cloudquery:main Feb 7, 2023
kodiakhq bot pushed a commit that referenced this pull request Feb 7, 2023
🤖 I have created a release *beep* *boop*
---


## [4.1.0](plugins-source-azure-v4.0.0...plugins-source-azure-v4.1.0) (2023-02-07)


### Features

* **azure-resources:** Add Virtual Network Gateways and Connections ([#7636](#7636)) ([97a9254](97a9254))


### Bug Fixes

* **azure-resources:** Use default API version of `armhealthbot` bots client ([#7177](#7177)) ([e24af94](e24af94))
* **azure:** Fix Azure CIS Policies in Section 2 ([#7718](#7718)) ([3c77b2c](3c77b2c))
* **deps:** Update golang.org/x/exp digest to f062dba ([#7531](#7531)) ([59d5575](59d5575))
* **deps:** Update google.golang.org/genproto digest to 1c01626 ([#7533](#7533)) ([c549c27](c549c27))
* **deps:** Update module github.com/Azure/azure-sdk-for-go/sdk/azidentity to v1.2.1 ([#7540](#7540)) ([3b5c838](3b5c838))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.33.0 ([#7595](#7595)) ([c5adc75](c5adc75))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.33.1 ([#7614](#7614)) ([2fe665c](2fe665c))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.34.0 ([#7719](#7719)) ([6a33085](6a33085))
* **deps:** Update module github.com/golang-jwt/jwt/v4 to v4.4.3 ([#7543](#7543)) ([0607454](0607454))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure Virtual Network Gateways and Virtual Network Gateway Connections

3 participants