Code Monkey home page Code Monkey logo

vscode-azureeventgrid's Introduction

Azure Event Grid for Visual Studio Code (deprecated)

Note: This extension has been deprecated.


Version Installs Build Status

Features

Event Grid Explorers

  • Create and delete Event Grid resources
  • View Event Grid resources and open directly in the portal

explorer

Generate Mock Events

This extension makes it easy to generate and send mock events to your Event Grid subscriptions. It leverages json-schema-faker to automatically generate mock data from a json schema. If you have an existing Event Subscription, you can right click on that resource and select 'Create Mock Event Generator'. You may also select 'Create Mock Event Generator' from the title bar if you want to send events of any type to an arbitrary endpoint.

CreateEventGeneratorFromExistingCreateEventGenerator

A json file with the following properties will be created:

  • destination: The destination to use when sending events. The endpointUrl can be specified directly, or you can specify the id of an Event Subscription and the endpointUrl will be automatically determined for that resource.
  • numberOfEvents: The number of events to generate and send.
  • jsonSchemaFakerOptions: The options to pass in to json-schema-faker.
  • schema: The JSON schema for your specific event, with additional metadata on how to generate mock data. You may use the standard keywords supported by json-schema-faker or Chance.js for more advanced scenarios.

Once you have an event generator, you can customize the schema, select "Preview Events" to see what gets generated, and select "Send Events" to send generated events to your Event Subscription's endpoint.

Managing Azure Subscriptions

The Azure Account extension is used to manage authentication. It is installed automatically with this extension. If you want to sign in to specific tenant set the azure.tenant setting in the Azure Account extension.

If you are not signed in to Azure, you will see a "Sign in to Azure..." link. Alternatively, you can select "View->Command Palette" in the VS Code menu, and search for "Azure: Sign In".

Sign in to Azure

If you don't have an Azure Account, you can sign up for one today for free and receive $200 in credits by selecting "Create a Free Azure Account..." or selecting "View->Command Palette" and searching for "Azure: Create an Account".

You may sign out of Azure by selecting "View->Command Palette" and searching for "Azure: Sign Out".

To select which subscriptions show up in the extension's explorer, click on the "Select Subscriptions..." button on any subscription node (indicated by a "filter" icon when you hover over it), or select "View->Command Palette" and search for "Azure: Select Subscriptions". Note that this selection affects all VS Code extensions that support the Azure Account and Sign-In extension.

Select Azure Subscriptions

Contributing

There are a couple of ways you can contribute to this repo:

  • Ideas, feature requests and bugs: We are open to all ideas and we want to get rid of bugs! Use the Issues section to either report a new issue, provide your ideas or contribute to existing threads.
  • Documentation: Found a typo or strangely worded sentences? Submit a PR!
  • Code: Contribute bug fixes, features or design changes:
    • Clone the repository locally and open in VS Code.
    • Install TSLint for Visual Studio Code.
    • Open the terminal (press CTRL+`) and run npm install.
    • To build, press F1 and type in Tasks: Run Build Task.
    • Debug: press F5 to start debugging the extension.

Legal

Before we can accept your pull request you will need to sign a Contribution License Agreement. All you need to do is to submit a pull request, then the PR will get appropriately labelled (e.g. cla-required, cla-norequired, cla-signed, cla-already-signed). If you already signed the agreement we will continue with reviewing the PR, otherwise system will tell you how you can sign the CLA. Once you sign the CLA all future PR's will be labeled as cla-signed.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

License

MIT

vscode-azureeventgrid's People

Contributors

alexweininger avatar dependabot[bot] avatar ejizba avatar mateusamin avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar nturinski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-azureeventgrid's Issues

Sign-In Support For Multiple Tenents

My account has access to multiple tenants. I would need to specify which one so that it can find the subscriptions.

Currently it finds no subscription from any of my tenants.

Ensure event JSON is valid before sending

The error detection for events are a bit vague today. We could probably do some JSON parsing to make sure that the necessary properties exist before an event is sent out.

Repro steps:

  1. Generate a Mock Event
  2. Change eventSchema to an incorrect property (ie eventsdfasdfsSchema)
  3. Try to send to preview

Action: azureEventGridSubscription.sendEvents
Error type: TypeError
Error Message: Cannot convert undefined or null to object

Version: 0.1.0
OS: win32

Support Workspace Trust

Hello 👋 I'm from the VS Code team.

Recently, we have been exploring a security feature we refer to as Workspace Trust. This feature is intended to centralize and unify a security conscious decision required by a variety of VS Code features. With workspace trust, the user will be able to declare whether or not they trust the folder that is opened in VS Code before these features are executed.

Why you should care

Your extension is incredibly popular with VS Code users! We want to make sure that those users have a delightful experience with workspace trust and that includes extension authors deciding how much of their extension is supported in an untrusted workspace.

Workspace Trust experience

You can enable the feature with the following setting security.workspace.trust.enabled. Once enabled, you will see the following dialog when opening folders in VS Code.

Workspace Trust Startup Dialog

This dialog is important for allowing the user to make a decision early and understand the impact of their decision. Once you understand the feature, you may want to customize when to display the dialog using the setting security.workspace.trust.startupPrompt.

You can follow the development of Workspace Trust and provide feedback in issue #106488.

Workspace trust API

First off, all of what I am about to say can be found in issue #120251. That issue will include discussion of the feature and any updates to the feature.

The Workspace Trust extension API is now in stable. This allowed us to release the first cut of our guide for onboarding your extension to Workspace Trust. The API is small, so here is a quick look.

You can declare your extension to provide complete, partial or no support in untrusted workspaces using the untrustedWorkspaces capability in package.json.

The following example declares that the extension is supported completely in untrusted workspaces. In this case, the extension is enabled in untrusted workspaces.

"capabilities": {
  "untrustedWorkspaces": {
    "supported": true
  }
}

The next example declares that the extension is not supported in untrusted workspaces. In this case, the extension is disabled in untrusted workspaces.

"capabilities": {
  "untrustedWorkspaces": {
    "supported": false
  }
}

The third option is to declared limited support. There are three tools provided to you when you select the limited option.

First, if you have a setting that can be configured in the workspace but requires the workspace to be trusted in order to apply the workspace value, then you can include the setting using restrictedConfigurations array property in untrustedWorkspaces object. Doing so, VS Code will ignore the workspace value of these restricted settings when your extension reads these settings values using the VS Code Workspace Configuration API.

The following example declares the settings that are restricted in untrusted workspaces.

"capabilities": {
  "untrustedWorkspaces": {
    "supported": "limited",
    "restrictedConfigurations": [
      "markdown.styles"
    ]
  }
}

Next, you can also check and listen if the current workspace is trusted or not programmatically using the following API:

export namespace workspace {
  /**
   * When true, the user has explicitly trusted the contents of the workspace.
   */
  export const isTrusted: boolean;
  /**
   * Event that fires when the current workspace has been trusted.
   */
  export const onDidGrantWorkspaceTrust: Event<void>;
}

Lastly, you can hide commands or views declaratively with the isWorkspaceTrusted context key in your when clauses.

A far more detailed guide on how to onboard which will be updated as we receive feedback can be found in issue #120251.

Rollout plan

Workspace Trust will remain disabled for the month of May, but we are planning on enabling this by default in the future. To prepare for that day, we would love for you to try it out and provide feedback.

We'd love your feedback

Since this issue was created in an automated fashion, we won't be monitoring the responses in this issue (our notifications would explode!). Instead we ask you to drop questions, and feedback in issue #120251 as we've mentioned above.

We're excited to see what you do with workspace trust!

Creating duplicate event subscription

If you create an event subscription with the same name, location, and type, it will say that it was successfully created, but cause the node to temporarily break.

No identical name validation for Event Topics

Repro steps:

  1. Create a topic
  2. Try to create another topic with the same name

Action: azureEventGridTopic.createTopic
Error type: ResourceConflict
Error Message: Topic with name eventtopic01 already exists. Choose a different topic name.

Version: 0.1.0
OS: win32

Is it possible to use this extension to test Azure functions running locally?

What I am trying to achive is to write an Azure function that does something when a file is uploaded into a blob container. I would like to test this locally with a blob storage created with Azurite and mock events sent by the Azure Event Grid extension in VS Code.

The function would look like this:

[FunctionName("BlobstorageMyContainerNotifications")]
public async Task RunMyContainerNotificationsAsync(
    [BlobTrigger("mycontainer/{blobName}", Source = BlobTriggerSource.EventGrid, Connection = "AzureWebJobsStorage")] Stream blobStream,
    string blobName,
    ILogger log)
    {
        await DoSomeStuff("mycontainer", blobName, log);
    }

I have created an event generator with the command Azure Event Grid Subscription: Create Mock Event Generator, set the event type to Storage and set the Subscriber Endpoint to http://localhost:7071/runtime/webhooks/blobs?functionName=BlobstorageMyContainerNotifications.

Then I run my Azure function app locally and click the Send Events button.
The App is then prints one of the following error messages:

When this happens, the app does not crash.

[2022-11-02T10:33:35.498Z] Executing HTTP request: {
[2022-11-02T10:33:35.499Z]   requestId: "a5d9f7c2-da9a-403e-8d09-7d42eb55777a",
[2022-11-02T10:33:35.500Z]   method: "POST",
[2022-11-02T10:33:35.501Z]   userAgent: "(null)",
[2022-11-02T10:33:35.501Z]   uri: "/runtime/webhooks/blobs"
[2022-11-02T10:33:35.502Z] }
[2022-11-02T10:33:35.541Z] An unhandled host error has occurred.
[2022-11-02T10:33:35.542Z] Microsoft.Azure.WebJobs.Extensions.Storage.Blobs: Object reference not set to an instance of an object.
[2022-11-02T10:33:35.543Z] Executed HTTP request: {
[2022-11-02T10:33:35.543Z]   requestId: "a5d9f7c2-da9a-403e-8d09-7d42eb55777a",
[2022-11-02T10:33:35.544Z]   identities: "(WebJobsAuthLevel:Admin, WebJobsAuthLevel:Admin)",
[2022-11-02T10:33:35.544Z]   status: "500",
[2022-11-02T10:33:35.545Z]   duration: "45"
[2022-11-02T10:33:35.545Z] }

When this happens, the app does crash.

[2022-11-02T10:35:43.402Z] An unhandled exception has occurred. Host is shutting down.
[2022-11-02T10:35:43.402Z] Azure.Storage.Blobs: Service request failed.
[2022-11-02T10:35:43.403Z] Status: 400 (The specifed resource name contains invalid characters.)
[2022-11-02T10:35:43.404Z] ErrorCode: InvalidResourceName
[2022-11-02T10:35:43.404Z] 
[2022-11-02T10:35:43.405Z] Headers:
[2022-11-02T10:35:43.405Z] Server: Azurite-Blob/3.20.1
[2022-11-02T10:35:43.406Z] x-ms-error-code: InvalidResourceName
[2022-11-02T10:35:43.407Z] x-ms-request-id: 9e0b114d-c01e-46ce-914d-4d5f0cc61784
[2022-11-02T10:35:43.407Z] Date: Wed, 02 Nov 2022 10:35:43 GMT
[2022-11-02T10:35:43.408Z] Connection: keep-alive
[2022-11-02T10:35:43.408Z] Keep-Alive: REDACTED
[2022-11-02T10:35:43.409Z] .

Is it possible to do something like this with this extension? Or am I missing something?

Support virtual workspaces

👋 Hi there, Martin here, from the VS Code team.

Recently we've announced the Remote Repository feature that lets you browse and edit files and folders directly on GitHub.

Open Remote Repository... opens VSCode on a folder or workspace located on a virtual file system. We call this a virtual workspace. We observed that not all extension support this well, either because they can not, or they haven't thought about it.

It would be fantastic if you could test whether your extension can handle virtual workspaces:

Check out the Virtual Workspaces Extension Author Guide on how to do that.

When done, set the new virtualWorkspaces capability in your 'package.json'.

{
  "capabilities": {
    "virtualWorkspaces": true | false
  }
}
  • Use "virtualWorkspaces": true if your extension is prepared for virtual workspaces
  • Use "virtualWorkspaces": false if your extension should be disabled when a virtual workspace is opened

For questions and comments please use the Virtual Workspaces Tracking Issue.

Thanks for the support and the great work! ❤️

Help users create/select a subscriber endpoint

Most of the 'getting started' docs recommend using hookbin to start off, but I've never gotten that to work:
https://docs.microsoft.com/azure/storage/blobs/storage-blob-event-quickstart?toc=%2fazure%2fevent-grid%2ftoc.json

I have better luck just using an Azure Function, but that's more complicated (especially if users aren't familiar with functions). Here's the docs on that: https://docs.microsoft.com/azure/azure-functions/functions-bindings-event-grid

Shouldn't allow empty string for endpoint?

Repro steps:

  1. new eventgrid subscription
  2. press ENTER for subscriber endpoint
  3. error
    EXPECTED: validation

Action: azureEventGridSubscription.createEventSubscription
Error type: InvalidRequest
Error Message: Invalid event subscription request: endpoint.

Version: 0.1.0-alpha
OS: win32

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.