Git Product home page Git Product logo

vsc-apim-policy-utils's Introduction

๐Ÿš€ APIM Policy Utils Extension for Visual Studio Code

The APIM Policy Utils Extension for Visual Studio Code provides a quick and easy way to extract and combine Azure API Management (APIM) policies directly within the editor.

๐Ÿ”ง Installation

You can install the extension directly from the Visual Studio Code marketplace.

๐Ÿ“ฆ Features

The extension provides two commands:

  1. Extract Policies - Extract inline policies and policy sets from xml files in a directory and generates csx files for each policy.

  2. Combine Policies - Combine the extracted csx files from subdirectories of a given directory into a single xml file.

๐Ÿ“ Usage

Using the Right-Click Menu

To use the extension, simply right-click on a folder in the Explorer view and select either Extract Policies or Combine Policies from the context menu.

pcombine-extract-rightclick

extract-gif

combine-gif

Using the Command Palette

You can also use the VS Code command palette to run the "Extract Policies" or "Combine Policies" command.

Open the Command Palette by pressing Ctrl+Shift+P (Windows, Linux) or Cmd+Shift+P (macOS).

Type Policy Combiner or Policy Extractor and select the appropriate command from the list.

policy-combiner-extractor.drawio

extractor-gif

combiner-gif

Debug

You can debug the csx file generated by extractor in VSCode by adding the following configuration into your launch.json file.

{
        "name": "Debug .NET Script",
        "type": "coreclr",
        "request": "launch",
        "program": "dotnet",
        "args": [
            "exec",
            "${userHome}/.dotnet/tools/.store/dotnet-script/1.4.0/dotnet-script/1.4.0/tools/net7.0/any/dotnet-script.dll",
            "${file}",
            "${fileDirname}"
        ],
        "cwd": "${workspaceRoot}",
        "stopAtEntry": false
}

debug-gif

๐Ÿ“‚ Folder Structure

Extract Policies

Please use a directory path that contains all the policy files. The directory structure should look like this:

.
โ”œโ”€โ”€ policies
|   โ”œโ”€โ”€ policy1.xml
|   โ”œโ”€โ”€ policy2.xml
|   โ””โ”€โ”€ policy3.xml

Combine Policies

Please use a directory path that contains subdirectories with generated .csx files from the Extract Policies command. The directory structure should look like this:

.
โ”œโ”€โ”€ scripts
|   โ”œโ”€โ”€ subfolder1
|   |   โ”œโ”€โ”€ block-001.csx
|   |   โ”œโ”€โ”€ inline-001.csx
|   |   โ”œโ”€โ”€ replaced.xml
|   |   โ”œโ”€โ”€ context.csx
|   |   โ””โ”€โ”€ context.json
|   โ”œโ”€โ”€ subfolder2
|   |   โ”œโ”€โ”€ block-001.csx
|   |   โ”œโ”€โ”€ inline-001.csx
|   |   โ”œโ”€โ”€ replaced.xml
|   |   โ”œโ”€โ”€ context.csx
|   |   โ””โ”€โ”€ context.json

๐Ÿ“œ License

This project is licensed under the MIT License.

vsc-apim-policy-utils's People

Contributors

zoeyzuo-se avatar

Watchers

 avatar  avatar

vsc-apim-policy-utils's Issues

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.