- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
[Components] ngrok #14293
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
          
     Merged
      
      
    
  
     Merged
                    [Components] ngrok #14293
Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            57 changes: 57 additions & 0 deletions
          
          57 
        
  components/ngrok/actions/create-https-edge/create-https-edge.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import app from "../../ngrok.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "ngrok-create-https-edge", | ||
| name: "Create HTTPS Edge", | ||
| description: "Create an HTTPS Edge. [See the documentation](https://ngrok.com/docs/api/resources/edges-https/#create-https-edge).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| description: { | ||
| propDefinition: [ | ||
| app, | ||
| "description", | ||
| ], | ||
| }, | ||
| hostports: { | ||
| propDefinition: [ | ||
| app, | ||
| "hostports", | ||
| ], | ||
| }, | ||
| metadata: { | ||
| propDefinition: [ | ||
| app, | ||
| "metadata", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| createHTTPSEdge(args = {}) { | ||
| return this.app.post({ | ||
| path: "/edges/https", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| createHTTPSEdge, | ||
| description, | ||
| hostports, | ||
| metadata, | ||
| } = this; | ||
|  | ||
| const response = await createHTTPSEdge({ | ||
| $, | ||
| data: { | ||
| description, | ||
| hostports, | ||
| metadata: metadata && JSON.stringify(metadata), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created new HTTPS edge with ID \`${response.id}\`.`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            42 changes: 42 additions & 0 deletions
          
          42 
        
  components/ngrok/actions/delete-https-edge/delete-https-edge.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import app from "../../ngrok.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "ngrok-delete-https-edge", | ||
| name: "Delete HTTPS Edge", | ||
| description: "Delete an HTTPS Edge. [See the documentation](https://ngrok.com/docs/api/resources/edges-https/#delete-https-edge).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| edgeId: { | ||
| propDefinition: [ | ||
| app, | ||
| "edgeId", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| deleteHTTPSEdge({ | ||
| edgeId, ...args | ||
| } = {}) { | ||
| return this.app.delete({ | ||
| path: `/edges/https/${edgeId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| deleteHTTPSEdge, | ||
| edgeId, | ||
| } = this; | ||
| await deleteHTTPSEdge({ | ||
| $, | ||
| edgeId, | ||
| }); | ||
| $.export("$summary", "Successfully deleted HTTPS edge."); | ||
| return { | ||
| success: true, | ||
| }; | ||
| }, | ||
| }; | 
        
          
          
            40 changes: 40 additions & 0 deletions
          
          40 
        
  components/ngrok/actions/get-https-edge/get-https-edge.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import app from "../../ngrok.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "ngrok-get-https-edge", | ||
| name: "Get HTTPS Edge", | ||
| description: "Get the details of an HTTPS Edge. [See the documentation](https://ngrok.com/docs/api/resources/edges-https/#get-https-edge).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| edgeId: { | ||
| propDefinition: [ | ||
| app, | ||
| "edgeId", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| getHTTPSEdge({ | ||
| edgeId, ...args | ||
| } = {}) { | ||
| return this.app._makeRequest({ | ||
| path: `/edges/https/${edgeId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| getHTTPSEdge, | ||
| edgeId, | ||
| } = this; | ||
| const response = await getHTTPSEdge({ | ||
| $, | ||
| edgeId, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved HTTPS edge with ID \`${response.id}\`.`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            67 changes: 67 additions & 0 deletions
          
          67 
        
  components/ngrok/actions/update-https-edge/update-https-edge.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import app from "../../ngrok.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "ngrok-update-https-edge", | ||
| name: "Update HTTPS Edge", | ||
| description: "Updates an HTTPS Edge. [See the documentation](https://ngrok.com/docs/api/resources/edges-https/#update-https-edge).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| edgeId: { | ||
| propDefinition: [ | ||
| app, | ||
| "edgeId", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| app, | ||
| "description", | ||
| ], | ||
| }, | ||
| hostports: { | ||
| propDefinition: [ | ||
| app, | ||
| "hostports", | ||
| ], | ||
| }, | ||
| metadata: { | ||
| propDefinition: [ | ||
| app, | ||
| "metadata", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| updateHTTPSEdge({ | ||
| edgeId, ...args | ||
| } = {}) { | ||
| return this.app.patch({ | ||
| path: `/edges/https/${edgeId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| updateHTTPSEdge, | ||
| edgeId, | ||
| description, | ||
| hostports, | ||
| metadata, | ||
| } = this; | ||
|  | ||
| const response = await updateHTTPSEdge({ | ||
| $, | ||
| edgeId, | ||
| data: { | ||
| description, | ||
| hostports, | ||
| metadata: metadata && JSON.stringify(metadata), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully updated Agent Ingress ID \`${response.id}\`.`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,102 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|  | ||
| export default { | ||
| type: "app", | ||
| app: "ngrok", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "What this edge will be used for.", | ||
| }, | ||
| hostports: { | ||
| type: "string[]", | ||
| label: "Host Ports", | ||
| description: "Hostports served by this edge. Eg: `example.com:443`", | ||
| optional: true, | ||
| }, | ||
| metadata: { | ||
| type: "object", | ||
| label: "Metadata", | ||
| description: "The metadata of the agent ingress. Arbitrary user-defined machine-readable data.", | ||
| optional: true, | ||
| }, | ||
| edgeId: { | ||
| type: "string", | ||
| label: "Edge ID", | ||
| description: "The ID of the edge to update.", | ||
| async options({ prevContext: { url } }) { | ||
| if (url === null) { | ||
| return []; | ||
| } | ||
| const { | ||
| next_page_uri: nextPageUri, | ||
| https_edges: edges, | ||
| } = await this.listHTTPSEdges({ | ||
| url, | ||
| params: { | ||
| limit: 10, | ||
| }, | ||
| }); | ||
| const options = edges.map(({ | ||
| id: value, description: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })); | ||
| return { | ||
| options, | ||
| context: { | ||
| url: nextPageUri, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| getUrl(path) { | ||
| return `https://api.ngrok.com${path}`; | ||
| }, | ||
| getHeaders(headers) { | ||
| return { | ||
| ...headers, | ||
| "Authorization": `Bearer ${this.$auth.api_key}`, | ||
| "Content-Type": "application/json", | ||
| "Ngrok-Version": "2", | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, url, path, headers, ...args | ||
| } = {}) { | ||
| return axios($, { | ||
| ...args, | ||
| url: url || this.getUrl(path), | ||
| headers: this.getHeaders(headers), | ||
| }); | ||
| }, | ||
| post(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| ...args, | ||
| }); | ||
| }, | ||
| patch(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "PATCH", | ||
| ...args, | ||
| }); | ||
| }, | ||
| delete(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "DELETE", | ||
| ...args, | ||
| }); | ||
| }, | ||
| listHTTPSEdges(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/edges/https", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.