Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automation: update sdk of remain resources to 2022-08-08 #22989

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Aug 17, 2023

also use a meta client for automation.

@wuxu92 wuxu92 changed the title automation: update sdk of remains resources to 2022-08-08 automation: update sdk of remain resources to 2022-08-08 Aug 17, 2023
internal/services/automation/client/client.go Outdated Show resolved Hide resolved
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
AccountClient *automationaccount.AutomationAccountClient
*v20220808.Client
Copy link
Member

Choose a reason for hiding this comment

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

We should give this a name e.g.

Suggested change
*v20220808.Client
V20220808 *v20220808.Client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this guideline mandatory? because I see network is using the embedding too. additionally I believe the embedded form improves readability and facilitates future SDK upgrades.

Copy link
Member

Choose a reason for hiding this comment

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

There might need to be some internal discussion on what the convention is there - if we're going with how the meta client is defined in network then we should at least follow the naming convention for the import there which is
network_2023_04_01.Client, so in this case automation_2022_08_08.Client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated. But I think It's a little bit wordy for automation service's sdk with a automation prefix. and golang style guide suggests rename the import package name with no underscore.

Go package names should not have underscores. If you need to import a package that does have one in its name (usually from generated or third party code), it must be renamed at import time to a name that is suitable for use in Go code.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with you that since the prefix is already automation then there's duplication which could be removed there.

Since this was introduced by @tombuildsstuff there could be a specific reason for doing so which we're not aware of yet (can't check either since he's out at the moment), rather than introduce a different standard into the provider it's better to follow the status quo which will make updating it further down the line quicker since you're only searching for one pattern.

I hope that makes sense.

return &Client{
AccountClient: accountClient,
Client: metaClient,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Client: metaClient,
V20220808: metaClient,

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Tests look good, thanks @wuxu92 LGTM 👍

@stephybun stephybun merged commit 3b60370 into hashicorp:main Aug 18, 2023
23 checks passed
@github-actions github-actions bot added this to the v3.71.0 milestone Aug 18, 2023
stephybun added a commit that referenced this pull request Aug 18, 2023
@wuxu92 wuxu92 deleted the automation/sdk2022 branch August 20, 2023 15:37
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants