Commit graph

4881 commits

Author SHA1 Message Date
Luke Hoban 4042adef9d Refactor example
Separate three pieces:
1. User code
2. Auto-generated proxy code
3. Core language SDK code
2020-07-15 15:04:03 -07:00
Luke Hoban c2942c3bcc Support components as outputs 2020-07-15 15:04:03 -07:00
Luke Hoban 0c914ebfb4 A little more cleanup 2020-07-15 14:36:01 -07:00
Luke Hoban e8242bca33 Initial example working 2020-07-15 14:36:01 -07:00
Luke Hoban a41316d5b7 WIP 2020-07-15 14:36:01 -07:00
Luke Hoban 5c5f41d3e6 Very simple "multilang" 2020-07-15 14:36:01 -07:00
Komal 6682da5fa5
[codegen/python] Add underscores to private modules to avoid exporting them. (#4959) 2020-07-15 13:10:52 -07:00
Pat Gavlin 4961567ecf
[codegen/hcl2] Add a template trivia constructor (#5009)
Just what it says on the tin. Currently it's not possible to create a
valid value of this type because the `bytes` field is unexported. This
constructor fixes that.
2020-07-14 12:07:44 -07:00
Pat Gavlin 86599a06a6
[codegen/hcl2] Fix applies on relative traversals. (#5008)
The apply rewrite for relative traversals did not consider whether or
not the receiver was eventually-typed, and did not properly check
whether or not the relative traversal itself was eventually-typed. These
changes correct those mistakes.
2020-07-14 12:07:35 -07:00
Pat Gavlin a19843f433
[codegen/{go,nodejs,python}] Normalize modules. (#5006)
In general, a package/module name in these targets is derived from the
module portion of a type token. If the type token is not already in an
expected form--namely, all lowercase--the generated package/module names
will also be in unexpected forms. These changes normalize the module
names to lowercase s.t. the generated package/module names conform to
expectations.
2020-07-14 10:58:29 -07:00
Pat Gavlin 8baee06e30
[codegen/{go,nodejs}] Minor fixes in SDK gen. (#4991)
- NodeJS: fix get + constructor generation for types with required args
  and no state type.
- Go: fix type + import generation for properties in the root module.
2020-07-14 08:55:39 -07:00
Gabriel Diaz 4316800f2f
Add logic to parse pulumi venv (#4994) 2020-07-14 05:04:01 -07:00
Komal f364311064
Remove known_types decorators (#4980) 2020-07-13 12:27:00 -07:00
Pat Gavlin 54c5a75e34 [codegen/{go,nodejs}] Minor fixes in SDK gen.
- NodeJS: fix get + constructor generation for types with required args
  and no state type.
- Go: fix type + import generation for properties in the root module.
2020-07-10 11:23:31 -07:00
Levi Blackstone 736019f7ce
Add support for streamInvoke during update (#4990)
Previously, streamInvoke was only supported by
the query command. Copied the implementation
into the resource monitor, which will allow
streaming invoke commands to run during updates.

Also fixed a bug with cancellation of streaming
invokes. The check was comparing against a
hardcoded string, which did not match the actual
error string. Instead, we can rely on the error code.
2020-07-10 10:56:35 -06:00
stack72 89f3a32db3 Prepare for v2.6.1 release 2020-07-09 17:51:23 +03:00
Paul Stack 0824fc9a8b
Revert "Narrow a few interfaces." (#4987) 2020-07-09 15:19:12 +01:00
Pat Gavlin dff1299be4
[codegen] Add a code generator for resource state. (#4982)
Add a new package, `codegen/importer`, that can generate definitions for
resource states in PCL or TS/Python/C#/Go. The pipeline is relatively
simple: given a list of resource states, generate a PCL program in
memory, bind it, and pass it to the language-specific code generator.
This builds upon the existing PCL IR, and can be used with the currently
supported code generators.

Related to #1635.
2020-07-08 19:12:37 -07:00
Komal bdc86e002a
Change how submodules are imported to work with Intellisense (#4948) 2020-07-08 18:34:59 -07:00
Komal 0ede17ced2
Remove duplicated methods (#4985) 2020-07-08 16:50:46 -07:00
stack72 4d3545117f Prepare for v2.6.0 release 2020-07-09 00:05:43 +03:00
Praneet Loke 1acc8231b1
[codegen/docs] Use the correct format for package name when module name is empty (#4889)
* Use the correct format for package name when module name is empty.

* Add an exclusion for Docker's Image component resource when generating the Python formal params.

* Prefix the type name with the package name when linking to Python function names.
2020-07-07 17:24:07 -07:00
Pat Gavlin 2119601023
Implement PropertyPath.Add. (#4976)
This function adds a property value to another property at a given path,
creating containing properties as required. If the property cannot be
added because of a mismatch between the value types required by the path
and the values present in the destination, the add will fail. If a value
already exists at the given path, the add will succeed.

Related to #1635.
2020-07-07 14:45:36 -07:00
Pat Gavlin d07c3698e5
[codegen/{hcl2,schema}] Abstract package loading. (#4975)
Instead of requiring a plugin host for package loading in the HCL2
binder, define a much narrower interface that exposes the ability to
fetch the schema for a package at a specific version. This interface is
defined in the schema package, which also exposes a caching loader that
is backed by provider plugins.

These changes also add some convenience methods to `*schema.Package` for
fast access to particular resources and functions.

Related to #1635.
2020-07-07 14:45:18 -07:00
Pat Gavlin 2d530e8038
[hcl2] Fix tokenless body item printing. (#4974)
In general, each item in an HCL2 body must be followed by a trailing
newline. The printer did not properly insert these newlines for body
items without any associated tokens/trivia, or with trivia that did not
include a trailing new line.

Related to #1635.
2020-07-07 13:46:26 -07:00
Paul Stack 57b91d553e
Adding the ability to specify a version as a ResourceOption (#4945) 2020-07-07 20:20:01 +01:00
Levi Blackstone 9325c90946
[codegen/docs] Document kustomize API (#4960) 2020-07-07 12:54:52 -06:00
Komal 56fa087bd6
[codegen/python] pep-8 compliant spacing (#4958)
* pep-8 compliant spacing

* PR fixes
2020-07-07 11:32:48 -07:00
Simen A. W. Olsen b0d9280416
[docker/actions] unset GOOGLE_CREDENTIALS (#4972) 2020-07-07 16:35:17 +01:00
Paul Stack 0e9b865f68
Adding the missing providers to the docs generation titleLookup Map (#4970) 2020-07-06 15:24:51 +01:00
Levi Blackstone d611740ab0
[codegen] Set additionalSecretOutputs for secret props (#4956) 2020-07-02 13:30:10 -06:00
Pat Gavlin 45d2fa95d6
Narrow a few interfaces. (#4934)
- Remove `Info` from `Source`. This method was not used.
- Remove `Stack` from `EvalSource`. This method was not used.
- Remove `Type` and `URN` from `Step`. These values are available via
  `Res().URN.Type()` and `Res().URN`, respectively. This removes the
  possibility of inconsistencies between the type, URN, and state of the
  resource associated with a `Step`.
- Remove URN from StepEventMetadata.
2020-07-01 15:32:50 -07:00
Levi Blackstone 137f39151b
[codegen] Add Secret field to Property schema (#4943) 2020-07-01 14:17:49 -06:00
Levi Blackstone 956d362d8b
[codegen] Don't log deprecation warnings in k8s SDKs (#4942)
The k8s SDK logs deprecations warnings as part of the
provider logic, and includes a flag to suppress these
warnings. Including them in the SDKs breaks this logic.
2020-07-01 13:50:26 -06:00
Mikhail Shilkov de2a6500cd
Do not import non-existing inputs or outputs in Node.js codegen (#4937)
Do not import non-existing inputs or outputs in Node.js codegen
2020-07-01 21:47:46 +02:00
Levi Blackstone 92cb042aee
[codegen/dotnet] Add LanguageResource for downstream codegen (#4932) 2020-06-30 16:19:21 -06:00
Pat Gavlin a8a20ecb4b
[codegen/*] Add support for explicit secrets. (#4927)
- Add a new builtin function, secret, that marks its input value as
  secret
- Add support for this function to the various code generators

Fixes #4924.
2020-06-30 11:35:24 -07:00
Mikhail Shilkov bb358c4d21
Escape \x in Python comments (#4922) 2020-06-30 11:19:45 +02:00
Evan Boyle 395a68e0f6
[Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
Pat Gavlin 69ba47cff2
[codegen/*] Add support for resource options. (#4925)
The PCL binder has supported resource options for some time, but these
options haven't been used or processed by the various code generators.
These options--particularly the parent and provider options0--are
critical for import codegen. These changes implement the basic set of
options, and add a note about fleshing out the rest as necessary.

One component of these changes is a new rewriter that rewrites property
references into property paths that are understood by the Pulumi engine.
This rewriter is used to preprocess the contents of the `ignoreChanges`
resource option.

These changes also hack around a weakness in the HCL2 type system:
In Go, references to resources should be typed as `hcl2.ResourceType`.
Unfortunately, this breaks the existing collection semantics associated
with resources. Because of this, the Go code generator does not have
enough information to know that it should generate a `[]pulumi.Resource`
for lists of resources. These changes hack around that limitation using
a Go-specific opaque type and some hardcoded comparisons in
`argumentTypeName`.

Fixes #4923.
2020-06-29 16:33:52 -07:00
Evan Boyle 91828b4310
[Go Program Gen] Improved handling for pulumi.Map types (#4914) 2020-06-29 15:29:41 -07:00
Levi Blackstone 8961f5b0ca
Rename RetrieveTemplate function to RetrieveGitFolder (#4912)
The new name better reflects the functionality for external
consumers of this package.
2020-06-26 15:01:51 -06:00
Mikhail Shilkov 14a3871346
Avoid stack overflow in Python codegen in case of recursive types (#4908) 2020-06-26 20:47:13 +02:00
Evan Boyle 2351fc66cf
Go SDK interfaces should declare impl of Ptr types where appropriate (#4911) 2020-06-26 11:25:53 -07:00
Komal 3eacf8bf90
[codegen/python] Only add item to map if it doesn't already exist. (#4907) 2020-06-26 09:05:36 -07:00
Komal b35a94cac6
[codegen/python] - Exclude single word properties from casing tables. (#4895)
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2020-06-25 11:51:57 -07:00
Komal 8d1b39434c
Skip python tests during investigation (#4896) 2020-06-25 11:51:25 -07:00
Komal 93fa20a44b
[codegen/python] - Only import json when needed (#4892) 2020-06-25 09:59:00 -07:00
stack72 ad721d3b54 Prepare for v2.5.0 release 2020-06-25 12:00:45 +03:00
Evan Boyle fa3000801e
skip transient test (#4886) 2020-06-24 13:53:18 -07:00