@itentialopensource/adapter-meraki 0.8.0 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
package/CONTRIBUTING.md CHANGED
@@ -1,29 +1,12 @@
1
1
  # Contributing
2
2
 
3
- :+1: :tada: First off, thanks for taking the time to contribute! :tada: :+1:
3
+ First off, thanks for taking the time to contribute!
4
4
 
5
5
  The following is a set of rules for contributing.
6
6
 
7
- ## Table Of Contents
8
-
9
- [Code of Conduct](#code-of-conduct)
10
-
11
- [How Can I Contribute?](#how-can-i-contribute)
12
-
13
- * [Reporting Bugs](#reporting-bugs)
14
- * [Your First Code Contribution](#your-first-code-contribution)
15
- * [Merge Requests](#merge-requests)
16
-
17
- [Styleguides](#styleguides)
18
-
19
- * [Git Commit Messages](#git-commit-messages)
20
- * [JavaScript Styleguide](#javascript-styleguide)
21
- * [Tests Styleguide](#tests-styleguide)
22
- * [Documentation Styleguide](#documentation-styleguide)
23
-
24
7
  ## Code of Conduct
25
8
 
26
- This project and everyone participating in it is governed by the [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [support@itential.com](mailto:support@itential.com).
9
+ This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to support@itential.com.
27
10
 
28
11
  ## How to Contribute
29
12
 
@@ -31,45 +14,45 @@ This project and everyone participating in it is governed by the [Code of Conduc
31
14
 
32
15
  This section guides you through submitting a bug report. Following these guidelines helps maintainers understand your report :pencil:, reproduce the behavior :computer: :left_right_arrow: :computer:, and find related reports :mag_right:.
33
16
 
34
- Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). If you have an Itential support contract, please create an Itential Service Desk ticket. If you don't have an Itential support contract, please send an email of the issue to [support@itential.com](mailto:support@itential.com).
17
+ Before creating bug reports, please check before-submitting-a-bug-report, as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible. If you have an Itential support contract, please create an Itential Service Desk ticket. If you don't have an Itential support contract, please send an email of the issue to support@itential.com.
35
18
 
36
19
  #### Before Submitting A Bug Report
37
20
 
38
- * **Check the [User Guide](README.md).** You might be able to find the cause of the problem and fix things yourself. Most importantly, check if you can reproduce the problem __in the latest version__.
21
+ * **Check the README.md.** You might be able to find the cause of the problem and fix things yourself. Most importantly, check if you can reproduce the problem __in the latest version__.
39
22
  * **Work through the troubleshooting process.** Troubleshooting will include changing the log level of Itential Automation Platform (IAP) and adapters and checking the logs to see what the issues are. These logs should be included in any ticket you open for this issue.
40
- * **Check for resolutions to the issue.** Check the [Itential Knowledge Base](https://itential.atlassian.net/servicedesk/customer/kb/view/286883841?applicationId=605994d2-2cb2-3174-af59-ed5b23ff5fd5&spaceKey=PKB&src=1187380921) to see if there is a known resolution for the issue you are having.
23
+ * **Check for resolutions to the issue.** Check the <a href="https://itential.atlassian.net/servicedesk/customer/kb/view/286883841?applicationId=605994d2-2cb2-3174-af59-ed5b23ff5fd5&spaceKey=PKB&src=1187380921" target="_blank">Itential Knowledge Base</a> to see if there is a known resolution for the issue you are having.
41
24
  * **Ask around in chat if you are an Itential employee** to see if others are experiencing the same issue.
42
25
 
43
26
  #### How to Submit a (Good) Bug Report
44
27
 
45
28
  Bugs are tracked through the Itential Service Desk. Explain the problem and include additional details to help maintainers reproduce the problem:
46
29
 
47
- * **Use a clear and descriptive title** for the issue to identify the problem.
48
- * **Describe the exact steps which reproduce the problem** in as much detail as possible. For example, start by explaining how you configured the adapter (e.g., which properties you used and how they were set) or how you are using an artifact.
49
- * **Provide specific examples to demonstrate the steps**. Include logs, or copy/paste snippets, in your examples.
50
- * **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
51
- * **Explain which behavior you expected to see instead and why.**
52
- * **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows. Use [this tool](https://github.com/colinkeenan/silentcast) or [program](https://github.com/rhcarvalho/byzanz-guiz) on Linux.
53
- * **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
30
+ - **Use a clear and descriptive title** for the issue to identify the problem.
31
+ - **Describe the exact steps which reproduce the problem** in as much detail as possible. For example, start by explaining how you configured the adapter (e.g., which properties you used and how they were set) or how you are using an artifact.
32
+ - **Provide specific examples to demonstrate the steps**. Include logs, or copy/paste snippets, in your examples.
33
+ - **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
34
+ - **Explain which behavior you expected to see instead and why.**
35
+ - **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. You can use <a href="https://www.cockos.com/licecap/" target="_blank">this tool</a> to record GIFs on macOS and Windows. Use <a href="https://github.com/colinkeenan/silentcast" target="_blank">this tool</a> or <a href="https://github.com/rhcarvalho/byzanz-guiz" target="_blank">program</a> on Linux.
36
+ - **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
54
37
 
55
38
  Provide more context by answering these questions:
56
39
 
57
- * **Did the problem start happening recently** (e.g. after updating to a new version/tag) or was this always a problem?
58
- * If the problem started happening recently, **can you reproduce the problem in an older version/tag?** What's the most recent version in which the problem does not happen?
59
- * **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
40
+ - **Did the problem start happening recently** (e.g. after updating to a new version/tag) or was this always a problem?
41
+ - If the problem started happening recently, **can you reproduce the problem in an older version/tag?** What's the most recent version in which the problem does not happen?
42
+ - **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
60
43
 
61
44
  Include details about your configuration and environment:
62
45
 
63
- * **Which version of the adapter/artifact are you using?** You can get the exact version by checking the project version in the package.json file.
64
- * **What's the name and version of the OS you're using**?
65
- * **Are you running or using IAP in a virtual machine?** If so, which VM software are you using and which operating systems and versions are used for the host and guest?
66
- * **Are there firewalls between IAP and any other system you are integrating with?** If so, have you tried running curl from the system IAP is on to the other system to verify you have connectivity between the systems?
46
+ - **Which version of the adapter/artifact are you using?** You can get the exact version by checking the project version in the package.json file.
47
+ - **What's the name and version of the OS you're using**?
48
+ - **Are you running or using IAP in a virtual machine?** If so, which VM software are you using and which operating systems and versions are used for the host and guest?
49
+ - **Are there firewalls between IAP and any other system you are integrating with?** If so, have you tried running curl from the system IAP is on to the other system to verify you have connectivity between the systems?
67
50
 
68
51
  ### Your First Code Contribution
69
52
 
70
53
  #### Local development
71
54
 
72
- This project can be developed locally on all operating systems. For instructions on how to do this, follow the steps highlighted in the [User Guide](README.md). The [User Guide](README.md)provides many more details on cloning the repository for local development, how to lint and test your changes.
55
+ This project can be developed locally on all operating systems. For instructions on how to do this, follow the steps highlighted in the README.md. The README.mdprovides many more details on cloning the repository for local development, how to lint and test your changes.
73
56
 
74
57
  #### Development Process
75
58
 
@@ -92,17 +75,50 @@ Make all of the desired changes.
92
75
 
93
76
  > **Note:** All code changes should be accompanied by additional Unit and Integration tests to minimize the likelihood that any changes will negatively impact the adapter/artifact as well as to ensure the desired functionality is achieved.
94
77
 
95
- | Files | Changes |
96
- | ------- | ------- |
97
- | .codeclimate.yml, .eslintignore, .eslintrc.js, .gitignore, .gitlab-ci.yml, .jshintrc, .npmignore | These are foundational files that are used in linting and building of the adapter. Changes to these files are heavily scrutinized and may be implemented in a different manner so that the changes can be implemented across all adapters.|
98
- | CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE, README.md | These are license and process files for the repository. Changes to these files may require legal review and may also be implemented in a different manner so that the changes can be implemented across all adapters.|
99
- | utils/*, adapterBase.js | Changes to these files will rarely be accepted. These are process files that need to be changed through the builder process and migration.|
100
- | adapter.js | Changes to this file are code changes. They should be accompanied by the appropriate unit and integration tests. If new methods are added, they should also be added to the pronghorn.json file, otherwise integration tests are likely to fail.|
101
- | error.json, propertiesSchema.json | These files are utilized by the Itential Runtime libraries. You can make changes to these files, but the changes should be appending of new errors or properties. Removal of errors and properties can result in rejection of the changes.|
102
- | pacakge.json, package-lock.json | The package-lock.json is automatically generated and should only be updated when the dependencies inside of the package.json are modified. You can make changes to the package.json to add additional scripts, add new dependencies, modify names, etc. However, changing the scripts or dependencies that are Itential specific will be overriden during the acceptance process.|
103
- | pronghorn.json | Changes to this file are made for integration into IAP. The most common change here is adding new methods that shoud be exposed to the IAP Workflow.|
104
- | entities/* | Changes to these files include adding new capabilities, updating existing capabilities, or removing deprecated capabilities in the adapter. Translation configuration can also be modified here.|
105
- | test/* | Changes to these files include adding, updating, or removing unit and integration tests in the adapter. Tests should never be removed unless the methods that are being tested are removed also. Both the unit and integration test file should have a marker that identifies where modification can take place. Modifications above that marker are likely to be rejected or implemented in a different manner.|
78
+
79
+ <table border="1" class="bordered-table">
80
+ <tr>
81
+ <th bgcolor="lightgrey" style="padding:15px"><span style="font-size:12.0pt">Files</span></th>
82
+ <th bgcolor="lightgrey" style="padding:15px"><span style="font-size:12.0pt">Changes</span></th>
83
+ </tr>
84
+ <tr>
85
+ <td style="padding:15px">.codeclimate.yml, .eslintignore, .eslintrc.js, .gitignore, .gitlab-ci.yml, .jshintrc, .npmignore</td>
86
+ <td style="padding:15px">These are foundational files that are used in linting and building of the adapter. Changes to these files are heavily scrutinized and may be implemented in a different manner so that the changes can be implemented across all adapters.</td>
87
+ </tr>
88
+ <tr>
89
+ <td style="padding:15px">CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE, README.md</td>
90
+ <td style="padding:15px">These are license and process files for the repository. Changes to these files may require legal review and may also be implemented in a different manner so that the changes can be implemented across all adapters.</td>
91
+ </tr>
92
+ <tr>
93
+ <td style="padding:15px">utils/*, adapterBase.js</td>
94
+ <td style="padding:15px">Changes to these files will rarely be accepted. These are process files that need to be changed through the builder process and migration.</td>
95
+ </tr>
96
+ <tr>
97
+ <td style="padding:15px">adapter.js</td>
98
+ <td style="padding:15px">Changes to this file are code changes. They should be accompanied by the appropriate unit and integration tests. If new methods are added, they should also be added to the pronghorn.json file, otherwise integration tests are likely to fail.</td>
99
+ </tr>
100
+ <tr>
101
+ <td style="padding:15px">error.json, propertiesSchema.json</td>
102
+ <td style="padding:15px">These files are utilized by the Itential Runtime libraries. You can make changes to these files, but the changes should be appending of new errors or properties. Removal of errors and properties can result in rejection of the changes.</td>
103
+ </tr>
104
+ <tr>
105
+ <td style="padding:15px">pacakge.json, package-lock.json</td>
106
+ <td style="padding:15px">The package-lock.json is automatically generated and should only be updated when the dependencies inside of the package.json are modified. You can make changes to the package.json to add additional scripts, add new dependencies, modify names, etc. However, changing the scripts or dependencies that are Itential specific will be overriden during the acceptance process.</td>
107
+ </tr>
108
+ <tr>
109
+ <td style="padding:15px">pronghorn.json</td>
110
+ <td style="padding:15px">Changes to this file are made for integration into IAP. The most common change here is adding new methods that shoud be exposed to the IAP Workflow.</td>
111
+ </tr>
112
+ <tr>
113
+ <td style="padding:15px">entities/*</td>
114
+ <td style="padding:15px">Changes to these files include adding new capabilities, updating existing capabilities, or removing deprecated capabilities in the adapter. Translation configuration can also be modified here.</td>
115
+ </tr>
116
+ <tr>
117
+ <td style="padding:15px">test/*</td>
118
+ <td style="padding:15px">Changes to these files include adding, updating, or removing unit and integration tests in the adapter. Tests should never be removed unless the methods that are being tested are removed also. Both the unit and integration test file should have a marker that identifies where modification can take place. Modifications above that marker are likely to be rejected or implemented in a different manner.</td>
119
+ </tr>
120
+ </table>
121
+ <br>
106
122
 
107
123
  > **Note:** It is a best practice to lint and test your code prior to committing changes into the repository. You can lint your code by running **npm run lint** and test it by running **node utils/testRunner.sh**. However, there are pre-commit hooks that will run these scripts when you commit your changes.
108
124
 
@@ -120,39 +136,37 @@ Push the changes into the repository. This should only be done after the commit
120
136
  git push origin <name_of_your_new_branch>
121
137
  ```
122
138
 
123
- Create a [Merge Request](#merge-request).
139
+ Create a Merge Request.
124
140
 
125
141
  ### Merge Requests
126
142
 
127
- * Fill out the provided merge request template.
128
- * Reference related issues and merge requests liberally.
129
- * Include screenshots and animated GIFs in your merge request whenever possible.
130
- * Follow the project [Styleguide](#styleguides).
131
- * End all files with a newline.
143
+ - Fill out the provided merge request template.
144
+ - Reference related issues and merge requests liberally.
145
+ - Include screenshots and animated GIFs in your merge request whenever possible.
146
+ - Follow the project Styleguide.
147
+ - End all files with a newline.
132
148
 
133
149
  ## Styleguide
134
150
 
135
151
  ### Git Commit Messages
136
152
 
137
- * Use the present tense ("Add feature" not "Added feature")
138
- * Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
139
- * Consider starting the commit message with an applicable emoji _(not required)_:
140
- * :art: `:art:` When improving the format/structure of the code.
141
- * :racehorse: `:racehorse:` When improving performance
142
- * :non-potable_water: `:non-potable_water:` When plugging memory leaks.
143
- * :memo: `:memo:` When writing documentation.
144
- * :penguin: `:penguin:` When fixing something on Linux.
145
- * :apple: `:apple:` When fixing something on macOS.
146
- * :checkered_flag: `:checkered_flag:` When fixing something on Windows.
147
- * :bug: `:bug:` When fixing a bug.
148
- * :fire: `:fire:` When removing code or files.
149
- * :green_heart: `:green_heart:` When fixing the CI build.
150
- * :white_check_mark: `:white_check_mark:` When adding tests,
151
- * :lock: `:lock:` When dealing with security.
152
- * :arrow_up: `:arrow_up:` When upgrading dependencies.
153
- * :arrow_down: `:arrow_down:` When downgrading dependencies.
154
- * :shirt: `:shirt:` When removing linter warnings.
153
+ - Use the present tense ("Add feature" not "Added feature")
154
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
155
+ - Consider starting the commit message with an applicable emoji _(not required)_:
156
+ - :art: `:art:` When improving the format/structure of the code.
157
+ - :racehorse: `:racehorse:` When improving performance
158
+ - :non-potable_water: `:non-potable_water:` When plugging memory leaks.
159
+ - :memo: `:memo:` When writing documentation.
160
+ - :penguin: `:penguin:` When fixing something on Linux.
161
+ - :apple: `:apple:` When fixing something on macOS.
162
+ - :checkered_flag: `:checkered_flag:` When fixing something on Windows.
163
+ - :bug: `:bug:` When fixing a bug.
164
+ - :fire: `:fire:` When removing code or files.
165
+ - :green_heart: `:green_heart:` When fixing the CI build.
166
+ - :white_check_mark: `:white_check_mark:` When adding tests,
167
+ - :lock: `:lock:` When dealing with security.
168
+ - :arrow_up: `:arrow_up:` When upgrading dependencies.
169
+ - :arrow_down: `:arrow_down:` When downgrading dependencies.
170
+ - :shirt: `:shirt:` When removing linter warnings.
155
171
 
156
172
  __Avoid installing unnecessary packages.__ Do not install packages just because they might be "nice to have". Itential Opensource projects are supposed to be minimal, specific, and compact by design.
157
-
158
- _return to [README](./README.md)_
package/ENHANCE.md ADDED
@@ -0,0 +1,69 @@
1
+ ## Enhancements
2
+
3
+ ### Adding a Second Instance of an Adapter
4
+
5
+ You can add a second instance of this adapter without adding new code on the file system. To do this go into the IAP Admin Essentials and add a new service config for this adapter. The two instances of the adapter should have unique ids. In addition, they should point to different instances (unique host and port) of the other system.
6
+
7
+ ### Adding Adapter Calls
8
+
9
+ There are multiple ways to add calls to an existing adapter.
10
+
11
+ The easiest way would be to use the Adapter Builder update process. This process takes in a Swagger or OpenAPI document, allows you to select the calls you want to add and then generates a zip file that can be used to update the adapter. Once you have the zip file simply put it in the adapter directory and execute `npm run adapter:update`.
12
+
13
+ ```bash
14
+ mv updatePackage.zip adapter-meraki
15
+ cd adapter-meraki
16
+ npm run adapter:update
17
+ ```
18
+
19
+ If you do not have a Swagger or OpenAPI document, you can use a Postman Collection and convert that to an OpenAPI document using APIMatic and then follow the first process.
20
+
21
+ If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and, in order to make it available as a workflow task in IAP, it should also be added to the pronghorn.json file. You can optionally add it to the unit and integration test files. There is more information on how to work on each of these files in the <a href="https://www.itential.com/automation-platform/integrations/adapters-resources/" target="_blank">Adapter Technical Resources</a> on Dev Site.
22
+
23
+ ```text
24
+ Files to update
25
+ * entities/<entity>/action.json: add an action
26
+ * entities/<entity>/schema.json (or the schema defined on the action): add action to the enum for ph_request_type
27
+ * adapter.js: add the new method and make sure it calls the proper entity and action
28
+ * pronghorn.json: add the new method
29
+ * test/unit/adapterTestUnit.js (optional but best practice): add unit test(s) - function is there, any required parameters error when not passed in
30
+ * test/integration/adapterTestIntegration.js (optional but best practice): add integration test
31
+ ```
32
+
33
+ ### Adding Adapter Properties
34
+
35
+ While changing adapter properties is done in the service instance configuration section of IAP, adding properties has to be done in the adapter. To add a property you should edit the propertiesSchema.json with the proper information for the property. In addition, you should modify the sampleProperties to have the new property in it.
36
+
37
+ ```text
38
+ Files to update
39
+ * propertiesSchema.json: add the new property and how it is defined
40
+ * sampleProperties: add the new property with a default value
41
+ * test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
42
+ * test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
43
+ ```
44
+
45
+ ### Changing Adapter Authentication
46
+
47
+ Often an adapter is built before knowing the authentication and authentication processes can also change over time. The adapter supports many different kinds of authentication but it does require configuration. Some forms of authentication can be defined entirely with the adapter properties but others require configuration.
48
+
49
+ ```text
50
+ Files to update
51
+ * entities/.system/action.json: change the getToken action as needed
52
+ * entities/.system/schemaTokenReq.json: add input parameters (external name is name in other system)
53
+ * entities/.system/schemaTokenResp.json: add response parameters (external name is name in other system)
54
+ * propertiesSchema.json: add any new property and how it is defined
55
+ * sampleProperties: add any new property with a default value
56
+ * test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
57
+ * test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
58
+ ```
59
+
60
+ ### Enhancing Adapter Integration Tests
61
+
62
+ The adapter integration tests are written to be able to test in either stub (standalone) mode or integrated to the other system. However, if integrating to the other system, you may need to provide better data than what the adapter provides by default as that data is likely to fail for create and update. To provide better data, edit the adapter integration test file. Make sure you do not remove the marker and keep custom code below the marker so you do not impact future migrations. Once the edits are complete, run the integration test as it instructs you to above. When you run integrated to the other system, you can also save mockdata for future use by changing the isSaveMockData flag to true.
63
+
64
+ ```text
65
+ Files to update
66
+ * test/integration/adapterTestIntegration.js: add better data for the create and update calls so that they will not fail.
67
+ ```
68
+
69
+ As mentioned previously, for most of these changes as well as other possible changes, there is more information on how to work on an adapter in the <a href="https://www.itential.com/automation-platform/integrations/adapters-resources/" target="_blank">Adapter Technical Resources</a> on Dev Site.