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

Align naming #1

Merged
merged 1 commit into from Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
VERSION := 0.0.1

PACK := aws-lambda-api
PACK := awslambdaapi
PROJECT := github.com/pulumi/pulumi-${PACK}

PROVIDER := pulumi-resource-${PACK}
Expand Down
6 changes: 3 additions & 3 deletions examples/simple/index.ts
@@ -1,7 +1,7 @@
import * as lambdaapi from "@pulumi/lambdaapi";
import * as lambdaapi from "@pulumi/awslambdaapi";
import * as aws from "@pulumi/aws";
import * as pulumi from '@pulumi/pulumi';
import { CloudfrontS3, LambdaApi } from "@pulumi/lambdaapi";
import { CloudfrontS3, LambdaApi } from "@pulumi/awslambdaapi";

const NAMESPACE = `examples-simple`;

Expand Down Expand Up @@ -56,4 +56,4 @@ export const eventTarget = cronLambda.eventTarget

const cloudfrontS3 = new CloudfrontS3(`${NAMESPACE}-lambda-api`, {
bucketName: 'pulumi-multilang-cloudfronts3-2021-06-03'
})
})
Expand Up @@ -14,7 +14,7 @@

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
//
//
const STAGE_NAME = 'api';

export interface LambdaApiArgs {
Expand Down Expand Up @@ -68,7 +68,7 @@ export class LambdaApi extends pulumi.ComponentResource {
public readonly endpoint: pulumi.Output<string>

constructor(name: string, args: LambdaApiArgs, opts?: pulumi.ComponentResourceOptions) {
super("lambdaapi:index:LambdaApi", name, args, opts);
super("awslambdaapi:index:LambdaApi", name, args, opts);

this.restApi = new aws.apigateway.RestApi(`${name}-api`, {
// Uncomment to pass in a lambda handler instead of the arn
Expand Down
Expand Up @@ -26,11 +26,11 @@ export class Provider implements provider.Provider {

// TODO: Add support for additional component resources here.
switch (type) {
case "lambdaapi:index:LambdaApi":
case "awslambdaapi:index:LambdaApi":
return await constructLambdaApi(name, inputs, options);
case "lambdaapi:index:CronLambda":
case "awslambdaapi:index:CronLambda":
return await constructCronLambda(name, inputs, options);
case "lambdaapi:index:CloudfrontS3":
case "awslambdaapi:index:CloudfrontS3":
return await constructCloudfrontS3(name, inputs, options);
default:
throw new Error(`unknown resource type ${type}`);
Expand Down Expand Up @@ -96,4 +96,4 @@ async function constructCloudfrontS3(name: string, inputs: pulumi.Inputs,
domainName: cloudfrontS3.domainName
},
};
}
}
6 changes: 3 additions & 3 deletions schema.json
@@ -1,5 +1,5 @@
{
"name": "lambdaapi",
"name": "awslambdaapi",
"resources": {
"awslambdaapi:index:LambdaApi": {
"isComponent": true,
Expand Down Expand Up @@ -69,7 +69,7 @@
"type": "string",
"description": "Cloudfront URL"
}

},
"required": [
"domainName"
Expand All @@ -85,7 +85,7 @@
},
"go": {
"generateResourceContainerTypes": true,
"importBasePath": "github.com/ajhool/pulumi-aws-lambda-api/sdk/go/lambdaApi"
"importBasePath": "github.com/ajhool/pulumi-awslambdaapi/sdk/go/lambdaApi"
},
"nodejs": {
"dependencies": {
Expand Down
11 changes: 9 additions & 2 deletions sdk/dotnet/CloudfrontS3.cs
Expand Up @@ -7,11 +7,18 @@
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Lambdaapi
namespace Pulumi.Awslambdaapi
{
[LambdaapiResourceType("awslambdaapi:index:CloudfrontS3")]
[AwslambdaapiResourceType("awslambdaapi:index:CloudfrontS3")]
public partial class CloudfrontS3 : Pulumi.ComponentResource
{
/// <summary>
/// Cloudfront URL
/// </summary>
[Output("domainName")]
public Output<string> DomainName { get; private set; } = null!;


/// <summary>
/// Create a CloudfrontS3 resource with the given unique name, arguments, and options.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/CronLambda.cs
Expand Up @@ -7,9 +7,9 @@
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Lambdaapi
namespace Pulumi.Awslambdaapi
{
[LambdaapiResourceType("awslambdaapi:index:CronLambda")]
[AwslambdaapiResourceType("awslambdaapi:index:CronLambda")]
public partial class CronLambda : Pulumi.ComponentResource
{
/// <summary>
Expand Down
22 changes: 5 additions & 17 deletions sdk/dotnet/LambdaApi.cs
Expand Up @@ -7,9 +7,9 @@
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Lambdaapi
namespace Pulumi.Awslambdaapi
{
[LambdaapiResourceType("awslambdaapi:index:LambdaApi")]
[AwslambdaapiResourceType("awslambdaapi:index:LambdaApi")]
public partial class LambdaApi : Pulumi.ComponentResource
{
/// <summary>
Expand All @@ -18,12 +18,6 @@ public partial class LambdaApi : Pulumi.ComponentResource
[Output("bucket")]
public Output<Pulumi.Aws.S3.Bucket> Bucket { get; private set; } = null!;

/// <summary>
/// The website URL.
/// </summary>
[Output("websiteUrl")]
public Output<string> WebsiteUrl { get; private set; } = null!;


/// <summary>
/// Create a LambdaApi resource with the given unique name, arguments, and options.
Expand Down Expand Up @@ -53,16 +47,10 @@ private static ComponentResourceOptions MakeResourceOptions(ComponentResourceOpt
public sealed class LambdaApiArgs : Pulumi.ResourceArgs
{
/// <summary>
/// The name of the S3 bucket
/// </summary>
[Input("bucketName", required: true)]
public Input<string> BucketName { get; set; } = null!;

/// <summary>
/// Cloudfront args
/// The arn of the lambda function
/// </summary>
[Input("distribution", required: true)]
public Input<Pulumi.Aws.S3.Bucket> Distribution { get; set; } = null!;
[Input("lambdaArn", required: true)]
public Input<string> LambdaArn { get; set; } = null!;

public LambdaApiArgs()
{
Expand Down
6 changes: 3 additions & 3 deletions sdk/dotnet/Provider.cs
Expand Up @@ -7,9 +7,9 @@
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Lambdaapi
namespace Pulumi.Awslambdaapi
{
[LambdaapiResourceType("pulumi:providers:lambdaapi")]
[AwslambdaapiResourceType("pulumi:providers:awslambdaapi")]
public partial class Provider : Pulumi.ProviderResource
{
/// <summary>
Expand All @@ -20,7 +20,7 @@ public partial class Provider : Pulumi.ProviderResource
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public Provider(string name, ProviderArgs? args = null, CustomResourceOptions? options = null)
: base("lambdaapi", name, args ?? new ProviderArgs(), MakeResourceOptions(options, ""))
: base("awslambdaapi", name, args ?? new ProviderArgs(), MakeResourceOptions(options, ""))
{
}

Expand Down
8 changes: 4 additions & 4 deletions sdk/dotnet/Utilities.cs
Expand Up @@ -6,7 +6,7 @@
using System.Reflection;
using Pulumi;

namespace Pulumi.Lambdaapi
namespace Pulumi.Awslambdaapi
{
static class Utilities
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public static InvokeOptions WithVersion(this InvokeOptions? options)
static Utilities()
{
var assembly = typeof(Utilities).GetTypeInfo().Assembly;
using var stream = assembly.GetManifestResourceStream("Pulumi.Lambdaapi.version.txt");
using var stream = assembly.GetManifestResourceStream("Pulumi.Awslambdaapi.version.txt");
using var reader = new StreamReader(stream ?? throw new NotSupportedException("Missing embedded version.txt file"));
version = reader.ReadToEnd().Trim();
var parts = version.Split("\n");
Expand All @@ -78,9 +78,9 @@ static Utilities()
}
}

internal sealed class LambdaapiResourceTypeAttribute : Pulumi.ResourceTypeAttribute
internal sealed class AwslambdaapiResourceTypeAttribute : Pulumi.ResourceTypeAttribute
{
public LambdaapiResourceTypeAttribute(string type) : base(type, Utilities.Version)
public AwslambdaapiResourceTypeAttribute(string type) : base(type, Utilities.Version)
{
}
}
Expand Down
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"context"
Expand All @@ -13,6 +13,9 @@ import (

type CloudfrontS3 struct {
pulumi.ResourceState

// Cloudfront URL
DomainName pulumi.StringOutput `pulumi:"domainName"`
}

// NewCloudfrontS3 registers a new resource with the given unique name, arguments, and options.
Expand Down
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"context"
Expand Down
3 changes: 3 additions & 0 deletions sdk/go/awslambdaapi/doc.go
@@ -0,0 +1,3 @@
// Package awslambdaapi exports types, functions, subpackages for provisioning awslambdaapi resources.
//
package awslambdaapi
8 changes: 4 additions & 4 deletions sdk/go/lambdaapi/init.go → sdk/go/awslambdaapi/init.go
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"fmt"
Expand Down Expand Up @@ -43,7 +43,7 @@ func (p *pkg) Version() semver.Version {
}

func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pulumi.ProviderResource, error) {
if typ != "pulumi:providers:lambdaapi" {
if typ != "pulumi:providers:awslambdaapi" {
return nil, fmt.Errorf("unknown provider type: %s", typ)
}

Expand All @@ -58,12 +58,12 @@ func init() {
fmt.Println("failed to determine package version. defaulting to v1: %v", err)
}
pulumi.RegisterResourceModule(
"lambdaapi",
"awslambdaapi",
"index",
&module{version},
)
pulumi.RegisterResourcePackage(
"lambdaapi",
"awslambdaapi",
&pkg{version},
)
}
23 changes: 7 additions & 16 deletions sdk/go/lambdaapi/lambdaApi.go → sdk/go/awslambdaapi/lambdaApi.go
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"context"
Expand All @@ -17,8 +17,6 @@ type LambdaApi struct {

// The bucket resource.
Bucket s3.BucketOutput `pulumi:"bucket"`
// The website URL.
WebsiteUrl pulumi.StringOutput `pulumi:"websiteUrl"`
}

// NewLambdaApi registers a new resource with the given unique name, arguments, and options.
Expand All @@ -28,11 +26,8 @@ func NewLambdaApi(ctx *pulumi.Context,
return nil, errors.New("missing one or more required arguments")
}

if args.BucketName == nil {
return nil, errors.New("invalid value for required argument 'BucketName'")
}
if args.Distribution == nil {
return nil, errors.New("invalid value for required argument 'Distribution'")
if args.LambdaArn == nil {
return nil, errors.New("invalid value for required argument 'LambdaArn'")
}
var resource LambdaApi
err := ctx.RegisterRemoteComponentResource("awslambdaapi:index:LambdaApi", name, args, &resource, opts...)
Expand All @@ -43,18 +38,14 @@ func NewLambdaApi(ctx *pulumi.Context,
}

type lambdaApiArgs struct {
// The name of the S3 bucket
BucketName string `pulumi:"bucketName"`
// Cloudfront args
Distribution s3.Bucket `pulumi:"distribution"`
// The arn of the lambda function
LambdaArn string `pulumi:"lambdaArn"`
}

// The set of arguments for constructing a LambdaApi resource.
type LambdaApiArgs struct {
// The name of the S3 bucket
BucketName pulumi.StringInput
// Cloudfront args
Distribution s3.BucketInput
// The arn of the lambda function
LambdaArn pulumi.StringInput
}

func (LambdaApiArgs) ElementType() reflect.Type {
Expand Down
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"context"
Expand All @@ -22,7 +22,7 @@ func NewProvider(ctx *pulumi.Context,
}

var resource Provider
err := ctx.RegisterResource("pulumi:providers:lambdaapi", name, args, &resource, opts...)
err := ctx.RegisterResource("pulumi:providers:awslambdaapi", name, args, &resource, opts...)
if err != nil {
return nil, err
}
Expand Down
@@ -1,7 +1,7 @@
// *** WARNING: this file was generated by Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package lambdaapi
package awslambdaapi

import (
"fmt"
Expand Down Expand Up @@ -65,7 +65,7 @@ func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interfac
func PkgVersion() (semver.Version, error) {
type sentinal struct{}
pkgPath := reflect.TypeOf(sentinal{}).PkgPath()
re := regexp.MustCompile("^.*/pulumi-lambdaapi/sdk(/v\\d+)?")
re := regexp.MustCompile("^.*/pulumi-awslambdaapi/sdk(/v\\d+)?")
if match := re.FindStringSubmatch(pkgPath); match != nil {
vStr := match[1]
if len(vStr) == 0 { // If the version capture group was empty, default to v1.
Expand Down
3 changes: 0 additions & 3 deletions sdk/go/lambdaapi/doc.go

This file was deleted.

6 changes: 3 additions & 3 deletions sdk/nodejs/index.ts
Expand Up @@ -30,14 +30,14 @@ const _module = {
}
},
};
pulumi.runtime.registerResourceModule("lambdaapi", "index", _module)
pulumi.runtime.registerResourceModule("awslambdaapi", "index", _module)

import { Provider } from "./provider";

pulumi.runtime.registerResourcePackage("lambdaapi", {
pulumi.runtime.registerResourcePackage("awslambdaapi", {
version: utilities.getVersion(),
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => {
if (type !== "pulumi:providers:lambdaapi") {
if (type !== "pulumi:providers:awslambdaapi") {
throw new Error(`unknown provider type ${type}`);
}
return new Provider(name, <any>undefined, { urn });
Expand Down