Giter Site home page Giter Site logo

pulumiverse / pulumi-purrl Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 606 KB

A Pulumi native provider for making API calls

License: Apache License 2.0

Makefile 4.56% Go 18.43% C# 17.44% TypeScript 16.63% Python 42.32% Dockerfile 0.63%
pulumi golang infrastructure-as-code pulumi-provider

pulumi-purrl's Introduction

Purrl

Go Reference

purrl_logo

This provider is designed to be a flexible extension of your Pulumi code to make API calls to your target endpoint. Purrl is useful when a provider does not have a resource or data source that you require, so Purrl can be used to make substitute API calls.

Installing

This package is available for several languages/platforms:

Node.js (JavaScript/TypeScript)

To use from JavaScript or TypeScript in Node.js, install using either npm:

npm install @pulumiverse/purrl

or yarn:

yarn add @pulumiverse/purrl

Python

To use from Python, install using pip: ``

pip install pulumiverse-purrl

Go

To use from Go, use go get to grab the latest version of the library:

go get github.com/pulumiverse/pulumi-purrl/sdk

.NET

To use from .NET, install using dotnet add package:

dotnet add package Pulumiverse.Purrl

Reference

For detailed reference documentation, please visit the Pulumi registry.

pulumi-purrl's People

Contributors

dependabot[bot] avatar dirien avatar necaris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

necaris

pulumi-purrl's Issues

Usage for circular dependency and custom update endpoint

Hi! Thx for creating this package for Pulumi. Since dynamic providers for .NET is not ready yet and I would like to implement a "simple" API based infra provider, I thought why not make use of Purrl instead of creating a full package. While doing so, I bumped against some limitations and questions which made me give second thoughts on my approach. I'm facing the following challenges:

I have this endpoint for managing DNS records. There is a PUT endpoint for creating a new record and a POST endpoint for updating an existing record. However, in the current implementation of Purrl I cannot change the method used for updates, can I? (see non working example below).

Second to this, the endpoint requires the ID of the DNS record when updating and removing the record. How can a property of an existing instance work for subsequent requests? In the example below, Id will be null in the constructor, so I would not be able to make use of it before instantiating the resource itself.

public class Record : BunnyCdnComponentResource
{
    [Output]
    public Output<string> Id { get; set; }

    public Record(string name, string zoneId, DnsRecordArgs args, ComponentResourceOptions? options = null) : base("", name, options)
    {
        // Cannot make use of Id as it has not been defined yet
        var recordEndpoint = Id.Apply(recordId => $"https://api.bunny.net/dnszone/{zoneId}/records/{recordId}");
        var request = new Purrl(name, new PurrlArgs
        {
            Name = name,
            Url = $"https://api.bunny.net/dnszone/{zoneId}/records",
            ResponseCodes = new List<string> { "200" },
            Method = "PUT",
            Headers = new Dictionary<string, string>
            {
                { "accept", "application/json" },
                { "content-type", "application/json" }
            },
            Body = args.ToJson(),
            UpdateMethod = "POST",          // Currently does not exist <--------!!!!
            UpdateUrl = recordEndpoint,     // Currently does not exist <--------!!!!
            DeleteMethod = "DELETE",
            DeleteUrl = recordEndpoint,
            DeleteResponseCodes = new List<string> { "200" },
        });

        Id = request.Response;
    }
}

Add support for uploading files

At the moment, this only supports string content, it would be better if you could provide a FileAsset as an input to the body that would be great as you could then have it trigger the create on FileAsset change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.