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

Added support for custom naming of dynamic provider resource #7633

Merged
merged 9 commits into from
Aug 17, 2021

Conversation

jancespivo
Copy link
Contributor

@jancespivo jancespivo commented Jul 24, 2021

Description

Now there is not possible to change a name of dynamic provider resource without copying a code of the pulumi.sdk.python.lib.pulumi.dynamic.dynamic.Resource and changing the hard-coded name "pulumi-python:dynamic:Resource". I successfully uses this proposal to make it possible.

Usage:

class CustomResource(
   Resource, module="custom-provider", name="CustomResource"
):
   ...

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

1 similar comment
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@lukehoban lukehoban requested a review from pgavlin July 25, 2021 23:17
@lukehoban
Copy link
Member

Thanks for the PR! I believe this would address #3468. We likely want to add the same support for Node.js as well as part of any update here.

Copy link
Member

@pgavlin pgavlin left a comment

Choose a reason for hiding this comment

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

Can we add some tests for this as well? An integration test like tests/integration/dynamic/python should work. To add a test, you can just copy that folder to a new folder (e.g. tests/integration/dynamic/python-type-name) and add a new test method to tests/integration/integration_python_test.go, e.g. by copying and modifying the method for tests/integration/dynamic/python.

Please let me know if you need any more info on how to add a test!

@lukehoban I think that we can file a follow-up issue for Node.

sdk/python/lib/pulumi/dynamic/dynamic.py Outdated Show resolved Hide resolved
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 4f0fcc8 to 41cb09c Compare July 27, 2021 08:11
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

Copy link
Member

@pgavlin pgavlin left a comment

Choose a reason for hiding this comment

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

One nit, but LGTM otherwise!

sdk/python/lib/pulumi/dynamic/dynamic.py Outdated Show resolved Hide resolved
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

1 similar comment
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@lukehoban
Copy link
Member

/run-acceptance-tests

@github-actions
Copy link

Please view the results of the PR Build + Acceptance Tests Run Here

@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 56237a6 to e9efab1 Compare August 4, 2021 18:55
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from e9efab1 to 92656e4 Compare August 4, 2021 18:57
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 92656e4 to 1ad23e5 Compare August 4, 2021 19:08
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 1ad23e5 to a41f145 Compare August 4, 2021 19:15
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo
Copy link
Contributor Author

@pgavlin I've added a test. It is my first contribution in go and I don't know how to run tests. I've tried to run go test in the integration directory, but it print PASS regardless the new test should pass or not. Please help :) Thx

@github-actions
Copy link

github-actions bot commented Aug 4, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@emiliza emiliza added this to the 0.60 milestone Aug 6, 2021
Copy link
Member

@pgavlin pgavlin left a comment

Choose a reason for hiding this comment

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

One small set of suggestions for the test changes, but this looks great!

You can ensure that your test runs by running go test -tags=all -run TestCustomResourceTypeNameDynamicPython from within the tests/integration directory.

tests/integration/integration_python_test.go Outdated Show resolved Hide resolved
@emiliza emiliza modified the milestones: 0.60, 0.61 Aug 16, 2021
@emiliza emiliza added the awaiting-feedback Blocked on input from the author label Aug 16, 2021
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 249086a to 4b34aae Compare August 17, 2021 08:19
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@jancespivo jancespivo force-pushed the python-dynamic-resource-naming branch from 4b34aae to 4897dba Compare August 17, 2021 08:50
@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@emiliza emiliza removed the awaiting-feedback Blocked on input from the author label Aug 17, 2021
@emiliza
Copy link
Contributor

emiliza commented Aug 17, 2021

/run-acceptance-tests

@github-actions
Copy link

Please view the results of the PR Build + Acceptance Tests Run Here

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@emiliza
Copy link
Contributor

emiliza commented Aug 17, 2021

/run-acceptance-tests

@github-actions
Copy link

Please view the results of the PR Build + Acceptance Tests Run Here

@pgavlin pgavlin merged commit e67334d into pulumi:master Aug 17, 2021
@infin8x
Copy link
Contributor

infin8x commented Sep 16, 2021

@pgavlin @lukehoban it looks like this did indeed fix #3468 - shall I resolve it or is there more work tracked there?

bors bot added a commit that referenced this pull request Jan 17, 2023
11498: area/cli: removed checks for PULUMI_DISABLE_RESOURCE_REFERENCES in cli r=RobbieMcKinstry a=stefins

Removed checks for `PULUMI_DISABLE_RESOURCE_REFERENCES` env in cli and engine

Related to #11385

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

partially fixes #11385 (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


11873: [sdk/nodejs] - Add support for custom naming of dynamic provider resource r=RobbieMcKinstry a=Asamsig

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes #11856 

Added two new optional constructor parameters to `pulumi.dynamic.Resource`, `module`, and `type`, which enables custom type naming of dynamic provider resources.

Based on the Python implementation from [here](#7633).

### Before
All dynamic provider resources would have the type `pulumi-nodejs:dynamic:Resource`

### After

Usage:
```ts
class CustomResource extends pulumi.dynamic.Resource {
  constructor (name: string, opts?: pulumi.ResourceOptions) {
    super(new DummyResourceProvider(), name, {}, opts, "custom-provider", "CustomResource")
  }
}
```
Output: `pulumi-nodejs:dynamic/custom-provider:CustomResource`



## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: STEFIN <stefin@pm.me>
Co-authored-by: Alexander Samsig <koresamsig@gmail.com>
bors bot added a commit that referenced this pull request Jan 17, 2023
11873: [sdk/nodejs] - Add support for custom naming of dynamic provider resource r=RobbieMcKinstry a=Asamsig

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes #11856 

Added two new optional constructor parameters to `pulumi.dynamic.Resource`, `module`, and `type`, which enables custom type naming of dynamic provider resources.

Based on the Python implementation from [here](#7633).

### Before
All dynamic provider resources would have the type `pulumi-nodejs:dynamic:Resource`

### After

Usage:
```ts
class CustomResource extends pulumi.dynamic.Resource {
  constructor (name: string, opts?: pulumi.ResourceOptions) {
    super(new DummyResourceProvider(), name, {}, opts, "custom-provider", "CustomResource")
  }
}
```
Output: `pulumi-nodejs:dynamic/custom-provider:CustomResource`



## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Alexander Samsig <koresamsig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants