From b2263cbddd96e4eb4f32be717b0ed07402061577 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 26 Nov 2019 15:23:49 +0000 Subject: [PATCH 001/108] Merged PR 52062: Generate swagger code and added classes to build over them # Justification Need to generate swagger code and implement the generated interface to be used by the generated web service. # Implementation Added NuGet package dependency and generated code. Started implementing AssetPerformanceManagementWebService and implemented one of the simplest methods inside it. Adding tests. # Testing Ran all unit and integration tests. Copied the dlls in the local installation folder and made sure the product still works. # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #944460, #944461 --- asset-managment/niapm.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 89e1c32..aa2ed02 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -8,6 +8,7 @@ info: url: 'https://www.ni.com/systemlink' email: support@ni.com basePath: /niapm +x-ni-privilege-application: 'niws.niasset' consumes: - application/json produces: @@ -100,8 +101,6 @@ definitions: - writeAssets: Write information related to assets. - deleteAssets: Delete information related to assets. - - - readAssetUtilization: Read information related to asset utilization. type: object properties: readAssets: @@ -110,8 +109,6 @@ definitions: $ref: '#/definitions/Operation' deleteAssets: $ref: '#/definitions/Operation' - readAssetUtilization: - $ref: '#/definitions/Operation' BusType: title: Bus Type description: All supported bus types for an asset. @@ -552,7 +549,6 @@ parameters: name: granularity description: The possible granularities that can be used to obtain asset availability. type: string - default: WEEK enum: - NONE - WEEK @@ -587,9 +583,10 @@ parameters: x-example: 0 AssetAvailabilityComparison: in: body - name: assetIds + name: compareAvailability description: Request body consisting in a time interval and a list of assets to compute availability history for. schema: + title: Compare Asset Availability type: object required: - assetIds @@ -1257,7 +1254,7 @@ responses: AssetSummaryResponse: description: Asset summary response containing the count of active assets, inactive assets and the total number of assets. schema: - title: Asset Summary + title: Asset Summary Response description: Asset summary response containing the total number of assets, the number of assets which are active (present in a connected system) and the number of assets which are not active. type: object properties: @@ -1282,6 +1279,7 @@ responses: description: The response contains a collection of systems that an asset has been present during the timespan, along with the percentage of time the asset was present in the system in each timespan. type: array items: + title: Availability in System Model type: object properties: systemName: @@ -1296,7 +1294,7 @@ responses: CalibratedAssetSummaryResponse: description: Response containing summary of assets supporting calibration. Contains the count of assets approaching recommended calibration due date, assets past recommended calibration due date and count of assets supporting (any type of) calibration. schema: - title: Calibrated Asset Summary + title: Calibrated Asset Summary Response description: Asset summary of the total number of assets supporting calibration, the number of assets approaching recommended calibration date and the number of assets past their recommended calibration date. type: object properties: @@ -1355,6 +1353,7 @@ responses: description: Response for the utilization query containing the collection of utilizations. Besides a time interval, each element contains an asset identifier, a minion id, an utilization category, and a percentage of time that the asset was utilized in the time interval. type: array items: + title: Utilization with Percentage Model type: object required: - startTimestamp @@ -1534,7 +1533,6 @@ paths: For example, a list of 100 asssets with a skip value of 50 and a take value of 25 will return entries 51 through 75. type: integer - default: 0 - in: query name: take description: @@ -1543,18 +1541,15 @@ paths: For example, a list of 100 assets with a skip value of 50 and a take value of 25 will return entries 51 through 75. type: integer - default: -1 maximum: 1000 - in: query name: calibratableOnly description: Whether to filter only assets which support calibration. type: boolean - default: false - in: query name: responseFormat description: The return type. Valid options are "JSON" and "CSV". type: string - default: JSON enum: - JSON - CSV @@ -1566,7 +1561,6 @@ paths: "DOWNLOAD" returns the list of assets as the body of the response and indicates to the client that it should be downloaded as a file. "FILE_SERVICE" sends the list of assets to the file ingestion service and returns the ID of the file to the client in a JSON object. type: string - default: INLINE enum: - INLINE - DOWNLOAD From 9426c74af139fabe340d7859fec4aa48f8bc14ea Mon Sep 17 00:00:00 2001 From: Rares Pop Date: Wed, 27 Nov 2019 09:52:45 +0000 Subject: [PATCH 002/108] Merged PR 52197: Add first bits of permission checks in Systems Management service Add permission-checks for PostJob, CancelJobs. This is supposed to be back-wards compatible, so the infrastructure should fall-back and use an --- systems-management/nisysmgmt.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index 712d646..b47a4b8 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -1673,10 +1673,10 @@ paths: /v1/jobs: post: operationId: CreateJob + x-ni-auth: true x-ni-privilege: Write x-ni-operation: createOrCancelJobs x-ni-request-timeout: 300000 - x-ni-request-variables: [REMOTE_USER, USER_NAME] tags: [jobs] summary: Create a job description: Create a job and returns the newly created job including the job ID. @@ -1822,9 +1822,11 @@ paths: /v1/cancel-jobs: post: operationId: CancelJobs + x-ni-auth: true x-ni-privilege: Write x-ni-operation: createOrCancelJobs x-ni-request-timeout: 120000 + x-ni-request-variables: [REMOTE_USER, USER_NAME] tags: [jobs] summary: Cancel jobs description: Cancel jobs that are running on systems. This won't stop the jobs from executing on systems if the jobs have already been dispatched to the systems. From 9c3e99297d89c2c3c5c29274d592c05f0eb01f6b Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Fri, 6 Dec 2019 07:53:28 +0000 Subject: [PATCH 003/108] Merged PR 52563: Replaced inline objects with models in repo.yml # Justification OpenAPIGenerator generates inline objects if we use undefined models. # Implementation Replaced inline objects with models in repo.yml. Added models for each inline object and inline response generated. Didn't change the API, only named all the used models. Named generated functions. # Testing Successfully generated the new classes by rebuilding the module. --- repo/nirepo.yml | 1089 +++++++++++++++++++++++++---------------------- 1 file changed, 582 insertions(+), 507 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 4f2351a..83f9775 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -65,7 +65,7 @@ definitions: type: string example: 5c51be40781e2b0ad0b0108c operation: - description: The type of job you want to execute. + description: The type of the job that is going to be executeed. type: string enum: - CREATE_FEED @@ -106,6 +106,30 @@ definitions: type: string enum: [FEED, FEEDS, PACKAGE, UPDATE_DESCRIPTORS, SIMPLE] example: FEED + JobResponse: + type: object + description: Contains a single job. + properties: + job: + $ref: '#/definitions/Job' + JobsResponse: + type: object + description: Points to the location of a jobs array. + properties: + jobs: + type: array + items: + $ref: '#/definitions/Job' + JobIdsResponse: + description: Points to the location of a job IDs array. + type: object + properties: + jobIds: + type: array + items: + type: string + description: The ID of a single job. + example: '5c66b6bd781e2b2ce42ca818' ErrorObject: description: Contains error information. type: object @@ -141,8 +165,8 @@ definitions: $ref: '#/definitions/ErrorObject' Platform: type: string - enum: [windows, ni-linux-rt] - description: "Depending on the platform you select, you can only use specific package extensions. For Windows feeds, you must use .nipkg. For NI Linux RT feeds, you must use .ipk or .deb." + enum: [WINDOWS, NI_LINUX_RT] + description: "Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds." example: windows PackageImportDescriptor: type: object @@ -155,32 +179,128 @@ definitions: description: description: The description of the package. type: string - example: Enter description here + example: "LabVIEW Runtime (32-bit) Resource contains support for non-English languages to display in dialog boxes, menus, and error messages that are part of the LabVIEW Runtime." feedUri: description: The path to the feed. type: string - example: "/path/to/feed" + example: "https://download.ni.com/support/nipkg/products/ni-l/ni-labview-nxg-3.0.0/6.4/released-critical" packageName: description: The package name. type: string - example: Package Name + example: "ni-labview-2015-runtime-engine-resource" packageUri: description: The path to the package. type: string - example: "/path/to/package" + example: "/nirepo/v1/files/packages/ni-labview-2015-runtime-engine-resource_15.6.0.49152-0+f0_windows_all.nipkg" version: description: The package version. type: string - example: "1.2.3" + example: "15.6.0.49152-0+f0" PackageImportDescriptors: type: object - description: An object that points to the location of a package importer array. + description: Points to the location of a package importer array. properties: packageImportDescriptors: description: An array containing objects which describe the packages in the remote feed. type: array items: $ref: '#/definitions/PackageImportDescriptor' + ArchitectureInformation: + type: object + description: An object defining the architecture the software can run on. + properties: + id: + type: string + description: The ID of this element. + example: "1" + value: + type: string + description: The architecture that this package can run on. + example: "64-bit" + LanguageInformation: + type: object + description: Contains information about the supported locale of the product. + properties: + id: + type: string + description: The ID of this element. + example: "2" + value: + type: string + description: The language the product supports. + example: English + RepositoryInformation: + type: object + description: Contains information about one of the repositories where the packages of a product are located. + properties: + packageName: + type: string + description: The name of one of the packages. + example: ni-labview-nxg-2.0.0-2.1-released-critical + file: + type: string + description: | + The location of the file, including the file extension. + Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds. + example: "http://127.0.0.1/en/ni-labview-nxg-2.0.0-2.1-released-critical.nipkg" + md5Checksum: + description: The MD5 fingerprint of the file. + type: string + example: 233b2aa7d1c23cbef93874a7ecdce61a + repositoryPath: + type: string + description: The path to the repository where the package is found. + example: "http://download.ni.com/products/ni-labview-nxg-2.0.0/2.1/released-critical" + feedType: + type: string + enum: [RELEASED, RELEASED-CRITICAL] + description: The release type of the feed. + example: RELEASED + SoftwareInformation: + type: object + description: Contains information about a piece of software that a store item contains. + properties: + storeItemId: + type: number + description: The ID of this element. + example: 654 + productName: + type: string + description: The name of one the products contained in the software suite. + example: LabVIEW NXG + shortDescription: + type: string + description: A short description of the product. + example: LabVIEW NXG enables engineers to quickly automate hardware, customize tests to project specifications, and easily view measurement results from anywhere. + updateDate: + type: string + description: The last date this product was updated at. + example: '2018-01-23T14:33:29.000-06:00' + packageName: + type: string + description: The name of the package to install. + example: ni-labview-nxg-2.0.0 + packageVersion: + type: string + description: The version of the package to install. + example: 5.3.1.49156-0+f4 + architecture: + type: string + description: The architecture this product works on. + example: windows_x64 + preSelect: + type: string + description: The designation of whether the product will be automatically set to install. Select "yes" to preselect the product. + example: "yes" + repositories: + type: array + description: An array containing information about where to locate the repositories and packages to install them. + items: + $ref: '#/definitions/RepositoryInformation' + downloadItemVersion: + type: string + description: The item version number. + example: "2.1" StoreItemInstaller: type: object properties: @@ -192,120 +312,22 @@ definitions: type: array description: An array containing information about the possible architectures the software can run on. items: - type: object - description: An object defining the architecture the software can run on. - properties: - id: - type: string - description: The ID of this element. - example: "1" - value: - type: string - description: The architecture that this package can run on. - example: "64-bit" + $ref: '#/definitions/ArchitectureInformation' languages: type: array description: An array containing objects that offer information about the supported locale of the product. items: - type: object - description: An object offering information about the supported locale of the product. - properties: - id: - type: string - description: The ID of this element. - example: "2" - value: - type: string - description: The language the product supports. - example: English + $ref: '#/definitions/LanguageInformation' suiteContents: type: array description: Array of descriptions about what this store item contains. items: - type: object - description: An object containing information about a piece of software that this store item contains. - properties: - storeItemId: - type: number - description: The ID of this element. - example: 654 - productName: - type: string - description: The name of one the products contained in the software suite. - example: LabVIEW NXG - shortDescription: - type: string - description: A short description of the product. - example: LabVIEW NXG enables engineers to quickly automate hardware, customize tests to project specifications, and easily view measurement results from anywhere. - updateDate: - type: string - description: The last date this product was updated at. - example: '2018-01-23T14:33:29.000-06:00' - packageName: - type: string - description: The name of the package to install. - example: ni-labview-nxg-2.0.0 - packageVersion: - type: string - description: The version of the package to install. - example: 5.3.1.49156-0+f4 - architecture: - type: string - description: The architecture this product works on. - example: windows_x64 - preSelect: - type: string - description: The designation of whether the product will be automatically set to install. Select "yes" to preselect the product. - example: "yes" - repositories: - type: array - description: An array containing information about where to locate the repositories and packages to install them. - items: - type: object - description: An object containing information about one of the repositories where the packages of this product are located. - properties: - packageName: - type: string - description: The name of one of the packages. - example: ni-labview-nxg-2.0.0-2.1-released-critical - file: - type: string - description: | - The location of the file, including the file extension. - Depending on the platform you select, you will be able to use the following package extensions: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds. - example: "http://127.0.0.1/en/ni-labview-nxg-2.0.0-2.1-released-critical.nipkg" - md5Checksum: - description: The MD5 fingerprint of the file. - type: string - example: 233b2aa7d1c23cbef93874a7ecdce61a - repositoryPath: - type: string - description: The path to the repository where the package is found. - example: "http://download.ni.com/products/ni-labview-nxg-2.0.0/2.1/released-critical" - feedType: - type: string - enum: [RELEASED, RELEASED-CRITICAL] - description: The release type of the feed. - example: RELEASED - downloadItemVersion: - type: string - description: The item version number. - example: "2.1" + $ref: '#/definitions/SoftwareInformation' feeds: type: array description: The feeds where the suite contents are located at. items: - type: object - description: Item containing information about the feed. - properties: - feedName: - type: string - description: The name of the feed. Feed names must begin with an alphabetical character and contain only alphanumeric characters, spaces, underscores, and hyphens. - example: "SystemLink 19.0" - uri: - type: string - description: The path to the feed. - example: "/path/to/feed" + $ref: '#/definitions/FeedNameAndUri' StoreDownloadItems: type: object properties: @@ -350,7 +372,7 @@ definitions: description: The path to the package. packageId: type: string - example: PackageId + example: 5de11fd6a47a402c643e4b62 description: The unique ID of the package. packageToReplace: type: string @@ -364,17 +386,37 @@ definitions: type: boolean description: Whether it is local or remote. example: false + FeedBasicData: + type: object + description: Contains the name and the description of a single feed. + properties: + name: + type: string + description: Name of the feed. + example: My LabVIEW feed + description: + type: string + description: A short description of the feed. + example: Feed containing all the necessary packages for configuring LabVIEW 2015 FeedData: type: object + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. properties: feedName: type: string - description: A string value representing the feed's name. - example: Feed Name + description: The name of this feed. + example: My LabVIEW feed + name: + type: string + description: The name of this feed. + example: My LabVIEW feed description: type: string description: A short description of the feed. - example: Enter description here + example: Feed containing all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' FeedDataWithURI: @@ -383,19 +425,67 @@ definitions: name: type: string description: The name of the feed. - example: Feed Name + example: My LabVIEW feed description: type: string description: A short description of the feed. - example: Enter description here + example: Feed containing all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' uri: type: string description: 'The path of the feed to replicate. Appending /Packages to the URI should yield the "Packages" file of the feed.' - example: '/path/to/feed' + example: "https://download.ni.com/support/nipkg/products/ni-l/ni-labview-nxg-3.0.0/6.4/released-critical" + FeedUrisAndIds: + type: object + description: Contains the list of URIs and the list of IDs for a group of feeds. + properties: + feedUris: + type: array + items: + type: string + description: The URI of a single feed. + example: "https://download.ni.com/support/nipkg/products/ni-l/ni-labview-nxg-3.0.0/6.4/released-critical" + feedIds: + type: array + items: + type: string + description: The ID of a single feed. + example: 5c62bf36781e2b1c7c57daf4 + FeedUriObject: + type: object + description: Contains the URI of a single feed. + properties: + feedUri: + type: string + example: /path/to/feed + description: The URI of a feed. + FeedNameAndUri: + type: object + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. + properties: + feedName: + type: string + description: The name of the feed. Feed names must begin with an alphabetical character and contain only alphanumeric characters, spaces, underscores, and hyphens. + example: "SystemLink 19.0" + name: + type: string + description: The name of this feed. + example: My LabVIEW feed + uri: + type: string + description: The path to the feed. + example: "https://download.ni.com/support/nipkg/products/ni-l/ni-labview-nxg-3.0.0/6.4/released-critical" + StoreItemRequest: type: object + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. properties: storeItemId: type: string @@ -412,11 +502,15 @@ definitions: feedName: type: string description: If "split" is false, the name of the feed which will be created. If "split" is true, this field is ignored. - example: Feed Name + example: My LabVIEW feed + name: + type: string + description: The name of this feed. + example: My LabVIEW feed description: type: string description: If "split" is false, the description of the feed which will be created. If "split" is true, this field is ignored. - example: Feed Description + example: Feed containing all the necessary packages for configuring LabVIEW 2015 StoreItem: type: object properties: @@ -448,6 +542,36 @@ definitions: type: array items: $ref: '#/definitions/StoreDownloadItems' + StoreItemsExtendedResponse: + type: object + description: Contains a list of StoreItem elements together with the coresponding paging information. + properties: + items: + type: array + items: + $ref: '#/definitions/StoreItem' + pageSize: + description: The number of the records contained by one page. Maximum is 1000. + type: number + example: 100 + pageNumber: + description: The number of the current page. + type: number + example: 5 + totalPages: + description: The total number of pages. + type: number + example: 20 + totalItems: + description: The total number of items. + type: number + example: 1975 + StoreItemResponse: + type: object + description: Contains a single StoreItem. + properties: + storeItem: + $ref: '#/definitions/StoreItem' StoreItemDescriptor: type: object properties: @@ -463,6 +587,14 @@ definitions: type: string description: Value uniquely identifying the specific store item installer to replicate. example: LABVIEWPKGBLDR10 + StoreItemDescriptorsObject: + type: object + description: An array of objects which describe which specific store items to replicate. + properties: + storeItemDescriptors: + type: array + items: + $ref: '#/definitions/StoreItemDescriptor' UpdateDescriptorRequest: type: object description: An array of update descriptors. @@ -472,7 +604,10 @@ definitions: items: $ref: '#/definitions/UpdateDescriptor' Feed: - description: A single feed. + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. type: object properties: id: @@ -482,7 +617,11 @@ definitions: feedName: type: string description: The name of this feed. - example: Feed Name + example: My LabVIEW feed + name: + type: string + description: The name of this feed. + example: My LabVIEW feed directoryUri: type: string description: The location of this feed. @@ -490,7 +629,7 @@ definitions: description: type: string description: The description of this feed. - example: Feed Description + example: Feed that contains all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' packageReferences: @@ -510,7 +649,7 @@ definitions: example: true Unauthorized: type: string - description: A not authorized response from a web page you use to log in. + description: A not authorized response from a web log in page. example: Web Page with login information. Feeds: description: An object containing an array of feeds. @@ -529,6 +668,156 @@ definitions: description: The ID of the job that was created for tracking the status of the operation. type: string example: "5c666def781e2b2f64208709" + PackageMetadata: + type: object + description: Information about the metadata of this package. + properties: + packageName: + type: string + description: The name of the package. + example: "ni-securityupdate-kb67l8lcqw-killbits" + version: + type: string + description: The version of the package. + example: "2.0.0.22-0+d22" + architecture: + type: string + description: The architecture of the package. + example: windows_x64 + breaks: + type: array + description: An array containing information about other packages this package breaks. + items: + type: string + description: The name of a package that this package breaks. This also contains information about the version of the package. + example: "ni-sysapi (>= 18.0.0)" + conflicts: + type: array + description: An array containing information about other packages this package conflicts with. + items: + type: string + description: The name of a package that this package conflicts with. This also contains information about the version of the package. + example: "ni-msvcrt-2015 (>= 14.1.4)" + depends: + type: array + description: An array containing information about other packages this package depends on. + items: + type: string + description: The name of a package that this package depends on. This also contains information about the version of the package. + example: "ni-metauninstaller (>= 18.0.1)" + description: + type: string + description: The description of the package. + example: This is an infrastructure package for NI Software. + enhances: + type: array + description: An array containing information about other packages this package enhances. + items: + type: string + description: The name of a package that this package enhances. This also contains information about the version of the package. + example: "ni-msiproperties (>= 18.0.1)" + essential: + type: boolean + description: Whether this package is essential. + example: true + fileName: + type: string + description: | + The location of the file, including the file extension. + Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds. + example: ni-securityupdate-kb67l8lcqw-killbits_2.0.0.22-0+d22_windows_x64.nipkg + homepage: + type: string + description: The website of the maintainers for this package. + example: "http://www.ni.com" + installedSize: + type: number + description: The size of this package after install. + example: 0 + maintainer: + type: string + description: The maintainer of this package. + example: "National Instruments " + predepends: + type: array + description: An array containing information about other packages this package predepends. + items: + description: The name of a package that this package predepends. This also contains information about the version of the package. + type: string + example: "ni-teststand-2017-tools (>= 17.0.0)" + priority: + type: number + description: The priority of the package. + example: 4 + provides: + type: array + description: An array containing information about other packages that this package provides. + items: + type: string + example: "ni-curl (= 17.0.0.49152-0+f0)" + description: One of the packages that the containing package provides. This also contains information about the version of the package. + recommends: + type: array + description: An array containing information about other packages this package recommends. + items: + type: string + description: The name of a package that this package recommends. This also contains information about the version of the package. + example: "ni-systemlink-client-2018.5-realtime-bin (>= 18.5.0)" + releaseNotes: + type: string + description: A page containing the release notes of the package. + example: Refer to the NI website at http://www.ni.com/r/slrm185 for installation instructions, known issues, bug fixes, compatibility information, and other important notices about this product. + replaces: + type: array + description: An array containing information about other packages this package replaces. + items: + type: string + description: The name of a package that this package replaces. This also contains information about the version of the package. + example: "b235b862-6a92-4a04-a8b2-6d71f777de67 (< 16.99.65535)" + section: + type: string + description: The section of the package. + example: Infrastructure + size: + type: number + description: The size of the package in bytes. + example: 750070 + source: + type: string + description: The source of this package, if any. + example: "thunar-archive-plugin_0.3.1.bb" + suggests: + type: array + description: An array containing information about other packages this package suggests. + items: + type: string + description: The name of a package that this package suggests. This also contains information about the version of the package. + example: "ni-systemlink-client-2018.5-realtime-bin (>= 18.5.0)" + tags: + type: string + description: Tags of the package. + example: "KillBits, Security Update 2013" + attributes: + type: object + description: Attributes of the package. + example: + Architecture: windows_x64 + Description: An infrastructure package for NI Software. + Filename: 71e47fbf-2782-4c10-873e-dba414213dc9.nipkg + Homepage: http://www.ni.com + MD5Sum: 672a667ca32b6915ae9a968c55f80825 + Maintainer: National Instruments + Package: ni-securityupdate-kb67l8lcqw-killbits + Priority: standard + Section: Infrastructure + Size: '750070' + Version: 2.0.0.22-0+d22 + XB-DisplayName: NI Security Update (KB 67L8LCQW) + XB-DisplayVersion: 2.0.0 + XB-LanguageSupport: en + XB-Plugin: wininst + XB-Tags: KillBits, Security Update 2013 + FileName: ni-securityupdate-kb67l8lcqw-killbits_2.0.0.22-0+d22_windows_x64.nipkg Package: description: A single package. type: object @@ -553,161 +842,19 @@ definitions: description: The date this package was last updated. example: "2016-11-02T22:26:33.668Z" metadata: - type: object - description: Information about the metadata of this package. - properties: - packageName: - type: string - description: The name of the package. - example: "ni-securityupdate-kb67l8lcqw-killbits" - version: - type: string - description: The version of the package. - example: "2.0.0.22-0+d22" - architecture: - type: string - description: The architecture of the package. - example: windows_x64 - breaks: - type: array - description: An array containing information about other packages this package breaks. - items: - type: string - description: The name of a package that this package breaks. This also contains information about the version of the package. - example: "ni-sysapi (>= 18.0.0)" - conflicts: - type: array - description: An array containing information about other packages this package conflicts with. - items: - type: string - description: The name of a package that this package conflicts with. This also contains information about the version of the package. - example: "ni-msvcrt-2015 (>= 14.1.4)" - depends: - type: array - description: An array containing information about other packages this package depends on. - items: - type: string - description: The name of a package that this package depends on. This also contains information about the version of the package. - example: "ni-metauninstaller (>= 18.0.1)" - description: - type: string - description: The description of the package. - example: This is an infrastructure package for NI Software. - enhances: - type: array - description: An array containing information about other packages this package enhances. - items: - type: string - description: The name of a package that this package enhances. This also contains information about the version of the package. - example: "ni-msiproperties (>= 18.0.1)" - essential: - type: boolean - description: Whether this package is essential. - example: true - fileName: - type: string - description: | - The location of the file, including the file extension. - Depending on the platform you select, you will be able to use the following package extensions: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds. - example: ni-securityupdate-kb67l8lcqw-killbits_2.0.0.22-0+d22_windows_x64.nipkg - homepage: - type: string - description: The website of the maintainers for this package. - example: "http://www.ni.com" - installedSize: - type: number - description: The size of this package after install. - example: 0 - maintainer: - type: string - description: The maintainer of this package. - example: "National Instruments " - predepends: - type: array - description: An array containing information about other packages this package predepends. - items: - description: The name of a package that this package predepends. This also contains information about the version of the package. - type: string - example: "ni-teststand-2017-tools (>= 17.0.0)" - priority: - type: number - description: The priority of the package. - example: 4 - provides: - type: array - description: An array containing information about other packages that this package provides. - items: - type: string - example: "ni-curl (= 17.0.0.49152-0+f0)" - description: One of the packages that the containing package provides. This also contains information about the version of the package. - recommends: - type: array - description: An array containing information about other packages this package recommends. - items: - type: string - description: The name of a package that this package recommends. This also contains information about the version of the package. - example: "ni-systemlink-client-2018.5-realtime-bin (>= 18.5.0)" - releaseNotes: - type: string - description: A page containing the release notes of the package. - example: Refer to the NI website at http://www.ni.com/r/slrm185 for installation instructions, known issues, bug fixes, compatibility information, and other important notices about this product. - replaces: - type: array - description: An array containing information about other packages this package replaces. - items: - type: string - description: The name of a package that this package replaces. This also contains information about the version of the package. - example: "b235b862-6a92-4a04-a8b2-6d71f777de67 (< 16.99.65535)" - section: - type: string - description: The section of the package. - example: Infrastructure - size: - type: number - description: The size of the package in bytes. - example: 750070 - source: - type: string - description: The source of this package, if any. - example: "thunar-archive-plugin_0.3.1.bb" - suggests: - type: array - description: An array containing information about other packages this package suggests. - items: - type: string - description: The name of a package that this package suggests. This also contains information about the version of the package. - example: "ni-systemlink-client-2018.5-realtime-bin (>= 18.5.0)" - tags: - type: string - description: Tags of the package. - example: "KillBits, Security Update 2013" - attributes: - type: object - description: Attributes of the package. - example: - Architecture: windows_x64 - Description: An infrastructure package for NI Software. - Filename: 71e47fbf-2782-4c10-873e-dba414213dc9.nipkg - Homepage: http://www.ni.com - MD5Sum: 672a667ca32b6915ae9a968c55f80825 - Maintainer: National Instruments - Package: ni-securityupdate-kb67l8lcqw-killbits - Priority: standard - Section: Infrastructure - Size: '750070' - Version: 2.0.0.22-0+d22 - XB-DisplayName: NI Security Update (KB 67L8LCQW) - XB-DisplayVersion: 2.0.0 - XB-LanguageSupport: en - XB-Plugin: wininst - XB-Tags: KillBits, Security Update 2013 - FileName: ni-securityupdate-kb67l8lcqw-killbits_2.0.0.22-0+d22_windows_x64.nipkg + $ref: '#/definitions/PackageMetadata' description: type: string description: Description of the package. example: Package Description. platform: $ref: '#/definitions/Platform' + PackageResponse: + description: Contains a single package. + type: object + properties: + package: + $ref: '#/definitions/Package' Packages: description: An object containing an array of packages. type: object @@ -717,6 +864,26 @@ definitions: type: array items: $ref: '#/definitions/Package' + PackageReferencesObject: + type: object + description: Points to the location of a package references array. + properties: + packageReferences: + type: array + items: + type: string + description: The reference of a package. + example: 5c62bf36781e2b1c7c57daf4 + PackageSourcesObject: + type: object + description: Points to the location of a package sources array. + properties: + packageSources: + type: array + items: + description: The source of a package. + type: string + example: https://nuget.org/api/v2/ UpdateDescriptorResponse: description: An array of update descriptors. type: array @@ -750,7 +917,7 @@ paths: 404: description: Service is down. 500: - description: The request encountered an error. + description: The request encountered an error. default: $ref: '#/definitions/Error' /v1/files/{pathToFile}: @@ -762,6 +929,7 @@ paths: required: true x-example: "filePath" get: + operationId: DownloadFiles x-ni-privilege: Download x-ni-operation: getResource tags: [files] @@ -775,7 +943,7 @@ paths: schema: type: file 404: - description: File not found. + description: File not found. default: $ref: '#/definitions/Error' /v1/files/packages/{pathToPackage}: @@ -787,6 +955,7 @@ paths: required: true x-example: "pathToPackage.extension" get: + operationId: DownloadFilesFromPackages x-ni-privilege: Download x-ni-operation: getResource tags: [files] @@ -800,31 +969,34 @@ paths: schema: type: file 404: - description: File not found. + description: File not found. default: $ref: '#/definitions/Error' /v1/feeds: get: + operationId: ListFeeds x-ni-privilege: Read x-ni-operation: getFeeds tags: [feeds] summary: List all feeds - description: Returns a JSON array of all of the feeds in the service. + description: Returns a JSON array of all the feeds in the service. parameters: - in: query name: omitPackageReferences type: boolean - required: false default: false - description: Whether the "packageReferences" array for each feed, which contains the ids of all of the packages in that feed, should be omitted. + description: Whether the "packageReferences" array for each feed, which contains the IDs of all of the packages in that feed, should be omitted. responses: 200: - $ref: '#/definitions/Feeds' + description: The request has succeeded. + schema: + $ref: '#/definitions/Feeds' 401: $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' post: + operationId: CreateFeed x-ni-privilege: Write x-ni-operation: createFeed tags: [feeds] @@ -841,18 +1013,19 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}: + /v1/feeds/{feedId}: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: GetFeed x-ni-privilege: Read x-ni-operation: getFeeds tags: [feeds] @@ -860,12 +1033,15 @@ paths: description: Returns a JSON representation of a feed. responses: 200: - $ref: '#/definitions/Feed' + description: The request has succeeded. + schema: + $ref: '#/definitions/Feed' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' delete: + operationId: DeleteFeed x-ni-privilege: Write x-ni-operation: deleteFeeds tags: [feeds] @@ -881,18 +1057,19 @@ paths: 202: $ref: '#/responses/JobIdResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/clone: + /v1/feeds/{feedId}/clone: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: CloneFeed x-ni-privilege: Write x-ni-operation: cloneFeed tags: [feeds] @@ -902,34 +1079,26 @@ paths: - in: body name: feedRequestData schema: - type: object - properties: - name: - type: string - description: The name for the cloned feed. - example: Feed Name - description: - type: string - description: A description for the cloned feed. - example: Feed Description + $ref: '#/definitions/FeedBasicData' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/packages: + /v1/feeds/{feedId}/packages: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: ListFeedPackages x-ni-privilege: Read x-ni-operation: getPackages tags: [feeds, packages] @@ -946,20 +1115,18 @@ paths: type: boolean description: Whether the array of feed reference will be omitted from each package. If true, they will be omitted. default: false - - in: query - name: returnUnreferencedOnly - type: boolean - description: A query parameter that determines whether only packages without referencing feeds should be returned. - default: false responses: 200: - $ref: '#/definitions/Packages' + description: The request has succeeded. + schema: + $ref: '#/definitions/Packages' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/replicate-feed: post: + operationId: ReplicateFeed x-ni-privilege: Write x-ni-operation: replicateFeed tags: [feeds] @@ -986,18 +1153,19 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/import-packages: + /v1/feeds/{feedId}/import-packages: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: ImportPackages x-ni-privilege: Write x-ni-operation: importPackages tags: [feeds, packages] @@ -1024,18 +1192,19 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/import-feeds: + /v1/feeds/{feedId}/import-feeds: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: ImportFeedsAlternative x-ni-privilege: Write x-ni-operation: importFeeds tags: [feeds] @@ -1045,48 +1214,35 @@ paths: - in: query name: shouldCleanSourceFeeds type: boolean - required: false description: A value indicating whether only the most recent version of every package in the source feed should be added to the destination feed. If true, only the most recent version of each package will be added. If false, all versions of each package will be added. default: true - in: query name: shouldOverwrite type: boolean - required: false description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. default: false - in: query name: ignoreImportErrors type: boolean - required: false description: A query parameter that determines whether the service should abort the request if errors occur while importing some packages. If true, the service will abort and roll back the request if an error occurs while importing a package. If false, the service will import as many packages as it can, and return an error describing which packages could not be imported. default: false - in: body name: feedUris description: An array containing the URIs of remote feeds whose packages should be added to the destination feed. Appending /Packages to each URI should yield the "Packages" file for that feed. schema: - type: object - properties: - feedUris: - type: array - items: - type: string - example: path/to/feed - feedIds: - type: array - items: - type: string - example: 5c62bf36781e2b1c7c57daf4 + $ref: '#/definitions/FeedUrisAndIds' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/packages: get: + operationId: ListPackages x-ni-privilege: Read x-ni-operation: getPackages tags: [packages] @@ -1116,36 +1272,24 @@ paths: items: $ref: '#/definitions/Package' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/packages/{id}: + /v1/packages/{packageId}: parameters: - in: path - name: id + name: packageId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: GetPackage x-ni-privilege: Read x-ni-operation: getPackages tags: [packages] summary: Get package details description: Get package details. - parameters: - - in: query - name: omitAttributes - type: boolean - description: If true, the "Attributes" dictionary for the package will be omitted. - default: false - required: false - - in: query - name: omitFeedReferences - type: boolean - description: If true, the array of feed references will be omitted from the package. - default: false - required: false responses: 200: description: | @@ -1154,29 +1298,34 @@ paths: Do not rely on all of these fields being available in any application as some may be null, empty, or nonexistent. However, key properties such as _id, name, owners, and FileName will never be null. schema: - type: object - properties: - package: - $ref: '#/definitions/Package' + $ref: '#/definitions/PackageResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' delete: + operationId: DeletePackage x-ni-privilege: Write x-ni-operation: deletePackage tags: [packages] summary: Remove a package description: Remove a package. The package will be removed from all of the feeds that reference it, potentially creating feeds with unsatisfied dependencies. + parameters: + - in: query + name: autoRemoveReferences + type: boolean + description: If true, the "References" will be automatically removed. + default: false responses: 202: $ref: '#/responses/JobIdResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/upload-packages: post: + operationId: UploadPackage x-ni-privilege: Write x-ni-operation: uploadPackage tags: [packages] @@ -1190,12 +1339,11 @@ paths: type: boolean description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. default: false - required: false - in: formData name: filename type: file required: true - description: The name of this parameter is the name of the file that will be uploaded. If the file you upload is test.ipkg, put instead of filename that name. + description: The name of this parameter is the name of the file that will be uploaded. If the uploaded file is test.ipkg, put instead of filename that name. - in: header name: X-File-Name type: string @@ -1216,34 +1364,24 @@ paths: type: string description: Contains the relative URI of the job that was created for tracking the status of the operation. Execute GET against this URI to get information about the status of the operation. schema: - type: object - properties: - jobIds: - type: array - items: - type: string - example: '5c66b6bd781e2b2ce42ca818' + $ref: '#/definitions/JobIdsResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/get-package-import-descriptors: post: + operationId: ObtainPackageImportDescriptorsFromFeedUri x-ni-privilege: Read x-ni-operation: getPackageImportDescriptors tags: [packages] - summary: Get package import descriptors - description: Route for getting a description of the packages in a remote feed. + summary: Returns the package import descriptors from the specified feed URI + description: Returns a list of PackageImportDescriptor objects based on the specified feed URI. parameters: - in: body name: feedUri schema: - type: object - properties: - feedUri: - type: string - example: /path/to/feed - description: The URI of the feed to get package import descriptors from. + $ref: '#/definitions/FeedUriObject' responses: 200: description: The request has succeeded. @@ -1252,18 +1390,19 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/metadata: + /v1/feeds/{feedId}/metadata: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" put: + operationId: UpdateFeed x-ni-privilege: Write x-ni-operation: getFeedMetadata tags: [feeds] @@ -1273,34 +1412,26 @@ paths: - in: body name: updateData schema: - type: object - properties: - name: - type: string - description: A string value representing the new name for the feed. Must be unique. - example: Feed Name - description: - type: string - description: A short description of the feed. If you want to clear the description for the feed, provide a null or empty value for the description key. - example: Feed Description + $ref: '#/definitions/FeedBasicData' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/add-package-references: + /v1/feeds/{feedId}/add-package-references: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: AddPackageReferences x-ni-privilege: Write x-ni-operation: addPackageReferences tags: [feeds, packages] @@ -1309,33 +1440,28 @@ paths: parameters: - in: body name: packageReferences - description: An array of the IDs of the packages to be added to the feed. + description: Array of IDs of the packages that are going to be added to the feed. schema: - type: object - properties: - packageReferences: - type: array - items: - type: string - example: 5c62bf36781e2b1c7c57daf4 + $ref: '#/definitions/PackageReferencesObject' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/remove-package-references: + /v1/feeds/{feedId}/remove-package-references: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: RemovePackageReferences x-ni-privilege: Write x-ni-operation: removePackageReferences tags: [feeds, packages] @@ -1345,38 +1471,32 @@ paths: - in: query name: deleteIfLastReference type: boolean - required: false description: A value indicating whether any packages that are no longer referenced after being removed from the feeds should be deleted. default: true - in: body name: packageReferences description: An array of package IDs to be removed from the feeds. schema: - type: object - properties: - packageReferences: - type: array - items: - type: string - example: 5c62bf36781e2b1c7c57daf4 + $ref: '#/definitions/PackageReferencesObject' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/import: + /v1/feeds/{feedId}/import: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: ImportFeeds x-ni-privilege: Write x-ni-operation: importFeeds tags: [feeds] @@ -1386,89 +1506,72 @@ paths: - in: query name: shouldCleanSourceFeeds type: boolean - required: false description: A value indicating whether only the most recent version of every package in the source feed should be added to the destination feed. If true, only the most recent version of each package will be added. If false, all versions of each package will be added. default: true - in: query name: shouldOverwrite type: boolean - required: false description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. default: false - in: query name: ignoreImportErrors type: boolean - required: false description: A query parameter that determines whether the service should abort the request if errors occur while importing some packages. If true, the service will abort and roll back the request if an error occurs while importing a package. If false, the service will import as many packages as it can, and return an error describing which packages could not be imported. default: false - in: body name: feeds description: An array containing the URIs of remote feeds whose packages should be added to the destination feed. Appending /Packages to each URI should yield the "Packages" file for that feed. schema: - type: object - properties: - feedUris: - type: array - items: - type: string - example: path/to/feed - feedIds: - type: array - items: - type: string - example: 5c62bf36781e2b1c7c57daf4 + $ref: '#/definitions/FeedUrisAndIds' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/update-check: + /v1/feeds/{feedId}/update-check: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: CheckForUpdates x-ni-privilege: Read x-ni-operation: checkForUpdates tags: [feeds] summary: Check for updates to a feed - description: Asynchronously checks for updates to a feed, based on the latest versions of the packages available in the package sources for that feed. Offers to upgrade packages in the feed to the latest version available, as well as add any new packages to the feed if new packages were added to the package sources. Returns the ID of a resource which can be queried to determine the status of the operation. Upon completion, the resource redirects to an array of UpdateDescriptor objects, describing the updates available for the feed. Remove any updates you don't want to apply, and then send the modified array to the "Apply updates to a feed" route below. + description: Asynchronously checks for updates to a feed, based on the latest versions of the packages available in the package sources for that feed. Offers to upgrade packages in the feed to the latest version available, as well as add any new packages to the feed if new packages were added to the package sources. Returns the ID of a resource which can be queried to determine the status of the operation. Upon completion, the resource redirects to an array of UpdateDescriptor objects, describing the updates available for the feed. Any routes that are not intended to be applied can be removed, and then send the modified array to the "Apply updates to a feed" route below. parameters: - in: body name: packageSources - description: An optional array of the IDs and/or external URIs of package sources which should be queried for updates. If not given, all of the feed's package sources will be checked. Package sources that are not present in the feed's array of package sources will be ignored. If you would like to add additional package sources to a feed, use the import route. + description: An optional array of the IDs and/or external URIs of package sources which should be queried for updates. If not given, all of the feed's package sources will be checked. Package sources that are not present in the feed's array of package sources will be ignored. Import route can be used for adding additional package sources. schema: - type: object - properties: - packageSources: - type: array - items: - type: string + $ref: '#/definitions/PackageSourcesObject' responses: 202: $ref: '#/responses/JobIdResponse' 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/update-apply: + /v1/feeds/{feedId}/update-apply: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: ApplyUpdates x-ni-privilege: Write x-ni-operation: applyUpdates tags: [feeds] @@ -1478,13 +1581,11 @@ paths: - in: query name: shouldOverwrite type: boolean - required: false description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. default: false - in: query name: ignoreImportErrors type: boolean - required: false description: A query parameter that determines whether the service should abort the request if errors occur while importing some packages. If true, the service will abort and roll back the request if an error occurs while importing a package. If false, the service will import as many packages as it can, and return an error describing which packages could not be imported. default: false - in: body @@ -1498,18 +1599,19 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/clean: + /v1/feeds/{feedId}/clean: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: CleanFeed x-ni-privilege: Write x-ni-operation: cleanFeed tags: [feeds] @@ -1519,18 +1621,19 @@ paths: 202: $ref: '#/responses/JobIdResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/feeds/{id}/import-store-items: + /v1/feeds/{feedId}/import-store-items: parameters: - in: path - name: id + name: feedId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" post: + operationId: ImportStoreItems x-ni-privilege: Write x-ni-operation: importStoreItems tags: [feeds, store] @@ -1539,20 +1642,14 @@ paths: parameters: - in: query name: shouldOverwrite - type: string - required: false - description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. + type: boolean + required: true + description: Determines if the existing packages with the same filename as the package to be added to the pool should be overwritten. default: false - in: body name: storeItemDescriptors schema: - type: object - description: A required array of objects which describe which specific store items to replicate. - properties: - storeItemDescriptors: - type: array - items: - $ref: '#/definitions/StoreItemDescriptor' + $ref: '#/definitions/StoreItemDescriptorsObject' responses: 202: $ref: '#/responses/JobIdResponse' @@ -1564,6 +1661,7 @@ paths: $ref: '#/definitions/Error' /v1/jobs: get: + operationId: ListJobs x-ni-privilege: Read x-ni-operation: listJobs tags: [jobs] @@ -1574,7 +1672,7 @@ paths: name: id type: string required: false - description: A comma-delimited list of job ids. + description: A comma-delimited list of job IDs. - in: query name: operation type: string @@ -1589,30 +1687,26 @@ paths: name: resourceId type: string required: false - description: A comma-delimited list of resource ids. + description: A comma-delimited list of resource IDs. responses: 200: description: The request has succeeded. schema: - type: object - properties: - jobs: - type: array - items: - $ref: '#/definitions/Job' + $ref: '#/definitions/JobsResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/jobs/{id}: + /v1/jobs/{jobId}: parameters: - in: path - name: id + name: jobId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: GetJob x-ni-privilege: Read x-ni-operation: getJobs tags: [jobs] @@ -1626,10 +1720,7 @@ paths: type: string description: Contains the relative URI of the job that was created for tracking the status of the operation. Execute a GET against this URI to get information about the status of the operation. schema: - type: object - properties: - job: - $ref: '#/definitions/Job' + $ref: '#/definitions/JobResponse' 303: description: If the job has completed, see Other with the Location header set to the URI of the created or modified resource. headers: @@ -1637,16 +1728,14 @@ paths: type: string description: Contains the relative URI of the job that was created for tracking the status of the operation. Execute a GET against this URI to get information about the status of the operation. schema: - type: object - properties: - job: - $ref: '#/definitions/Job' + $ref: '#/definitions/JobResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/can-write: get: + operationId: CheckWritePermission x-ni-privilege: Write x-ni-operation: canWrite tags: [misc] @@ -1656,18 +1745,19 @@ paths: 200: description: The request has succeeded. 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/updates/{id}: + /v1/updates/{updateDescriptorListId}: parameters: - in: path - name: id + name: updateDescriptorListId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: GetUpdateDescriptors x-ni-privilege: Read x-ni-operation: getUpdateDescriptors tags: [updates] @@ -1679,11 +1769,12 @@ paths: schema: $ref: '#/definitions/UpdateDescriptorResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/store/items: get: + operationId: QueryStoreItems x-ni-privilege: Read x-ni-operation: getStoreItems tags: [store] @@ -1694,48 +1785,36 @@ paths: name: query type: string description: A search string. E.g., "labview". - required: false + default: "" - in: query name: pageSize type: number description: How many results should be returned in the response. - required: false + default: 10 - in: query name: pageNumber type: number description: The page of the response to return. - required: false + default: 0 responses: 200: description: The request has succeeded. schema: - type: object - properties: - items: - type: array - items: - $ref: '#/definitions/StoreItem' - pageSize: - type: number - pageNumber: - type: number - totalPages: - type: number - totalItems: - type: number + $ref: '#/definitions/StoreItemsExtendedResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' - /v1/store/items/{id}: + /v1/store/items/{storeItemId}: parameters: - in: path - name: id + name: storeItemId description: The ID of this resource. type: string required: true x-example: "5c5d49f2781e2b2cd045267b" get: + operationId: GetStoreItem x-ni-privilege: Read x-ni-operation: getStoreItems tags: [store] @@ -1745,16 +1824,14 @@ paths: 200: description: The request has succeeded. schema: - type: object - properties: - storeItem: - $ref: '#/definitions/StoreItem' + $ref: '#/definitions/StoreItemResponse' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' /v1/replicate-store-item: post: + operationId: ReplicateStoreItem x-ni-privilege: Write x-ni-operation: replicateStoreItem tags: [store] @@ -1766,13 +1843,11 @@ paths: type: boolean description: A query parameter that determines if existing packages with the same filename as a package to be added to the pool should be overwritten. default: false - required: false - in: query name: split type: boolean description: A query parameter that determines if the store item should be merged into one feed, or if each feed in the store item should be copied into a separate feed. default: false - required: false - in: body name: feedRequest schema: @@ -1783,6 +1858,6 @@ paths: 400: $ref: '#/definitions/Error' 401: - $ref: '#/definitions/Unauthorized' + $ref: '#/definitions/Unauthorized' default: $ref: '#/definitions/Error' From d7c753eef2cb4c159bb8834d856a57617a6ff2ef Mon Sep 17 00:00:00 2001 From: Alex Weaver Date: Sun, 8 Dec 2019 22:33:34 +0000 Subject: [PATCH 004/108] Merged PR 50361: Incorporate feedback on Test Monitor swagger doc # Justification Incorporates feedback from an open API review into the Test Monitor swagger doc. # Implementation - Fixes a typo in the min/max descriptions of `ValueSummary` - Notes that path IDs may not be stable after a repair - Make defaults/minimums for `take` consistent across all routes. Chose a common value set that doesn't change behavior anywhere, but provides the most accurate documentation. # Testing Verified the generated documentation was correct. # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki --- test-monitor/nitestmonitor-v2.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index bc53516..dd8eaf9 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -662,11 +662,11 @@ definitions: type: $ref: '#/definitions/ValueType' min: - description: The minimum recorded value, if ValueType is "NUMBER." + description: The minimum recorded value, if `type` is "NUMBER." type: number example: 1.3 max: - description: The maximum recorded value, if ValueType is "NUMBER." + description: The maximum recorded value, if `type` is "NUMBER." type: number example: 2.6 PathResponseObject: @@ -674,7 +674,9 @@ definitions: type: object properties: id: - description: The unique ID of this path. + description: >- + The unique ID of this path. Note that this value may change if + the collection is repaired. type: string example: 507f191e810c19729de860ea path: @@ -763,7 +765,7 @@ definitions: type: integer format: int32 default: 1000 - minimum: 0 + minimum: -1 example: 1000 continuationToken: description: >- @@ -823,7 +825,7 @@ definitions: type: integer format: int32 default: 1000 - minimum: 0 + minimum: -1 example: 1000 continuationToken: description: >- @@ -899,7 +901,7 @@ definitions: type: integer format: int32 default: 1000 - minimum: 0 + minimum: -1 example: 1000 continuationToken: description: >- @@ -980,7 +982,7 @@ definitions: type: integer format: int32 default: 1000 - minimum: 0 + minimum: -1 example: 1000 continuationToken: description: >- @@ -1706,7 +1708,7 @@ paths: The maximum number of products to return. type: integer format: int32 - default: -1 + default: 1000 minimum: -1 - in: query name: returnCount @@ -1944,7 +1946,7 @@ paths: The maximum number of results to return. type: integer format: int32 - default: -1 + default: 1000 minimum: -1 - in: query name: returnCount @@ -2179,7 +2181,7 @@ paths: The maximum number of steps to return. type: integer format: int32 - default: -1 + default: 1000 minimum: -1 - in: query name: returnCount From 7bbafbd50d5fdf9c4c0c2c3d6cdc46a248d45754 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Tue, 10 Dec 2019 11:31:48 +0000 Subject: [PATCH 005/108] Merged PR 53533: Added error codes # Implementation Added Error codes from the repo web service. Implemented 'C ' http handlers. # Testing Tested using swagger. --- repo/nirepo.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 83f9775..8d72c01 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -388,8 +388,15 @@ definitions: example: false FeedBasicData: type: object - description: Contains the name and the description of a single feed. + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. properties: + feedName: + type: string + description: Name of the feed. + example: My LabVIEW feed name: type: string description: Name of the feed. @@ -421,7 +428,15 @@ definitions: $ref: '#/definitions/Platform' FeedDataWithURI: type: object + description: | + Only one of the 'name' and 'feedName' properties is requested. + There are both 'name' and 'feedName' for backwards compatibility. + The 'feedName' parameter will be considered if both of them are provided. properties: + feedName: + type: string + description: The name of this feed. + example: My LabVIEW feed name: type: string description: The name of the feed. From cb826643953b2bd3423f532643916f0cbe0e46b1 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Tue, 10 Dec 2019 16:16:12 +0000 Subject: [PATCH 006/108] Merged PR 53638: Implemented routes for http handling repo web service (part 4) # Implementation Implemented: - DeleteFeed - DeletePackage - GetPackage - GetFeed - GetStoreItem - ListPackages - QueryStoreItems Added: Model classes for Store Item handling Modified: yml models to contain the same info as the old web service # Testing Using swagger. --- repo/nirepo.yml | 65 ++++++++----------------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 8d72c01..c9df1c1 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -229,41 +229,14 @@ definitions: type: string description: The language the product supports. example: English - RepositoryInformation: - type: object - description: Contains information about one of the repositories where the packages of a product are located. - properties: - packageName: - type: string - description: The name of one of the packages. - example: ni-labview-nxg-2.0.0-2.1-released-critical - file: - type: string - description: | - The location of the file, including the file extension. - Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds. - example: "http://127.0.0.1/en/ni-labview-nxg-2.0.0-2.1-released-critical.nipkg" - md5Checksum: - description: The MD5 fingerprint of the file. - type: string - example: 233b2aa7d1c23cbef93874a7ecdce61a - repositoryPath: - type: string - description: The path to the repository where the package is found. - example: "http://download.ni.com/products/ni-labview-nxg-2.0.0/2.1/released-critical" - feedType: - type: string - enum: [RELEASED, RELEASED-CRITICAL] - description: The release type of the feed. - example: RELEASED SoftwareInformation: type: object description: Contains information about a piece of software that a store item contains. properties: storeItemId: - type: number + type: string description: The ID of this element. - example: 654 + example: "654" productName: type: string description: The name of one the products contained in the software suite. @@ -272,10 +245,10 @@ definitions: type: string description: A short description of the product. example: LabVIEW NXG enables engineers to quickly automate hardware, customize tests to project specifications, and easily view measurement results from anywhere. - updateDate: + downloadItemVersion: type: string - description: The last date this product was updated at. - example: '2018-01-23T14:33:29.000-06:00' + description: The item version number. + example: "2.1" packageName: type: string description: The name of the package to install. @@ -284,23 +257,11 @@ definitions: type: string description: The version of the package to install. example: 5.3.1.49156-0+f4 - architecture: - type: string - description: The architecture this product works on. - example: windows_x64 - preSelect: - type: string - description: The designation of whether the product will be automatically set to install. Select "yes" to preselect the product. - example: "yes" - repositories: + feeds: type: array - description: An array containing information about where to locate the repositories and packages to install them. + description: The feeds where the suite contents are located at. items: - $ref: '#/definitions/RepositoryInformation' - downloadItemVersion: - type: string - description: The item version number. - example: "2.1" + $ref: '#/definitions/FeedNameAndUri' StoreItemInstaller: type: object properties: @@ -858,12 +819,6 @@ definitions: example: "2016-11-02T22:26:33.668Z" metadata: $ref: '#/definitions/PackageMetadata' - description: - type: string - description: Description of the package. - example: Package Description. - platform: - $ref: '#/definitions/Platform' PackageResponse: description: Contains a single package. type: object @@ -1803,12 +1758,12 @@ paths: default: "" - in: query name: pageSize - type: number + type: integer description: How many results should be returned in the response. default: 10 - in: query name: pageNumber - type: number + type: integer description: The page of the response to return. default: 0 responses: From 5af085331396e5cd1221474eae010cf1dac39199 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Wed, 11 Dec 2019 14:59:30 +0000 Subject: [PATCH 007/108] Merged PR 53783: Implemented http request handlers for repo service part 5 # Justification Replace repo web service with generic web service. # Implementation Implemented http request handlers. # Testing Tested using swagger. --- repo/nirepo.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index c9df1c1..ac40e1c 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -1613,7 +1613,6 @@ paths: - in: query name: shouldOverwrite type: boolean - required: true description: Determines if the existing packages with the same filename as the package to be added to the pool should be overwritten. default: false - in: body From 409045e98b2aa2ef97460ab0866ae00004a70f32 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Mon, 16 Dec 2019 13:45:02 +0000 Subject: [PATCH 008/108] Merged PR 54242: Updated apm yml routes for availability history and comparison. # Justification We need to address the mismatches between the implementation and the specification of the routes. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index aa2ed02..ff7bd85 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -547,7 +547,7 @@ parameters: TimespanGranularity: in: query name: granularity - description: The possible granularities that can be used to obtain asset availability. + description: The possible granularities that can be used to obtain asset availability. WEEK is used when no granularity is specified. type: string enum: - NONE @@ -590,6 +590,8 @@ parameters: type: object required: - assetIds + - startDate + - endDate properties: assetIds: description: Multiple asset identifiers for which to compare availability history. @@ -603,8 +605,6 @@ parameters: This parameter is required to have the "ISO 8601" format in order to be considered valid. - If the parameter is not specified, the value will be set to the 1st day of the current month. - The time component of the request is ignored. type: string example: '2018-05-01T00:00:00.519Z' @@ -614,8 +614,6 @@ parameters: This parameter is required to have the "ISO 8601" format in order to be considered valid. - If the parameter is not specified, the value will be set to the current date in UTC. - The time component of the request is ignored. type: string example: '2018-05-20T00:00:00Z' @@ -1656,25 +1654,23 @@ paths: - $ref: '#/parameters/AssetId' - in: query name: startDate + required: true description: >- A date value which can be used to specify the beginning of a timespan. This parameter is required to have the "ISO 8601" format in order to be considered valid. - If the parameter is not specified, the value will be set to the 1st day of the current month. - The time component of the request is ignored. type: string x-example: '2018-05-01T00:00:00.519Z' - in: query name: endDate + required: true description: >- A date value which can be used to specify the end of a timespan. This parameter is required to have the "ISO 8601" format in order to be considered valid. - If the parameter is not specified, the value will be set to the current date in UTC. - The time component of the request is ignored. type: string x-example: '2018-05-20T00:00:00Z' From 84c33b6d0269acffa25a23a6c71a135f59a0275e Mon Sep 17 00:00:00 2001 From: Robert Mynio Date: Mon, 16 Dec 2019 13:49:07 +0000 Subject: [PATCH 009/108] Merged PR 54239: Fix for bug 949745 # Justification The SWAGGER doc says the "query-assets" route should work with "destination": "FILE_SERVICE" in the request body. It doesn't. # Implementation 1. Added EnumMember attribute to ResponseDestinationEnum 2. Updated the HttpController to return a better message than "MalformedJson" when the request body has an invalid combination of [ResponseFormat;Destination] 3. Updated the SWAGGER doc to describe what are the supported combinations of [ResponseFormat;Destination] # Testing 1. Validated from an HTTP Client 2. Create a unit test that verifies that the RequestCreationHelper correctly serializes "destination": "FILE_SERVICE". This is enough testing since the same RequestCreationHelper is used in our IntegrationTests (where the Asset service communicates with the FileIngestion service) # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #949745 --- asset-managment/niapm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index ff7bd85..b1556cf 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -691,7 +691,7 @@ parameters: QueryAssetsRequest: in: body name: queryAssets - description: Request body consisting of filters to apply when retrieving assets. + description: Request body consisting of filters to apply when retrieving assets. Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE] schema: title: Query Assets Request description: Object containing filters to apply when retrieving assets. From 0c7135e7984d00a55e83f4dad09bdbf8d4ca966f Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Mon, 16 Dec 2019 14:27:33 +0000 Subject: [PATCH 010/108] Merged PR 54251: Implement compare asset availability route # Justification Implement Swagger generated interface. # Implementation Implement compare asset availability route/method as described in swagger doc. # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #951066 --- asset-managment/niapm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index b1556cf..30b244e 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1842,8 +1842,8 @@ paths: 200: description: Asset availability comparison response containing availability history for requested assets based on the requested timespan. schema: - title: Asset Comparison Response - description: Asset comparison response containing availability history for the requested assets. If availability history could not be resolved for some assets, the response contains error information on the assets which could not be resolved. + title: Asset Availability Comparison Response + description: Asset availability comparison response containing availability history for the requested assets. If availability history could not be resolved for some assets, the response contains error information on the assets which could not be resolved. type: object properties: availabilityComparisons: From 393198767616f4a30e4e5ebbe45e61c5aff44e63 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Tue, 17 Dec 2019 09:19:32 +0000 Subject: [PATCH 011/108] Merged PR 54243: Solve returned values inconsistencies Keep the same signature of the functions. # Implementation Changed validation methods. # Testing Tested all the implemented routes. --- repo/nirepo.yml | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index ac40e1c..212bcfa 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -96,7 +96,8 @@ definitions: created: description: The date when the job was created. type: string - example: "2019-01-30T15:09:52.391Z" + format: date-time + example: '2019-02-11T13:32:06.030958Z' resourceId: description: The ID of the feed or package which this job created or modified. type: string @@ -165,7 +166,7 @@ definitions: $ref: '#/definitions/ErrorObject' Platform: type: string - enum: [WINDOWS, NI_LINUX_RT] + enum: [windows, ni_linux_rt] description: "Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds." example: windows PackageImportDescriptor: @@ -317,6 +318,7 @@ definitions: enum: - ADD - UPGRADE + default: ADD example: UPGRADE description: The operation type. fromVersion: @@ -528,19 +530,19 @@ definitions: $ref: '#/definitions/StoreItem' pageSize: description: The number of the records contained by one page. Maximum is 1000. - type: number + type: integer example: 100 pageNumber: description: The number of the current page. - type: number + type: integer example: 5 totalPages: description: The total number of pages. - type: number + type: integer example: 20 totalItems: description: The total number of items. - type: number + type: integer example: 1975 StoreItemResponse: type: object @@ -615,10 +617,18 @@ definitions: type: string description: The ID of a package. example: "5c652e1f781e2b05cc4d589e" + packageSources: + type: array + description: IDs and/or external URIs of package sources + items: + description: The source of a package. + type: string + example: https://download.ni.com/support/nipkg/products/idne/idnet-ad/17.5/released lastUpdated: type: string description: The date this feed was last updated at. - example: "2019-01-28T14:37:55.043000Z" + format: date-time + example: '2019-02-11T13:32:06.030958Z' ready: type: boolean description: If the job that creates this feed is complete. @@ -636,6 +646,12 @@ definitions: type: array items: $ref: '#/definitions/Feed' + FeedObject: + description: Contains a feed. + type: object + properties: + feed: + $ref: '#/definitions/Feed' JobID: description: An object containing the Job ID. type: object @@ -707,7 +723,7 @@ definitions: description: The website of the maintainers for this package. example: "http://www.ni.com" installedSize: - type: number + type: integer description: The size of this package after install. example: 0 maintainer: @@ -722,7 +738,7 @@ definitions: type: string example: "ni-teststand-2017-tools (>= 17.0.0)" priority: - type: number + type: integer description: The priority of the package. example: 4 provides: @@ -755,7 +771,7 @@ definitions: description: The section of the package. example: Infrastructure size: - type: number + type: integer description: The size of the package in bytes. example: 750070 source: @@ -816,7 +832,8 @@ definitions: lastUpdated: type: string description: The date this package was last updated. - example: "2016-11-02T22:26:33.668Z" + format: date-time + example: '2019-02-11T13:32:06.030958Z' metadata: $ref: '#/definitions/PackageMetadata' PackageResponse: @@ -849,6 +866,7 @@ definitions: description: Points to the location of a package sources array. properties: packageSources: + description: IDs and/or external URIs of package sources type: array items: description: The source of a package. @@ -1005,7 +1023,7 @@ paths: 200: description: The request has succeeded. schema: - $ref: '#/definitions/Feed' + $ref: '#/definitions/FeedObject' 401: $ref: '#/definitions/Unauthorized' default: From 9fc1e09457cd0e81d6676d36676256a38e070aa3 Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Tue, 17 Dec 2019 15:37:49 +0000 Subject: [PATCH 012/108] Merged PR 53907: Introduce org modeling/workspace in States HTTP API Add workspace to models and change routes. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-state/nisystemsstate.yml | 63 ++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/systems-state/nisystemsstate.yml b/systems-state/nisystemsstate.yml index 576b84d..ad9a016 100644 --- a/systems-state/nisystemsstate.yml +++ b/systems-state/nisystemsstate.yml @@ -1,6 +1,6 @@ swagger: '2.0' info: - description: "Creates and manages states you can apply applied to managed systems." + description: "Creates and manages states you can apply to managed systems." version: "1" title: "SystemLink Systems State Manager" contact: @@ -299,6 +299,10 @@ definitions: type: string format: date-time example: '2018-05-07T18:58:05.219692Z' + workspace: + type: string + description: The ID of the workspace. This property is available starting with version 3 of the getStates operation. + example: '5bc5e9092a4fa4c71cfa7197' required: - id - name @@ -307,6 +311,7 @@ definitions: - architecture - createdTimestamp - lastUpdatedTimestamp + - workspace StateDescriptionListResponse: description: The response containing a list of state metadata. @@ -330,6 +335,7 @@ definitions: architecture: x64 createdTimestamp: '2018-05-07T18:58:05.219692Z' lastUpdatedTimestamp: '2018-05-07T18:58:05.219692Z' + workspace: '5bc5e9092a4fa4c71cfa7197' - id: '5bcde471fc13379595ce9b13' name: emacs description: Having Emacs installed on the windows system. @@ -337,6 +343,7 @@ definitions: architecture: x86 createdTimestamp: '2018-05-07T18:58:05.219692Z' lastUpdatedTimestamp: '2018-05-07T18:58:05.219692Z' + workspace: '5bc5e9092a4fa4c71cfa7198' required: - totalCount - states @@ -366,6 +373,10 @@ definitions: type: array items: $ref: '#/definitions/Package' + workspace: + type: string + description: The ID of the workspace. This property is available starting with version 3 of the createOrUpdateStates operation. + example: '5bc5e9092a4fa4c71cfa7197' required: - name - distribution @@ -401,6 +412,10 @@ definitions: type: string description: Description of the change operation. example: I've changed the state + workspace: + type: string + description: The ID of the workspace. This property is available starting with version 3 of the createOrUpdateStates operation. + example: '5bc5e9092a4fa4c71cfa7197' StateResponse: description: System state object. @@ -449,6 +464,10 @@ definitions: type: boolean description: Whether the state contains extra operations in addition to feeds and packages. example: true + workspace: + type: string + description: The ID of the workspace. This property is available starting with version 3 of the getStates operation. + example: '5bc5e9092a4fa4c71cfa7197' required: - id - name @@ -458,6 +477,7 @@ definitions: - createdTimestamp - lastUpdatedTimestamp - containsExtraOperations + - workspace StateVersion: description: A given version of a state. @@ -550,11 +570,11 @@ paths: /: get: operationId: HandleGetVersionInfo - x-ni-request-all-privileges: true + x-ni-auth: true summary: API information tags: [versioning] security: [] - description: Gets permissions and operations for the States Service. + description: Gets permissions and operations for the States Service. This API now includes organizational modeling, starting with version 3 of getStates and createOrUpdateStates operations. This route doesn't return granular permissions, but the operation is available if the current user has the corresponding access to at least one resource, regardless of the workspace. We recommend using the User Service API instead. responses: 200: description: OK @@ -573,9 +593,9 @@ paths: /{version}: get: operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true + x-ni-auth: true summary: API version information - description: Returns available operations for a single version of the API. + description: Returns available operations for a single version of the API. This API now includes organizational modeling, starting with version 3 of getStates and createOrUpdateStates operations. This route doesn't return granular permissions, but the operation is available if the current user has the corresponding access to at least one resource, regardless of the workspace. We recommend using the User Service API instead. tags: [versioning] security: [] parameters: @@ -597,7 +617,7 @@ paths: /v1/states: get: operationId: GetStates - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [states] summary: Get all system states @@ -626,7 +646,7 @@ paths: $ref: '#/responses/Error' post: operationId: CreateState - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: createOrUpdateStates tags: [states] summary: Create a new system state @@ -654,11 +674,11 @@ paths: /v1/states/{id}: get: operationId: GetState - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [states] summary: Get system state - description: Returns the metadata, feeds, and packages from the state content. If the state contains only feed and package entries, the containsExtraOperations property of the response will be false. Otherwise, it will be true. You may use the export route to get all state content. + description: Returns the metadata, feeds, and packages from the state content. If the state contains only feed and package entries, the containsExtraOperations property of the response will be false. You may use the export route to get all state content. parameters: - name: id in: path @@ -678,7 +698,7 @@ paths: $ref: '#/responses/Error' patch: operationId: UpdateState - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: createOrUpdateStates consumes: - application/merge-patch+json @@ -714,7 +734,7 @@ paths: $ref: '#/responses/Error' delete: operationId: DeleteState - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: deleteStates tags: [states] summary: Delete state @@ -737,7 +757,7 @@ paths: /v1/replace-state-content: post: operationId: ReplaceContent - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: createOrUpdateStates tags: [states] summary: Replace the content of a state @@ -775,7 +795,7 @@ paths: /v1/states/{id}/history: get: operationId: GetStateHistory - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [history] summary: Get state history @@ -812,11 +832,11 @@ paths: /v1/states/{id}/history/{version}: get: operationId: GetStateVersion - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [history] summary: Get state by version - description: Returns the snapshot of a state at a specific version. Returns the metadata, feeds, and packages from the state content. If the state contains only feed and package entries, the containsExtraOperations property of the response will be false. Otherwise, it will be true. You may use the export route to get all state content. + description: Returns the snapshot of a state at a specific version. Returns the metadata, feeds, and packages from the state content. If the state contains only feed and package entries, the containsExtraOperations property of the response will be false. You may use the export route to get all state content. parameters: - name: id in: path @@ -842,7 +862,7 @@ paths: /v1/export-state: post: operationId: ExportState - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [states] summary: Export a state @@ -873,7 +893,7 @@ paths: /v1/import-state: post: operationId: ImportState - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: createOrUpdateStates tags: [states] summary: Import a state @@ -907,6 +927,9 @@ paths: - x64 - x86 required: true + - in: formData + name: workspace + type: string responses: 201: description: Created @@ -923,7 +946,7 @@ paths: /v1/export-state-from-system: post: operationId: ExportStateFromSystem - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStates tags: [states] summary: Export the state of a system by providing its ID. @@ -954,7 +977,7 @@ paths: /v1/delete-states: post: operationId: DeleteStates - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: deleteStates tags: [states] summary: Delete states @@ -984,7 +1007,7 @@ paths: /v1/revert-state-version: post: operationId: RevertStateToVersion - x-ni-privilege: nisystemsstate.Write + x-ni-auth: true x-ni-operation: createOrUpdateStates tags: [history] summary: Revert a state From f3cdff02f5b71f6aff516070ff3db1e0bd816cd9 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 18 Dec 2019 11:58:37 +0000 Subject: [PATCH 013/108] Merged PR 54271: Implement delete assets route # Justification Implement Swagger generated interface # Implementation Implement delete assets method. Added a result object to be returned by the assets facade. This object is needed to be able to create the errors to be returned by the route. The object contains the ids of the deleted assets, the invalid ids and the not existing asset ids. # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #947903 --- asset-managment/niapm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 30b244e..0b9c58c 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1877,8 +1877,6 @@ paths: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/query-asset-utilization: From 2da4432a58ba748b84364bff88d1bfa4c8af3413 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 18 Dec 2019 14:02:16 +0000 Subject: [PATCH 014/108] Merged PR 54535: Implement RootEndpoint and RootEndpointWithVersion routes # Justification Implement Swagger interfaces. # Implementation Implement the 2 methods and write tests. # Testing Ran all unit tests and validated in VM. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #952192 --- asset-managment/niapm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 0b9c58c..a26a582 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1885,7 +1885,7 @@ paths: summary: Query Asset Utilization description: Retrieves asset utilization matching the provided filters. operationId: read-asset-utilization - x-ni-operation: readAssetUtilization + x-ni-operation: readAssets x-ni-privilege: Read parameters: - $ref: '#/parameters/QueryAssetUtilizationRequest' @@ -1906,7 +1906,7 @@ paths: summary: Query Asset Utilization Historical Data description: Retrieves historical asset utilization data matching the provided filters. An empty request body queries all historical asset utilization data. operationId: query-asset-utilizations - x-ni-operation: readAssetUtilization + x-ni-operation: readAssets x-ni-privilege: Read parameters: - $ref: '#/parameters/QueryAssetUtilizationHistoryRequest' From eaff481d43a95ec407bf97aea83afdb30e577ffb Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 19 Dec 2019 07:43:52 +0000 Subject: [PATCH 015/108] Merged PR 50642: Add workspace field to nitag API Added the workspace to the tag metadata so that tag path + workspace form now the unique key. Tags paths are only unique within their workspace. All create routes take an optional workspace field. If not specified, the default workspace is assumed which should allow us to preseve backwards compatibility. The query routes allow the caller to query across all workspaces they have access to. Routes which only have the tag path in the url will target the default workspace and I have added an "overload" for the route to take also theworkspace, e.g. - GET /nitag/v1/tags/my-tag-path --> returns the tag from the default workspace (if exists) - GET /nitag/v1/tags/workspace-x/my-tag-path --> searches the tag in workspace-x Selections and Subscriptions are only allowed within a single workspace. --- tag/nitag.yml | 254 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 250 insertions(+), 4 deletions(-) diff --git a/tag/nitag.yml b/tag/nitag.yml index ebfc674..331c19a 100644 --- a/tag/nitag.yml +++ b/tag/nitag.yml @@ -910,6 +910,12 @@ paths: description: Number of entries to include in the response list. Typically used in combination with the skip parameter to implement pagination. type: integer default: 100000 + - in: query + name: workspace + description: Workspace to search for tags + type: string + required: false + x-example: "b71390c0-977b-4153-a939-487b0b7a1fa5" responses: 200: $ref: '#/responses/GetTagsResponse' @@ -981,12 +987,47 @@ paths: description: Number of entries to include in the response list. Typically used in combination with the skip parameter to implement pagination. type: integer default: 100000 - /v2/tags-with-values/{path}: + - in: query + name: workspace + description: Workspace to search for tags + type: string + required: false + x-example: "b71390c0-977b-4153-a939-487b0b7a1fa5" + /v2/tags-with-values/{workspace}/{path}: get: tags: - tags description: Get a tag and its value summary: Returns a tag and its current value + operationId: GetTagWithValueInWorkspace + parameters: + - in: path + name: workspace + type: string + required: true + x-example: "b71390c0-977b-4153-a939-487b0b7a1fa5" + - in: path + name: path + type: string + required: true + x-example: my-tag-1 + responses: + 200: + schema: + $ref: '#/definitions/TagWithValue' + description: Success + 400: + description: Bad Request + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /v2/tags-with-values/{path}: + get: + tags: + - tags + description: Get a tag and its value from the default workspace + summary: Returns a tag and its current value operationId: GetTagWithValue parameters: - in: path @@ -1075,13 +1116,41 @@ paths: tags: - tags summary: Get the aggregates and current value of a tag - description: Returns the current aggregate values for the tag at the path. + description: Returns the current aggregate values for the tag at the path from the default workspace. operationId: GetTagValues parameters: - in: path name: path type: string required: true + x-example: my-tag-1 + responses: + 200: + description: Success + schema: + $ref: '#/definitions/TagCurrentAndAggregateValue' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /v2/tags/{workspace}/{path}/values: + get: + tags: + - tags + summary: Get the aggregates and current value of a tag + description: Returns the current aggregate values for the tag at the path. + operationId: GetTagValuesInWorkspace + parameters: + - in: path + name: workspace + type: string + required: true + x-example: "b71390c0-977b-4153-a939-487b0b7a1fa5" + - in: path + name: path + type: string + required: true + x-example: my-tag-1 responses: 200: description: Success @@ -1288,7 +1357,7 @@ paths: tags: - tag aggregates summary: Reset the aggregates of a tag - description: Resets aggregate values for a tag. + description: Resets aggregate values for a tag from the default workspace. operationId: ResetTagAggregates parameters: - in: path @@ -1296,6 +1365,35 @@ paths: description: Tag path type: string required: true + x-example: my-tag-1 + responses: + 200: + description: Success + 204: + description: No content (Sent only from SystemLink Server) + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /v2/tags/{workspace}/{path}/reset-aggregates: + post: + tags: + - tag aggregates + summary: Reset the aggregates of a tag + description: Resets aggregate values for a tag. + operationId: ResetTagAggregatesInWorkspace + parameters: + - in: path + name: workspace + type: string + required: true + x-example: "b71390c0-977b-4153-a939-487b0b7a1fa5" + - in: path + name: path + description: Tag path + type: string + required: true + x-example: my-tag-1 responses: 200: description: Success @@ -1413,6 +1511,87 @@ paths: schema: $ref: '#/definitions/TagQuery' required: true + /v2/tags/{workspace}/{path}: + put: + tags: + - tags + summary: Create or replace a tag in the given workspace + description: Replaces the tag at the location path specifies. If a tag does not exist where the path specifies, one is created. + operationId: CreateOrReplaceTagInWorkspace + parameters: + - in: path + name: workspace + description: Workspace + type: string + required: true + - in: path + name: path + description: Tag path + type: string + required: true + - in: body + name: tag + description: Tag to create or replace. A complete resource representation must be sent (no partial updates). + schema: + $ref: '#/definitions/Tag' + required: true + responses: + 201: + description: 'Created: Tag created successfully' + 204: + description: 'No Content: Tag replaced successfully' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + get: + tags: + - tags + summary: Get a tag from the given workspace + description: Returns the metadata for a tag. + operationId: GetTagInWorkspace + parameters: + - in: path + name: workspace + description: Workspace + type: string + required: true + - in: path + name: path + description: Tag path + type: string + required: true + responses: + 200: + description: Success + schema: + $ref: '#/definitions/Tag' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + delete: + tags: + - tags + summary: Delete a tag from the given workspace + description: Deletes a tag + operationId: DeleteTagInWorkspace + parameters: + - in: path + name: workspace + description: Workspace + type: string + required: true + - in: path + name: path + description: Tag path + type: string + required: true + responses: + 204: + description: 'No content: Tag deleted successfully' + default: + $ref: '#/responses/Error' definitions: Error: @@ -1502,6 +1681,12 @@ definitions: count: description: Count value from the tag's aggregates type: integer + workspace: + type: string + example: + path: foo + count: 1 + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithCurrentAndAggregateValue: description: Tag path with its current value and aggregates type: object @@ -1513,6 +1698,8 @@ definitions: $ref: '#/definitions/TimestampedTagValue' aggregates: $ref: '#/definitions/V2TagAggregates' + workspace: + type: string example: path: foo current: @@ -1524,6 +1711,7 @@ definitions: max: "5.0" avg: 2.0 count: 5 + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithTimestampedValue: description: Tag path with timestamped value type: object @@ -1534,6 +1722,16 @@ definitions: description: Tag path current: $ref: '#/definitions/TimestampedTagValue' + workspace: + type: string + example: + path: foo + current: + value: + type: DOUBLE + value: "3.14" + timestamp: '2018-09-04T18:45:08Z' + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithValue: description: Tag path with value type: object @@ -1544,6 +1742,14 @@ definitions: description: Tag path current: $ref: '#/definitions/TagValue' + workspace: + type: string + example: + path: foo + current: + type: DOUBLE + value: "3.14" + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithTimestamp: type: object title: Tag Path with Timestamp @@ -1556,6 +1762,12 @@ definitions: example: '2018-09-04T18:45:08Z' path: type: string + workspace: + type: string + example: + timestamp: '2018-09-04T18:45:08Z' + path: foo + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithMaxAggregate: type: object title: Tag Path With Max Aggregate @@ -1565,6 +1777,12 @@ definitions: max: description: Maximum value from the tag's aggregates type: string + workspace: + type: string + example: + path: foo + max: "1" + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithMinAggregate: type: object title: Tag Path with Min Aggregate @@ -1574,6 +1792,12 @@ definitions: min: description: Minimum value from the tag's aggregates type: string + workspace: + type: string + example: + path: foo + min: "1" + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagPathWithMeanAggregate: type: object title: Tag Path with Mean Aggregate @@ -1584,6 +1808,12 @@ definitions: description: Mean value from the tag's aggregates type: number format: double + workspace: + type: string + example: + path: foo + avg: 1 + workspace: "f0144202-52d5-4861-98fa-615ed4b2f751" TagQuery: type: object title: Tag Query @@ -1631,13 +1861,15 @@ definitions: - keywords: Tag keywords. Example: keywords.Contains(x) - properties: Tag properties. Example: properties['x'] = 'y' + + - workspace : The workspace of the tags. Example: 88974b87-07d4-4f84-b54f-48eec89b11ed orderBy: description: >- The tag value property to order results by; value and timestamp are from the current tag value. When ordering by value, tags will be grouped by type, first numbers (INT, DOUBLE, U_INT64), then strings, then booleans, then times. Null values will be at the end of the list regardless of type. type: string - enum: [PATH, VALUE, TIMESTAMP] + enum: [PATH, VALUE, TIMESTAMP, WORKSPACE] default: PATH descending: description: A Boolean that determines whether to return the tags in descending order @@ -1767,6 +1999,8 @@ definitions: type: string collectAggregates: type: boolean + workspace: + type: string example: type: DOUBLE properties: @@ -1775,6 +2009,7 @@ definitions: path: foo keywords: [fooKeyword, barKeyword] collectAggregates: true + workspace: "10e020d7-64df-45e9-b717-c537f374ca2f" TagUpdate: description: Object containing a tag's path, and one or more values to update the tag with at times you specify. type: object @@ -1787,6 +2022,8 @@ definitions: type: array items: $ref: '#/definitions/TimestampedTagValue' + workspace: + type: string example: path: foo updates: @@ -1798,6 +2035,7 @@ definitions: type: DOUBLE value: "5.0" timestamp: '2018-09-04T18:45:08Z' + workspace: "bbcd6db8-10f6-4caf-af28-81157b741a5a" V1SubscriptionUpdate: description: Updates for a subscriptions type: object @@ -1942,10 +2180,14 @@ definitions: alias: description: Name of the subscription type: string + workspace: + description: Workspace of the tags to subscribe to + type: string example: updatesOnly: true tags: [tag1, tag2, tag3] alias: foo + workspace: "3e884a30-5623-4403-932b-375a715ef065" SubscriptionIds: type: object properties: @@ -1971,7 +2213,11 @@ definitions: default: 900 id: type: string + workspace: + description: Workspace of the tags to select + type: string example: searchPaths: [tag1, tag2, tag3] inactivityTimeout: 1000 id: 22520497-e85b-427f-980c-ca328fc72f75 + workspace: "3e884a30-5623-4403-932b-375a715ef065" From 35eb0b6a0c5ad405cc73ac409168127a7c7a87da Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Thu, 19 Dec 2019 08:29:13 +0000 Subject: [PATCH 016/108] Merged PR 54544: Implement get asset calibration history route # Justification Implement Swagger generated interface # Implementation Implement the get asset calibration history route. Added tests to cover all cases of success, bad request, resource not found and internal error. Moved 2 classes to infrastructure as they are used through multiple layers. # Testing Ran all unit tests and check in validation VM. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #952202 --- asset-managment/niapm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index a26a582..021d06c 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -561,7 +561,7 @@ parameters: required: true x-example: "29162;01B245D6;4243;0" Skip: - in: path + in: query name: skip description: The number of resources to skip in the result when paging. @@ -571,7 +571,7 @@ parameters: required: true x-example: 0 Take: - in: path + in: query name: take description: How many resources to return in the result, or -1 to use a default From 70487c226fed6bc7bc1446d8710c6d5c236d8f2b Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Thu, 19 Dec 2019 15:40:48 +0000 Subject: [PATCH 017/108] Merged PR 54654: Implement GetAssetWithIdentifier route # Justification Implement Swagger routes. # Implementation Implement the route. Add tests. Add necessary mappings. # Testing Ran all tests. Validated in Swagger VM. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #952684 --- asset-managment/niapm.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 021d06c..0e8c01b 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -199,7 +199,7 @@ definitions: description: The status of an asset and the system to which it is connected. type: object properties: - systemConnectionState: + systemConnection: $ref: '#/definitions/SystemConnectionState' assetPresence: $ref: '#/definitions/AssetPresenceStatus' @@ -244,7 +244,7 @@ definitions: description: Hostname of the system. type: string example: APM-PXI1 - state: + assetState: $ref: '#/definitions/AssetStateModel' ExternalCalibrationOperatorModel: title: External Calibration Operator @@ -262,7 +262,7 @@ definitions: description: Contains data from the last self-calibration. type: object required: - - date + - calibrationDate properties: temperatureSensors: description: An array of temperature sensor information. @@ -273,7 +273,7 @@ definitions: description: Whether the last self-calibration of the asset was a limited calibration. type: boolean example: false - date: + calibrationDate: description: ISO-8601 formatted timestamp specifying the last date the asset was self-calibrated. type: string format: date-time @@ -283,7 +283,7 @@ definitions: description: Data for an external calibration entry. type: object required: - - date + - calibrationDate - recommendedInterval - nextRecommendedDate - temperatureSensors @@ -297,7 +297,7 @@ definitions: description: Whether the last external calibration of the asset was a limited calibration. type: boolean example: false - date: + calibrationDate: description: ISO-8601 formatted timestamp specifying the last date the asset was externally calibrated. type: string format: date-time @@ -362,7 +362,7 @@ definitions: description: Vendor number of the asset. type: integer example: 4244 - name: + assetName: description: Name of the asset. type: string example: PCISlot2 @@ -380,7 +380,7 @@ definitions: description: VISA resource name of the asset. type: string example : vs-1234 - assetLocation: + location: $ref: '#/definitions/AssetLocationModel' temperatureSensors: description: An array of temperature sensor information. @@ -401,7 +401,7 @@ definitions: $ref: '#/definitions/ExternalCalibrationModel' calibrationStatus: $ref: '#/definitions/CalibrationStatus' - lastUpdatedTimestamp: + lastUpdatedDate: description: ISO-8601 formatted timestamp specifying the last date that the asset has had a property update. type: string format: date-time From 33a234de2068ef61f72659c619fb9d832deda04f Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Fri, 20 Dec 2019 08:00:54 +0000 Subject: [PATCH 018/108] Merged PR 53912: Introduce org modeling/workspace in Systems Management HTTP API # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-management/nisysmgmt.yml | 78 ++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index b47a4b8..21fc508 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -210,6 +210,13 @@ definitions: description: Whether to activate the systems or not. default: false example: true + workspaces: + description: List containing the corresponding workspace for each system credential information. + type: array + items: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' required: [systemsCredentials] SystemCredentials: @@ -691,6 +698,10 @@ definitions: description: The alias of the system. type: string example: testVM + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' activation: description: Activation information. type: object @@ -846,7 +857,7 @@ definitions: example: owner: admin required: [lastUpdatedTimestamp, data] - required: [id, createdTimestamp, lastUpdatedTimestamp, connected] + required: [id, createdTimestamp, lastUpdatedTimestamp, connected, workspace] ReportType: title: Report Type @@ -1040,6 +1051,10 @@ definitions: type: string description: A string representing the public authorization key. If this field is specified, verification that the system ID is associated with this auth key will happen before the desired action is executed. example: -----BEGIN PUBLIC KEY-----↵MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlFgEKiRwWBD/QSDHCpNQ↵Zml9q224YzIxG6reByDV16BNsQoH0lc2bT9LZ7o6xf6dTpQl7shIMc/abSAcl4/F↵VpKguH1yRmOG2Nhout/9wMP6kYBTlThzpop93rlxIo/I7nDkQDz07cMhNWYDvrut↵PVnjRg70xOCAzQRCHRy4GW3TLvfp2WAbCuoQ5oPHQLx+YBSRYDcgfo9jiW8vNzt4↵Bcg72c2PmHEJjGslzJeqcKdRjK0z4/VFgLYfMUBz4LCoy7DohU/uc9ZbHSlOy/BK↵1/S8O1vUyk8DEq+/kQumJWKh1Cl0SWcZGSDkdhQhoTiWqXGb1BBtU7vkxYgQoYjM↵rwIDAQAB↵-----END PUBLIC KEY----- + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' required: [id, action] required: [keyActions] @@ -1068,6 +1083,10 @@ definitions: description: The new alias of the system. type: string example: testVM + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' QueryAvailablePackagesRequest: title: Get Available Packages Request @@ -1626,7 +1645,7 @@ paths: /: get: operationId: HandleGetVersionInfo - x-ni-request-all-privileges: true + x-ni-auth: true summary: API information tags: [versioning] security: [] @@ -1649,7 +1668,7 @@ paths: /{version}: get: operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true + x-ni-auth: true summary: API version information description: Returns available operations for a single version of the API. tags: [versioning] @@ -1674,9 +1693,9 @@ paths: post: operationId: CreateJob x-ni-auth: true - x-ni-privilege: Write x-ni-operation: createOrCancelJobs x-ni-request-timeout: 300000 + x-ni-request-variables: [REMOTE_USER, USER_NAME] tags: [jobs] summary: Create a job description: Create a job and returns the newly created job including the job ID. @@ -1700,7 +1719,7 @@ paths: $ref: '#/responses/Error' get: operationId: GetJobs - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getJobs x-ni-request-timeout: 120000 tags: [jobs] @@ -1741,7 +1760,7 @@ paths: /v1/systems: get: operationId: GetSystems - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems x-ni-request-timeout: 120000 tags: [systems] @@ -1769,7 +1788,7 @@ paths: /v1/register-systems: post: operationId: RegisterSystems - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: manageSystems tags: [systems] summary: Register systems @@ -1795,9 +1814,10 @@ paths: /v1/remove-systems: post: operationId: UnregisterSystems - x-ni-privilege: Write + x-ni-auth: true x-ni-request-timeout: 180000 x-ni-operation: manageSystems + x-ni-request-variables: [REMOTE_USER, USER_NAME] tags: [systems] summary: Unregister Systems description: Request to unregister systems. @@ -1823,10 +1843,8 @@ paths: post: operationId: CancelJobs x-ni-auth: true - x-ni-privilege: Write x-ni-operation: createOrCancelJobs x-ni-request-timeout: 120000 - x-ni-request-variables: [REMOTE_USER, USER_NAME] tags: [jobs] summary: Cancel jobs description: Cancel jobs that are running on systems. This won't stop the jobs from executing on systems if the jobs have already been dispatched to the systems. @@ -1855,7 +1873,7 @@ paths: /v1/activate-systems: post: operationId: ActivateSystems - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: activateSystems x-ni-request-timeout: 120000 tags: [systems] @@ -1889,7 +1907,7 @@ paths: /v1/get-discovered-systems: get: operationId: GetDiscoveredSystems - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems tags: [systems] summary: Get discovered systems @@ -1908,7 +1926,7 @@ paths: /v1/get-systems-summary: get: operationId: GetSystemsSummary - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems tags: [systems] summary: Get systems summary @@ -1925,7 +1943,7 @@ paths: /v1/get-jobs-summary: get: operationId: GetJobsSummary - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getJobs tags: [jobs] summary: Get jobs summary @@ -1942,7 +1960,7 @@ paths: /v1/configure-feeds: post: operationId: ConfigureAndUpdateMultipleFeeds - x-ni-privilege: Read + x-ni-auth: true x-ni-request-timeout: 360000 x-ni-operation: manageFeeds tags: [feeds] @@ -1969,7 +1987,7 @@ paths: /v1/get-discovered-systems-summary: get: operationId: GetDiscoveredSystemsSummary - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems tags: [systems] summary: Get discovered systems summary @@ -1986,7 +2004,7 @@ paths: /v1/get-pending-systems-summary: get: operationId: GetPendingSystemsSummary - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems x-ni-request-timeout: 120000 tags: [systems] @@ -2004,7 +2022,7 @@ paths: /v1/generate-systems-report: post: operationId: GetSystemsReport - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems x-ni-request-timeout: 120000 tags: [systems] @@ -2038,7 +2056,7 @@ paths: /v1/create-groups: post: operationId: CreateGroups - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: createOrUpdateGroups tags: [groups] summary: Create groups @@ -2068,7 +2086,7 @@ paths: /v1/groups: get: operationId: GetGroups - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getGroups tags: [groups] summary: Get groups @@ -2096,7 +2114,7 @@ paths: /v1/remove-groups: post: operationId: RemoveGroups - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: createOrUpdateGroups tags: [groups] summary: Remove groups @@ -2127,7 +2145,7 @@ paths: /v1/add-systems-to-groups: post: operationId: AddSystemsToGroups - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: createOrUpdateGroups tags: [groups] summary: Add systems to groups @@ -2155,7 +2173,7 @@ paths: /v1/remove-systems-from-groups: post: operationId: RemoveSystemsFromGroups - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: createOrUpdateGroups tags: [groups] summary: Remove systems from groups @@ -2183,7 +2201,7 @@ paths: /v1/obtain-systems-info: post: operationId: GetSystemsInfo - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems tags: [systems] summary: Get systems info @@ -2213,7 +2231,7 @@ paths: /v1/get-systems-keys: get: operationId: GetSystemsKeys - x-ni-privilege: Read + x-ni-auth: true x-ni-request-timeout: 120000 tags: [systems] x-ni-operation: getSystems @@ -2231,7 +2249,7 @@ paths: /v1/manage-systems-keys: post: operationId: ManageSystemsKeys - x-ni-privilege: Write + x-ni-auth: true x-ni-request-timeout: 300000 x-ni-operation: manageSystems tags: [systems] @@ -2260,7 +2278,7 @@ paths: /v1/systems/managed/{id}: patch: operationId: UpdateMetadata - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: updateSystemMetadata consumes: - application/merge-patch+json @@ -2296,7 +2314,7 @@ paths: /v1/query-available-packages: post: operationId: GetAvailablePackagesByQuery - x-ni-privilege: Read + x-ni-auth: true x-ni-request-timeout: 300000 x-ni-operation: manageFeeds tags: [feeds] @@ -2327,7 +2345,7 @@ paths: /v1/query-jobs: post: operationId: GetJobsByQuery - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getJobs x-ni-request-timeout: 120000 tags: [jobs] @@ -2356,7 +2374,7 @@ paths: /v1/query-systems: post: operationId: GetSystemsByQuery - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getSystems x-ni-request-timeout: 120000 tags: [systems] From 40e293564a38500e69f6cffb4103dd6bc52cab31 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Mon, 6 Jan 2020 15:23:34 +0000 Subject: [PATCH 019/108] Merged PR 54665: Implemented the update policy route. # Justification We need to implement the update policy route as specified in the .yml file. # Testing Added tests to cover the route and ran all the other tests. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #951070 --- asset-managment/niapm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 0e8c01b..2600f8c 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -832,6 +832,7 @@ parameters: ServicePolicyUpdateRequestBody: in: body name: servicePolicyUpdateRequest + required: true description: The request to update properties of the current service policy. schema: $ref: '#/definitions/ServicePolicyModel' From bf5d4c01c8f9b54bcb22570f448aecd2213cb061 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Mon, 6 Jan 2020 15:29:53 +0000 Subject: [PATCH 020/108] Merged PR 54753: Implement query location history route # Justification Implement Swagger web service interface. # Implementation Implement the route. It does download or send to file ingestion. Added tests that check the 2 behaviors, but not the actual report content (it checks the columns and nb of rows). # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #952695 --- asset-managment/niapm.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 2600f8c..f6df89f 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -504,6 +504,15 @@ definitions: - INLINE - DOWNLOAD - FILE_SERVICE + QueryHistoryRequestModel: + title: Query History Request Model + description: Object containing options for querying history. + type: object + properties: + responseFormat: + $ref: '#/definitions/ResponseFormat' + destination: + $ref: '#/definitions/Destination' ServicePolicyModel: title: Service policy description: An object containing the service policy. @@ -821,14 +830,7 @@ parameters: name: queryHistory description: Request body consisting of options to be used for querying history for an asset. schema: - title: Query History Request Body - description: Object containing options for querying history. - type: object - properties: - responseFormat: - $ref: '#/definitions/ResponseFormat' - destination: - $ref: '#/definitions/Destination' + $ref: '#/definitions/QueryHistoryRequestModel' ServicePolicyUpdateRequestBody: in: body name: servicePolicyUpdateRequest From a51c9751c33e248500ccd4205e8f072558ac5d0e Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 7 Jan 2020 14:52:55 +0000 Subject: [PATCH 021/108] Merged PR 55495: Query Assets # Justification Implement Swagger routes # Implementation Implements all cases for query-assets route. # Testing Ran all unit tests. Tested in product in VM. # Checklist - [X] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #952679 --- asset-managment/niapm.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index f6df89f..452ffcf 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -732,6 +732,10 @@ parameters: type: integer default: -1 maximum: 1000 + calibratableOnly: + description: Whether to generate a report with calibrated asset specific columns. + type: boolean + default: false filter: description: >- The filter criteria for assets. Consists of a string of queries composed using AND/OR operators. @@ -1607,7 +1611,7 @@ paths: post: tags: [assets] summary: Query assets - description: Returns the assets satisfying the provided filtering criteria. If the the caller requests a JSON inline response, the returned assets are filtered based on the filter string and the ids property is not taken into consideration. When the caller requests a CSV response, the filter is not taken into consideration, but the ids property can used to filter the assets from the response. + description: Returns the assets satisfying the provided filtering criteria. If the the caller requests a JSON inline response, the returned assets are filtered based on the filter string and the ids and calibratableOnly properties are not taken into consideration. When the caller requests a CSV response, the filter is not taken into consideration, but the ids and calibratableOnly properties are used to filter the assets from the response. operationId: query-assets x-ni-operation: readAssets x-ni-privilege: Read @@ -1761,7 +1765,7 @@ paths: post: tags: [assets] summary: Queries asset calibration history - description: Computes the calibration history of an asset in CSV format. If the destination is download, the response will contain the calibration history file content. If the destination is file ingestion, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. + description: Computes the calibration history of an asset in CSV format. If the destination is download, the response will contain the calibration history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-calibration-history x-ni-operation: readAssets x-ni-priviledge: Read @@ -1785,7 +1789,7 @@ paths: post: tags: [assets] summary: Queries asset location history - description: Computes the location history of an asset in CSV format. If the destination is download, the response will contain the location history file content. If the destination is file ingestion, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. + description: Computes the location history of an asset in CSV format. If the destination is download, the response will contain the location history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-location-history x-ni-operation: readAssets x-ni-priviledge: Read From ebbd3498aa5ea63ad75c1f99792e3235832094cb Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Mon, 13 Jan 2020 12:36:50 +0000 Subject: [PATCH 022/108] Merged PR 56230: Change return type of list packages route # Justification The current web service returns an object that contains a list of packages. The current one returns directly the list of the packages. # Implementation Changed the return type in the yml file. # Testing Tested using SystemLink Web UI. Related work items: #947886 --- repo/nirepo.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 212bcfa..5f03019 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -1256,9 +1256,7 @@ paths: 200: description: The request has succeeded. schema: - type: array - items: - $ref: '#/definitions/Package' + $ref: '#/definitions/Packages' 401: $ref: '#/definitions/Unauthorized' default: From 3b6030c8224f386a1d097f88beacd8f2611cd079 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Tue, 14 Jan 2020 09:25:16 +0000 Subject: [PATCH 023/108] Merged PR 56085: Added dependency to openAPIGenerator nuget # Justification New openAPIGenerator nuget has support for static methods. Repository service needs this support for implementation of the download method. # Implementation Changed openAPIGenerator dependency. Removed duplicate definition of the download method in yml. Added "nirepo/v1" prefix concatenation for the packages and feeds uris. # Testing Generated classes with new nuget and tested the functionality of the program. Related work items: #947886 --- repo/nirepo.yml | 56 +++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 5f03019..49c5f19 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -29,7 +29,6 @@ security: - cookieAuth: [] x-ni-routing-key: Skyline.Repository -x-ni-privilege-application: nirepo definitions: JobError: @@ -102,6 +101,12 @@ definitions: description: The ID of the feed or package which this job created or modified. type: string example: 58339eb8e0d6442db09f03f5 + resourceIds: + type: array + items: + description: The ID of the feed or package which this job created or modified. + type: string + example: 58339eb8e0d6442db09f03f5 returnType: description: The type of resource, such as a package or feed, that this job will return when completed. type: string @@ -872,12 +877,16 @@ definitions: description: The source of a package. type: string example: https://nuget.org/api/v2/ - UpdateDescriptorResponse: - description: An array of update descriptors. - type: array - items: - $ref: '#/definitions/UpdateDescriptor' - + UpdateDescriptorsResponse: + type: object + description: Object containing an array of update descriptors. + properties: + updateDescriptors: + description: An array of update descriptors. + type: array + items: + $ref: '#/definitions/UpdateDescriptor' + responses: JobIdResponse: description: Response with a JobID in it. This is the usual result after executing a write operation. @@ -908,7 +917,7 @@ paths: description: The request encountered an error. default: $ref: '#/definitions/Error' - /v1/files/{pathToFile}: + /v1/files: parameters: - in: path name: pathToFile @@ -920,6 +929,9 @@ paths: operationId: DownloadFiles x-ni-privilege: Download x-ni-operation: getResource + x-ni-route-type: Static + x-ni-static-download: true + x-ni-static-alias: /files tags: [files] summary: Download files located in Package Repository description: Download files located in Package Repository. @@ -934,32 +946,6 @@ paths: description: File not found. default: $ref: '#/definitions/Error' - /v1/files/packages/{pathToPackage}: - parameters: - - in: path - name: pathToPackage - description: The path to the file to download. - type: string - required: true - x-example: "pathToPackage.extension" - get: - operationId: DownloadFilesFromPackages - x-ni-privilege: Download - x-ni-operation: getResource - tags: [files] - summary: Download files located in Package Repository in the packages folder - description: Download files located in Package Repository in the packages folder. - produces: - - application/octet-stream - responses: - 200: - description: The request has succeeded. - schema: - type: file - 404: - description: File not found. - default: - $ref: '#/definitions/Error' /v1/feeds: get: operationId: ListFeeds @@ -1752,7 +1738,7 @@ paths: 200: description: The request has succeeded. schema: - $ref: '#/definitions/UpdateDescriptorResponse' + $ref: '#/definitions/UpdateDescriptorsResponse' 401: $ref: '#/definitions/Unauthorized' default: From 11bc0bbc50be2f6bfd38c0b8e048509b507aad9e Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 14 Jan 2020 16:10:26 +0000 Subject: [PATCH 024/108] Merged PR 56261: Replace HTTP controller with the Swagger generated interface # Justification We have to use the Swagger gen code instead of the old http controller. # Implementation Update service class to instantiate the generated web service. Delete old classes that are not used any more. Delete some add external calibration test cases that were already covered at the facade level. Update all integration tests to work with new web service. Delete JsonConstructor and JsonProperty attributes from AppServices models. Increase timeout for a AMQP integration test for unknown reason (fails locally sometimes). # Testing Ran all unit and integration tests. Test in the product. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #956880 --- asset-managment/niapm.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 452ffcf..87296b5 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -244,7 +244,7 @@ definitions: description: Hostname of the system. type: string example: APM-PXI1 - assetState: + state: $ref: '#/definitions/AssetStateModel' ExternalCalibrationOperatorModel: title: External Calibration Operator @@ -262,7 +262,7 @@ definitions: description: Contains data from the last self-calibration. type: object required: - - calibrationDate + - date properties: temperatureSensors: description: An array of temperature sensor information. @@ -273,7 +273,7 @@ definitions: description: Whether the last self-calibration of the asset was a limited calibration. type: boolean example: false - calibrationDate: + date: description: ISO-8601 formatted timestamp specifying the last date the asset was self-calibrated. type: string format: date-time @@ -283,7 +283,7 @@ definitions: description: Data for an external calibration entry. type: object required: - - calibrationDate + - date - recommendedInterval - nextRecommendedDate - temperatureSensors @@ -297,7 +297,7 @@ definitions: description: Whether the last external calibration of the asset was a limited calibration. type: boolean example: false - calibrationDate: + date: description: ISO-8601 formatted timestamp specifying the last date the asset was externally calibrated. type: string format: date-time @@ -362,7 +362,7 @@ definitions: description: Vendor number of the asset. type: integer example: 4244 - assetName: + name: description: Name of the asset. type: string example: PCISlot2 @@ -401,7 +401,7 @@ definitions: $ref: '#/definitions/ExternalCalibrationModel' calibrationStatus: $ref: '#/definitions/CalibrationStatus' - lastUpdatedDate: + lastUpdatedTimestamp: description: ISO-8601 formatted timestamp specifying the last date that the asset has had a property update. type: string format: date-time @@ -577,7 +577,7 @@ parameters: For example, a list of 100 asssets with a skip value of 50 will return entries 51 through 100. type: integer - required: true + default: 0 x-example: 0 Take: in: query @@ -588,8 +588,8 @@ parameters: For example, a list of 100 assets with a take value of 25 will return entries 1 through 25. type: integer - required: true - x-example: 0 + default: -1 + x-example: -1 AssetAvailabilityComparison: in: body name: compareAvailability From 6301c52487f4a982272df3c57eb36db31aff36df Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Fri, 17 Jan 2020 22:30:24 +0000 Subject: [PATCH 025/108] Merged PR 56783: query-data returns partial results if there is a mismatch between x and y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Justification The need is to return data for the groups where we can return data, but return errors for the groups where there are errors. Also, possibly, return data AND errors for some groups depending on the error. For example: we truncated x or y because they didn’t match, so we’ll return you ‘something’ but it is lossy. # Implementation Add partial error return to query-data. Returning errors in error. # Testing added and modified existing tests. Tested in product. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 56b5083..4c2dceb 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -273,6 +273,8 @@ definitions: timeUtcOffsetHours: type: number description: Time zone offset applied to local time values + error: + $ref: '#/definitions/Error' QueryDataSpecifier: properties: channelSpecifications: From ca46ff4dfb4a8e8ef6f6b98b3027f8b98efb5639 Mon Sep 17 00:00:00 2001 From: Radu Iviniciu Date: Mon, 20 Jan 2020 10:59:28 +0000 Subject: [PATCH 026/108] Merged PR 57158: Enable security for fileingestion # Justification Need to enable security for file ingestion # Implementation Turn on security in filegestion config file # Testing N/A # Checklist - [ x ] I tested changes to product code in product - [ x ] I considered updates to the wiki --- file/nifile.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/file/nifile.yml b/file/nifile.yml index c68d841..d5cebc6 100644 --- a/file/nifile.yml +++ b/file/nifile.yml @@ -27,6 +27,7 @@ security: - apiKeyAuth: [] - basicAuth: [] - cookieAuth: [] + x-ni-routing-key: Skyline.FileIngestion definitions: Link: @@ -431,7 +432,7 @@ paths: tags: [versioning] summary: API information description: Returns information about API versions and available operations. - operationId: RootEndpoint + operationId: RootEndpoint x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. @@ -477,11 +478,12 @@ paths: /v1/service-groups: get: tags: [service groups] - summary: List service groups + summary: List service groups description: >- Returns an array of File service group names. Each service group is a distinct collection of files. operationId: ListServiceGroups + x-ni-auth: true x-ni-operation: listFiles x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true @@ -521,6 +523,7 @@ paths: The orderBy and orderByDescending fields can be used to manage sorting the list by metadata objects. operationId: ListAvailableFiles_GET + x-ni-auth: true x-ni-operation: listFiles x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true @@ -588,6 +591,7 @@ paths: summary: Delete file description: Deletes the file indicated by the resource ID. operationId: Delete + x-ni-auth: true x-ni-operation: deleteFiles x-ni-privilege: DeleteFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] @@ -610,6 +614,7 @@ paths: Use the inline parameter in the query string to control the download behavior. + x-ni-auth: true operationId: ReceiveFile x-ni-operation: downloadData x-ni-privilege: DownloadFiles @@ -658,6 +663,7 @@ paths: Use the replaceExisting element to determine the replace or merge behavior. operationId: UpdateMetadata + x-ni-auth: true x-ni-operation: updateMetadata x-ni-privilege: ModifyFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] @@ -709,6 +715,7 @@ paths: Deletes multiple files in a single API call. The request body contains an array of file ids to delete. operationId: DeleteMultiple + x-ni-auth: true x-ni-operation: deleteFiles x-ni-privilege: DeleteFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] @@ -757,6 +764,7 @@ paths: - propertiesQuery: a JSON array of query objects with string values. operationId: QueryAvailableFiles + x-ni-auth: true x-ni-operation: listFiles x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true @@ -818,6 +826,7 @@ paths: Uploads a file using multipart/form-data headers to send the file payload in the HTTP body. operationId: Upload + x-ni-auth: true x-ni-operation: uploadFiles x-ni-privilege: UploadFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] From 5865d86e7b57066839d42fff990d48a7cc3427e1 Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Mon, 20 Jan 2020 13:01:33 +0000 Subject: [PATCH 027/108] Merged PR 57169: [S] [HotFix] Removed 'required' attribute from some utilization response properties which can be empty. # Justification When we don't have utilization stored for some assets, we pad the response with utilization entries with 0 percent and no minion ID/utilization category. This was an issue as all the utilization properties were marked as 'required' and JSON serialization of the response would fail as they would be generated in C# with the Required=Always attribute. # Checklist - [X] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 87296b5..d526503 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1364,8 +1364,6 @@ responses: - startTimestamp - endTimestamp - assetIdentifier - - minionId - - category - percentage properties: startTimestamp: From 389a31633820df0f38da98b38660e11ae412e8a6 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Tue, 21 Jan 2020 08:15:52 +0000 Subject: [PATCH 028/108] Merged PR 56954: Update yml and midl files to add workspace to feed models for the repository web service # Justification The workspace field is required for implementing organization modeling. # Implementation Add the workspace field in the description of the feed models. I added some more modifications to the yml file when I implemented the generated methods in order to make them behave accordingly to the old web service. I attach here a document with the differences if you want to review them as well: [diffs.zip](https://ni.visualstudio.com/94b22d7b-ad7b-4f5e-88f0-867910f91c94/_apis/git/repositories/8159353b-4403-4eed-9a32-0c2ee30abe3d/pullRequests/56954/attachments/diffs.zip) # Testing Successfully generated the new models. --- repo/nirepo.yml | 88 ++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index 49c5f19..f467fd7 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -171,7 +171,7 @@ definitions: $ref: '#/definitions/ErrorObject' Platform: type: string - enum: [windows, ni_linux_rt] + enum: [WINDOWS, NI_LINUX_RT] description: "Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds." example: windows PackageImportDescriptor: @@ -373,6 +373,10 @@ definitions: type: string description: A short description of the feed. example: Feed containing all the necessary packages for configuring LabVIEW 2015 + workspace: + type: string + description: The workspace's id where the feed belongs to + example: 3651818c-9b31-4d25-8b35-0afc4e305f2d FeedData: type: object description: | @@ -394,6 +398,10 @@ definitions: example: Feed containing all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' + workspace: + type: string + description: The workspace's id where the feed belongs to + example: 3651818c-9b31-4d25-8b35-0afc4e305f2d FeedDataWithURI: type: object description: | @@ -415,6 +423,10 @@ definitions: example: Feed containing all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' + workspace: + type: string + description: The workspace's id where the feed belongs to + example: 3651818c-9b31-4d25-8b35-0afc4e305f2d uri: type: string description: 'The path of the feed to replicate. Appending /Packages to the URI should yield the "Packages" file of the feed.' @@ -494,6 +506,10 @@ definitions: type: string description: If "split" is false, the description of the feed which will be created. If "split" is true, this field is ignored. example: Feed containing all the necessary packages for configuring LabVIEW 2015 + workspace: + type: string + description: The workspace's id where the feed belongs to + example: 3651818c-9b31-4d25-8b35-0afc4e305f2d StoreItem: type: object properties: @@ -615,6 +631,10 @@ definitions: example: Feed that contains all the necessary packages for configuring LabVIEW 2015 platform: $ref: '#/definitions/Platform' + workspace: + type: string + description: The workspace's id where the feed belongs to + example: 3651818c-9b31-4d25-8b35-0afc4e305f2d packageReferences: type: array description: An array containing the IDs of the packages in this feed. @@ -901,7 +921,7 @@ paths: /v1/ping: get: operationId: Ping - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: ping tags: [ping] summary: Ping the service @@ -927,7 +947,7 @@ paths: x-example: "filePath" get: operationId: DownloadFiles - x-ni-privilege: Download + x-ni-auth: true x-ni-operation: getResource x-ni-route-type: Static x-ni-static-download: true @@ -949,7 +969,7 @@ paths: /v1/feeds: get: operationId: ListFeeds - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getFeeds tags: [feeds] summary: List all feeds @@ -971,7 +991,7 @@ paths: $ref: '#/definitions/Error' post: operationId: CreateFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: createFeed tags: [feeds] summary: Create a feed @@ -1000,7 +1020,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: GetFeed - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getFeeds tags: [feeds] summary: Get feed @@ -1016,7 +1036,7 @@ paths: $ref: '#/definitions/Error' delete: operationId: DeleteFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: deleteFeeds tags: [feeds] summary: Remove a feed @@ -1044,7 +1064,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: CloneFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: cloneFeed tags: [feeds] summary: Clone a feed @@ -1073,7 +1093,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: ListFeedPackages - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getPackages tags: [feeds, packages] summary: Get all packages in a feed @@ -1101,7 +1121,7 @@ paths: /v1/replicate-feed: post: operationId: ReplicateFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: replicateFeed tags: [feeds] summary: Replicate a feed @@ -1140,7 +1160,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: ImportPackages - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: importPackages tags: [feeds, packages] summary: Import packages into a feed @@ -1179,7 +1199,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: ImportFeedsAlternative - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: importFeeds tags: [feeds] summary: Import feeds into an existing feed @@ -1217,7 +1237,7 @@ paths: /v1/packages: get: operationId: ListPackages - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getPackages tags: [packages] summary: Get all packages @@ -1257,7 +1277,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: GetPackage - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getPackages tags: [packages] summary: Get package details @@ -1277,7 +1297,7 @@ paths: $ref: '#/definitions/Error' delete: operationId: DeletePackage - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: deletePackage tags: [packages] summary: Remove a package @@ -1298,7 +1318,7 @@ paths: /v1/upload-packages: post: operationId: UploadPackage - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: uploadPackage tags: [packages] summary: Upload packages to the pool @@ -1344,7 +1364,7 @@ paths: /v1/get-package-import-descriptors: post: operationId: ObtainPackageImportDescriptorsFromFeedUri - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getPackageImportDescriptors tags: [packages] summary: Returns the package import descriptors from the specified feed URI @@ -1375,11 +1395,11 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" put: operationId: UpdateFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: getFeedMetadata tags: [feeds] - summary: Update a feed's name and/or description - description: Asynchronously updates a feed's name and/or description. Returns the ID of a resource which can be queried to determine the status of the operation. + summary: Update a feed's name and/or description and/or workspace + description: Asynchronously updates a feed's name and/or description and/or workspace. Returns the ID of a resource which can be queried to determine the status of the operation. parameters: - in: body name: updateData @@ -1404,7 +1424,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: AddPackageReferences - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: addPackageReferences tags: [feeds, packages] summary: Add package references to feed @@ -1434,7 +1454,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: RemovePackageReferences - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: removePackageReferences tags: [feeds, packages] summary: Remove package references @@ -1469,7 +1489,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: ImportFeeds - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: importFeeds tags: [feeds] summary: Import feeds into an existing feed @@ -1514,7 +1534,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: CheckForUpdates - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: checkForUpdates tags: [feeds] summary: Check for updates to a feed @@ -1544,7 +1564,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: ApplyUpdates - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: applyUpdates tags: [feeds] summary: Apply updates @@ -1584,7 +1604,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: CleanFeed - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: cleanFeed tags: [feeds] summary: Clean a feed @@ -1606,7 +1626,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" post: operationId: ImportStoreItems - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: importStoreItems tags: [feeds, store] summary: Import store items @@ -1633,7 +1653,7 @@ paths: /v1/jobs: get: operationId: ListJobs - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: listJobs tags: [jobs] summary: List all jobs @@ -1678,7 +1698,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: GetJob - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getJobs tags: [jobs] summary: Get job details @@ -1707,7 +1727,7 @@ paths: /v1/can-write: get: operationId: CheckWritePermission - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: canWrite tags: [misc] summary: Check if the logged user can write @@ -1729,7 +1749,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: GetUpdateDescriptors - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getUpdateDescriptors tags: [updates] summary: Retrieve updates for a feed @@ -1746,7 +1766,7 @@ paths: /v1/store/items: get: operationId: QueryStoreItems - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStoreItems tags: [store] summary: Query store items @@ -1786,7 +1806,7 @@ paths: x-example: "5c5d49f2781e2b2cd045267b" get: operationId: GetStoreItem - x-ni-privilege: Read + x-ni-auth: true x-ni-operation: getStoreItems tags: [store] summary: Get a store item @@ -1803,7 +1823,7 @@ paths: /v1/replicate-store-item: post: operationId: ReplicateStoreItem - x-ni-privilege: Write + x-ni-auth: true x-ni-operation: replicateStoreItem tags: [store] summary: Replicate a store item From 4093d65b16980d0430aa88e134199dd616783a4a Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Tue, 21 Jan 2020 10:33:42 +0000 Subject: [PATCH 029/108] Merged PR 56496: Asset Management OpenAPI updates to support Asset Utilization HTTP APIs # Justification HTTP APIs for: Utilization Start Utilization End Utilization Heartbeat Of Course this will go in after changes related to codegen are in. --- asset-managment/niapm.yml | 195 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index d526503..260fc76 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -552,6 +552,63 @@ definitions: - START_TIMESTAMP example: START_TIMESTAMP + AssetIdentificationModel: + title: Asset Identification + description: >- + Object containing properties which identify an asset. + An asset is uniquely identified by a combination of: + - busType + - modelName or modelNumber + - vendorName or vendorNumber + - serialNumber or minionId (part of the Location) + type: object + required: + - busType + properties: + modelName: + description: Model name of the asset. + type: string + example: "NI PXIe-6368" + modelNumber: + description: Model number of the asset. + type: integer + example : 123 + serialNumber: + description: Serial number of the asset. + type: string + example: "01BB877A" + vendorName: + description: Vendor name of the asset. + type: string + example: National Instruments + vendorNumber: + description: Vendor number of the asset. + type: integer + example: 4244 + busType: + $ref: '#/definitions/BusType' + UtilizationIdentifiersWithTimestampModel: + title: Utilization Identifiers With Timestamp + description: Object containing a collection of utilization identifiers with a timestamp. + type: object + required: + - utilizationIdentifiers + - utilizationTimestamp + properties: + utilizationIdentifiers: + description: Array representing the unique identifier of an asset utilization history record. + type: array + items: + type: string + example: "2916201B245D642430" + utilizationTimestamp: + description: >- + A date time value which can be used to specify the end of an utilization. + + This parameter must have the "ISO 8601" format in order to be considered valid. + type: string + format: date-time + example: '2019-05-01T00:00:00.519Z' parameters: TimespanGranularity: in: query @@ -1190,6 +1247,66 @@ parameters: type: boolean default: false example: false + StartUtilizationRequest: + in: body + name: utilizationBody + description: Request body specifying utilization start information for multiple assets. + schema: + title: Start Utilization Request + description: Object containing utilization unique identifier, the asset identifiers of the utilized assets and the details of the utilization type, such as category, task name and utilization start timestamp. + type: object + required: + - utilizationIdentifier + - minionId + - assetIdentifiers + - utilizationCategory + - utilizationTimestamp + properties: + utilizationIdentifier: + description: String representing the unique identifier of an asset utilization history record. + type: string + example: "2916201B245D642430" + minionId: + description: Identifier of the minion where the utilized assets are located. + type: string + example: NI_PXIe-8135_Embedded_Controller--MAC-00-80-2F-23-52-65 + assetIdentifiers: + description: Array of the identification information for the assets which are utilized. + type: array + items: + $ref: '#/definitions/AssetIdentificationModel' + utilizationCategory: + description: String representing the utilization category. + type: string + example: Test + taskName: + description: String representing the name of the task. + type: string + example: DUTTestingRoutine + userName: + description: String representing the name of the operator who utilized the asset. + type: string + example: johnDoe + utilizationTimestamp: + description: >- + A date time value which can be used to specify the start of an utilization. + + This parameter must have the "ISO 8601" format in order to be considered valid. + type: string + format: date-time + example: '2019-05-01T00:00:00.519Z' + EndUtilizationRequest: + in: body + name: utilizationBody + description: Request body consisting of data specifying the utilization end event for an asset. + schema: + $ref: '#/definitions/UtilizationIdentifiersWithTimestampModel' + HeartbeatUtilizationRequest: + in: body + name: utilizationBody + description: Request body consisting of data specifying the utilization heartbeat event for multiple ongoing utilizations. + schema: + $ref: '#/definitions/UtilizationIdentifiersWithTimestampModel' responses: Error: description: Error @@ -1833,6 +1950,84 @@ paths: $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' + /v1/assets/start-utilization: + post: + tags: [utilization] + summary: Stores assets utilization start + description: >- + Stores information related to assets utilization start. The operation is succesful when utilization information can be stored for all asset identifiers provided in the request. + It will return a partial success when utilization information can be stored for only a subset of the asset identifiers provided in the request. + It will return a not found response when no stored assets matched the provided asset identifiers. + operationId: start-multiple-asset-utilization + x-ni-operation: createUtilization + x-ni-privilege: Create + parameters: + - $ref: '#/parameters/StartUtilizationRequest' + responses: + 200: + $ref: '#/responses/PartialSuccess' + 201: + description: Created + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + /v1/assets/end-utilization: + post: + tags: [utilization] + summary: Stores assets utilization end + description: >- + Stores information related to assets utilization end. The operation is succesful and will return No Content when end utilization information can be stored for all utilization identifiers provided in the request. + It will return a partial success when end utilization information can be stored for only a subset of the utilization identifiers provided in the request. + It will return a not found response when no stored utilizations matched the provided utilization identifiers. + operationId: end-multiple-asset-utilization + x-ni-operation: updateUtilization + x-ni-privilege: Update + parameters: + - $ref: '#/parameters/EndUtilizationRequest' + responses: + 200: + $ref: '#/responses/PartialSuccess' + 204: + description: No Content + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + /v1/assets/utilization-heartbeat: + post: + tags: [utilization] + summary: Stores asset utilization heartbeats + description: >- + Stores information related to ongoing asset utilizations. The operation is succesful and will return No Content when utilization heartbeat information can be stored for all utilization identifiers provided in the request. + It will return a partial success when utilization heartbeat information can be stored for only a subset of the utilization identifiers provided in the request. + It will return a not found response when no stored utilizations matched the provided utilization identifiers. + operationId: asset-utilization-multiple-heartbeats + x-ni-operation: updateUtilization + x-ni-privilege: Update + parameters: + - $ref: '#/parameters/HeartbeatUtilizationRequest' + responses: + 200: + $ref: '#/responses/PartialSuccess' + 204: + description: No Content + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' /v1/compare-assets-availability: post: tags: [assets] From 2ef155d521f8ddc5cda946aeaa8dddf976720c25 Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Thu, 23 Jan 2020 14:26:05 +0000 Subject: [PATCH 030/108] Merged PR 57729: Fixed the Query Utilization Route names for the several utilization filter properties # Justification The example and the documentation of the POST /v1/query-asset-utilization route was wrong. It had : - "UtilizationCategory" as a possible filter query, but in fact it is just "Category". - "User" instead of "UserName" # Implementation Updated the swagger. # Testing Tested route with the correct property sent in filter. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962514 --- asset-managment/niapm.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 260fc76..a6d3d42 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -946,11 +946,11 @@ parameters: - MinionId: String representing the identifier of a minion in which an asset might be located in. - - UtilizationCategory: String representing the utilization task category. + - Category: String representing the utilization task category. - - User: : String representing the name of the operator who utilized the asset. + - UserName: : String representing the name of the operator who utilized the asset. type: string - example: UtilizationCategory = "Test" + example: Category = "Test" assetFilter: description: >- The filter criteria for assets. Consists of a string of queries composed using AND/OR operators. From 165fba225c1e7fe83e7b97b16bfdd598edf11531 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Fri, 24 Jan 2020 19:25:55 +0000 Subject: [PATCH 031/108] Merged PR 56912: Modify OpenAPI deffinition to match the behavior of the service. # Justification move tdmreader to use swagger based generation of http # Implementation refactor things # Testing ran all tdmreader tests, tested in product, tested http tests # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 144 +++++++++++++++++++++++++++++++++---- 1 file changed, 131 insertions(+), 13 deletions(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 4c2dceb..f082f5d 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -141,38 +141,46 @@ definitions: type: integer description: Number of values on the x axis. This determines the number of points that can be displayed. example: 1000 - default: 0 + default: null format: int32 decimatey: type: integer description: Number of values on the y axis. This determines the number of points that can be displayed. example: 1000 - default: 0 + default: null format: int32 xmin: type: number - default: 0 + default: null format: double description: Minimum x value of the display x axis. example: -1 xmax: type: number - default: 0 + default: null format: double description: Maximum x value of the display x axis. example: 1 ymin: type: number - default: 0 + default: null format: double description: Minimum y value of the display y axis. example: -1 ymax: type: number - default: 0 + default: null format: double description: Maximum y value of the display y axis. example: 1 + xlog: + type: boolean + default: false + description: Logrithmic X channel. + ylog: + type: boolean + default: false + description: Logrithmic Y channel. showLines: type: boolean description: Represent data as lines. When decimation is performed, the data returned represents the min and max values for that x-axis increment. @@ -192,6 +200,42 @@ definitions: $ref: '#/definitions/OneChannelSpecifier' default: null description: Channels to use only to filter. Values from these channels are not returned. + function: + type: string + default: null + description: Function to perform on the channel data. + example: y0-y1 + outputObjectNames: + type: array + items: + type: string + default: null + description: Transpose the returned data for the channels with the specified names. + example: + - name1 + - name2 + xminStringData: + description: >- + ISO-8601 formatted timestamp indicating the starting point for x data + type: string + format: date-time + example: '2018-05-09T15:07:42.527921Z' + xmaxStringData: + description: >- + ISO-8601 formatted timestamp indicating the ending point for x data + type: string + format: date-time + example: '2018-05-09T15:07:42.527921Z' + sort: + type: string + default: null + description: Specify how to sort values before returning them. + example: -y0,x + useWaveformProperties: + type: boolean + description: Look for specific properties in a channel that define the start and increment x values to use for each channel. + default: false + OneChannelSpecifier: description: Specification for a channel of data properties: @@ -230,6 +274,22 @@ definitions: $ref: '#/definitions/DataWindow' required: - yChannels + minItems: 1 + required: + - xyChannels + QueryChannelsRequest: + description: Object containing the channels to request metadata for. + properties: + channelSpecifications: + type: array + items: + $ref: '#/definitions/OneChannelSpecifier' + calculateChannelLength: + type: boolean + description: Determines whether or not to calculate the channel length + default: false + required: + - channelSpecifications OneChannelData: properties: dataType: @@ -279,6 +339,8 @@ definitions: properties: channelSpecifications: $ref: '#/definitions/ChannelSpecifications' + required: + - channelSpecifications ReturnedUniqueValues: properties: uniqueValues: @@ -398,16 +460,17 @@ paths: description: Not Found schema: $ref: '#/definitions/Error' - /v1/files/{file-id}: + /v1/files/{fileId}: get: tags: [metadata] summary: Gets file, group, and channel information description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getAllFileInfo + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: - - name: file-id + - name: fileId description: File ID in: path type: string @@ -427,6 +490,7 @@ paths: summary: Gets file, group, and channel information description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getMultipleFileInfo + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: @@ -445,16 +509,42 @@ paths: description: Error schema: $ref: '#/definitions/Error' - /v1/files/{file-id}/groups: + /v1/query-channels: + post: + tags: [metadata] + summary: Gets channel information + description: 'Gets all channel names, channel information, and properties for the channel. This does not return channel data.' + operationId: queryChannels + x-ni-request-variables: [REMOTE_USER] + produces: + - application/json + parameters: + - name: QueryChannelsRequest + description: Channel request parameters + in: body + required: true + schema: + $ref: '#/definitions/QueryChannelsRequest' + responses: + 200: + description: OK + schema: + $ref: '#/definitions/FileInformation' + default: + description: Error + schema: + $ref: '#/definitions/Error' + /v1/files/{fileId}/groups: get: tags: [metadata] summary: Lists all groups in the file description: Lists all group names in the file. operationId: getChannelPropertiesCount + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: - - name: file-id + - name: fileId description: File ID in: path required: true @@ -483,21 +573,22 @@ paths: description: Error schema: $ref: '#/definitions/Error' - /v1/files/{file-id}/groups/{group-name}/channels: + /v1/files/{fileId}/groups/{groupName}/channels: get: tags: [metadata] summary: Lists all channels in the group description: Lists all channel names for a group in a specific file. operationId: getChannels + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: - - name: file-id + - name: fileId description: File ID in: path required: true type: string - - name: group-name + - name: groupName description: Group name in: path required: true @@ -532,6 +623,7 @@ paths: summary: Returns data from channels. description: Queries files based on channel and window specifications and returns channel data that matches the query. The channel specifications select channels by group and channel relationships. Window specifications determine a bounding box of minimum and maximum x and y values, as well as specify the type of decimation performed on data within the window. operationId: queryData + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: @@ -556,6 +648,7 @@ paths: summary: Returns unique data from channels. description: Queries files based on channel specifications and returns unique channel data values. The channel specifications select channels by group and channel relationships. The maximum number of unique values to return is determined by MaxNumberOfUniqueValues. If there are more unique values, then the first MaxNumberOfUniqueValues + 1 values are returned. operationId: queryUniqueValues + x-ni-request-variables: [REMOTE_USER] produces: - application/json parameters: @@ -574,3 +667,28 @@ paths: description: Error schema: $ref: '#/definitions/Error' + /v1/create-calculated-result: + post: + tags: [data] + summary: Returns a calculated result channel. + description: Creates a channel based on values from other channels. + operationId: createCalculatedResult + x-ni-request-variables: [REMOTE_USER] + produces: + - application/json + parameters: + - name: ChannelSpecifications + description: Channel specifications and window information + in: body + required: true + schema: + $ref: '#/definitions/QueryDataSpecifier' + responses: + 200: + description: OK + schema: + $ref: '#/definitions/ReturnedUniqueValues' + default: + description: Error + schema: + $ref: '#/definitions/Error' \ No newline at end of file From 8d7e414ccac5e0461e5df7da227d85773b5f0b75 Mon Sep 17 00:00:00 2001 From: Sergey Kizunov Date: Mon, 27 Jan 2020 15:29:32 +0000 Subject: [PATCH 032/108] Merged PR 57890: Update nbexec examples with proper notation of dict lookups # Justification Incorrect documentation --- ni-notebook-execution/ninbexec.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ni-notebook-execution/ninbexec.yml b/ni-notebook-execution/ninbexec.yml index f700f53..e3c97fc 100644 --- a/ni-notebook-execution/ninbexec.yml +++ b/ni-notebook-execution/ninbexec.yml @@ -108,14 +108,14 @@ definitions: CreateExecutionOperation: title: Create Executions Operation description: Create Executions array object including export formats - allOf: + allOf: - $ref: '#/definitions/Operation' - type: object - properties: - exportFormats: - description: List of export formats + properties: + exportFormats: + description: List of export formats type: array - items: + items: $ref: '#/definitions/NotebookExportFormat' example: exportFormats: [PDF, HTML] @@ -389,7 +389,7 @@ definitions: filter: description: The query filter in Dynamic Linq type: string - example: (metadata.key1 == "value1") || ((parameters.key2 != "value2") && (updatedAt >= "2002-12-25T01:01:01.1234567Z")) + example: (metadata["key1"] == "value1") || ((parameters["key2"] != "value2") && (updatedAt >= "2002-12-25T01:01:01.1234567Z")) orderBy: $ref: '#/definitions/NotebookSortField' descending: @@ -706,7 +706,7 @@ definitions: filter: description: The query filter in Dynamic Linq type: string - example: ((status == "SUCCEEDED") && (result.key1 == "value1")) || ((status == "FAILED") && (completedAt >= "2002-12-25T01:01:01.1234567Z")) + example: ((status == "SUCCEEDED") && (result["key1"] == "value1")) || ((status == "FAILED") && (completedAt >= "2002-12-25T01:01:01.1234567Z")) orderBy: $ref: '#/definitions/ExecutionSortField' descending: From 62013023528b427ddde7e05e04cac1058e6a4bcb Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 28 Jan 2020 10:51:24 +0000 Subject: [PATCH 033/108] Merged PR 58209: Obtain user name and id differently until we implement the authentication # Justification Until we implement authentication properly, we have to obtain the user name and id differently as we do now. One integration test fails because of this. # Implementation Update the Swagger document to get the user name and id passed to the request object and get it from there. # Testing Ran all integration tests and the one that failed is passing. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index a6d3d42..0b03ad2 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1838,6 +1838,7 @@ paths: operationId: post-asset-calibration-history x-ni-operation: writeAssets x-ni-priviledge: Write + x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/ExternalCalibrationRequestBody' From c3cf9b21eef27f887d280e9ae13cd94eec72b226 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 28 Jan 2020 13:45:56 +0000 Subject: [PATCH 034/108] Merged PR 58087: Update NotFound error example and code # Justification Update description of the the NotFound error message and update code to return the asset not found error for multiple routes. All routes use the same generated NotFound error model. # Implementation Changed yml documentation with the actual message and update code to return the id of the resource. # Testing Ran unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962498 --- asset-managment/niapm.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 0b03ad2..2364eea 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -65,13 +65,12 @@ definitions: One or more errors occurred. See the contained list for details of each error. args: [] - ## TODO: populate with valid error code innerErrors: - - name: AssetPerformanceManagement.AssetNotFound - code: -253401 + - name: AssetPerformanceManagement.NonExistingAssetWithIdentifier + code: -253426 resourceType: AssetEntry resourceId: 29162;01B245D6;4243;0 - message: 'The asset with identifier 29162;01B245D6;4243;0 was not found.' + message: 'No asset found with the specified identifier: 29162;01B245D6;4243;0.' args: [29162;01B245D6;4243;0] Operation: description: An operation provided by the API. @@ -1335,6 +1334,14 @@ responses: properties: error: $ref: '#/definitions/Error' + example: + error: + name: AssetPerformanceManagement.NonExistingAssetWithIdentifier + code: -253426 + message: >- + No asset found with the specified identifier: 29162;01B245D6;4243;0. + args: [29162;01B245D6;4243;0] + innerErrors: [] PartialSuccess: description: Partial Success is returned in the case when only a part of the request body information was processed successfully. schema: From 0d199324ebee1a30c5e4c4080d6395733570599b Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Tue, 28 Jan 2020 13:49:39 +0000 Subject: [PATCH 035/108] Merged PR 58067: Updated delete-assets route implementation to return Not Found and updated the partial response Added not found case to the web service facade delete assets method when no assets match the asset identifiers in the request. Updated the route to return a DeleteAssetsResponse which contains the list of identifiers for assets which were deleted, the list of identifiers which failed to be deleted and a list of errors. --- asset-managment/niapm.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 2364eea..6515139 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -698,7 +698,7 @@ parameters: type: array items: type: string - example: [1234;4567;8456] + example: ["29162;01B245D6;4243;0"] DeleteCalibrationsRequestBody: in: body name: deleteCalibrationsRequestBody @@ -1399,6 +1399,29 @@ responses: description: Total number of managed assets. type: integer example: 17 + DeleteAssetsResponse: + description: Delete Assets Response containing the ids of the assets which were deleted, the ids of the assets which failed to be deleted and any errors encountered. + schema: + title: Delete Assets Response + description: Delete Assets Response containing the ids of the assets which were deleted, the ids of the assets which failed to be deleted and any errors encountered. + type: object + required: + - ids + properties: + ids: + description: Array of asset identifiers which were deleted + type: array + items: + type: string + example: "29162;01B245D6;4243;0" + failed: + description: Array of asset identifiers that failed to delete + type: array + items: + type: string + example: "29162;01B245D6;4243;0" + error: + $ref: '#/definitions/Error' AvailabilityInSystemResponse: description: >- Returns asset availability information in the specified timespan split based on the specified timespan granularity. @@ -2080,7 +2103,7 @@ paths: - $ref: '#/parameters/DeleteAssetsRequestBody' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/DeleteAssetsResponse' 400: $ref: '#/responses/BadRequest' 401: From 53ff6c90a69e3c2d8a00bc4ecc815ae832a38351 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 28 Jan 2020 14:57:26 +0000 Subject: [PATCH 036/108] Merged PR 58079: Change description of skip and take # Justification Change reusable Skip and Take parameters to no say anything about assets, but say about resources. # Implementation Change 1 word in the description. Reuse the parameters in 1 more route. # Testing Looked in editor.swagger.io # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962513 --- asset-managment/niapm.yml | 59 +++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 6515139..35d6c71 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -608,6 +608,24 @@ definitions: type: string format: date-time example: '2019-05-01T00:00:00.519Z' + Skip: + description: + The number of resources to skip in the result when paging. + For example, a list of 100 resources with a skip value of 50 will return + entries 51 through 100. + type: integer + default: 0 + x-example: 0 + Take: + description: + How many resources to return in the result, or -1 to use a default + defined by the service. The maximum value for Take is 1000. + For example, a list of 100 resources with a take value of 25 will return + entries 1 through 25. + type: integer + default: -1 + x-example: -1 + maximum: 1000 parameters: TimespanGranularity: in: query @@ -630,7 +648,7 @@ parameters: name: skip description: The number of resources to skip in the result when paging. - For example, a list of 100 asssets with a skip value of 50 will return + For example, a list of 100 resources with a skip value of 50 will return entries 51 through 100. type: integer default: 0 @@ -640,12 +658,13 @@ parameters: name: take description: How many resources to return in the result, or -1 to use a default - defined by the service. - For example, a list of 100 assets with a take value of 25 will return + defined by the service. The maximum value for Take is 1000. + For example, a list of 100 resources with a take value of 25 will return entries 1 through 25. type: integer default: -1 x-example: -1 + maximum: 1000 AssetAvailabilityComparison: in: body name: compareAvailability @@ -773,21 +792,9 @@ parameters: destination: $ref: '#/definitions/Destination' skip: - description: - How many assets to skip in the result when paging. - For example, a list of 100 asssets with a skip value of 50 will return - entries 51 through 100. - type: integer - default: 0 + $ref: '#/definitions/Skip' take: - description: - How many assets to return in the result, or -1 to use a default - defined by the service. - For example, a list of 100 assets with a take value of 25 will return - entries 1 through 25. - type: integer - default: -1 - maximum: 1000 + $ref: '#/definitions/Take' calibratableOnly: description: Whether to generate a report with calibrated asset specific columns. type: boolean @@ -1676,22 +1683,8 @@ paths: x-ni-operation: readAssets x-ni-privilege: Read parameters: - - in: query - name: skip - description: - How many files to skip in the result when paging. - For example, a list of 100 asssets with a skip value of 50 and a take - value of 25 will return entries 51 through 75. - type: integer - - in: query - name: take - description: - How many assets to return in the result, or -1 to use a default - defined by the service. - For example, a list of 100 assets with a skip value of 50 and a take - value of 25 will return entries 51 through 75. - type: integer - maximum: 1000 + - $ref: '#/parameters/Skip' + - $ref: '#/parameters/Take' - in: query name: calibratableOnly description: Whether to filter only assets which support calibration. From ee3c6267780d21b19d90ab4c2fd777beddf65c01 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Tue, 28 Jan 2020 21:42:05 +0000 Subject: [PATCH 037/108] Merged PR 58339: update yml and helpers for http Justification Add missing properties that exist in the swagger document to the HTTP -> AMQP model conversion helper. Implementation Added the two properties to the helper method for converting between model objects. Testing Verified that the source built and works against the existing tests. --- tdm-reader/nitdmreader.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index f082f5d..0d4ded4 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -218,19 +218,17 @@ definitions: description: >- ISO-8601 formatted timestamp indicating the starting point for x data type: string - format: date-time example: '2018-05-09T15:07:42.527921Z' xmaxStringData: description: >- ISO-8601 formatted timestamp indicating the ending point for x data type: string - format: date-time example: '2018-05-09T15:07:42.527921Z' sort: type: string default: null description: Specify how to sort values before returning them. - example: -y0,x + example: '-y0,x' useWaveformProperties: type: boolean description: Look for specific properties in a channel that define the start and increment x values to use for each channel. From 444b8308b342f747537b7f03c2aee753c942a862 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Wed, 29 Jan 2020 09:22:23 +0000 Subject: [PATCH 038/108] Merged PR 58373: Changed the swagger query-asset-availability example to have two asset ids. # Justification Apm swagger contained only one asset id the the body of the compare-asset-availability request. # Implementation Added another id. # Testing Manually tested the result for the updated example. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962493 --- asset-managment/niapm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 35d6c71..a895651 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -682,7 +682,7 @@ parameters: type: array items: type: string - example: ["29162;01B245D6;4243;0"] + example: ["29162;01B245D6;4243;0", "29162;01B245D6;4243;1"] startDate: description: >- A date value which can be used to specify the beginning of a timespan. From facf54ff38c8e657da9bb2b957b00274fdf2d3fd Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 29 Jan 2020 11:03:18 +0000 Subject: [PATCH 039/108] Merged PR 58069: Delete calibration returns deleted and not delete calibration ids # Justification Partial success response must contain the ids for the entries that were delete and the ids of the entries that were not deleted, together with the errors. # Implementation Update Swagger and the web service code. # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #964581 --- asset-managment/niapm.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index a895651..eb2a35a 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1488,6 +1488,29 @@ responses: description: The total number of calibration history entries for the requested asset. type: integer example: 1 + DeleteCalibrationsPartialSuccessResponse: + description: Delete Calibrations Partial Success Response + schema: + description: Delete Calibrations Partial Success Response + title: DeleteCalibrationsPartialSuccessResponse + type: object + required: + - calibrationIds + properties: + calibrationIds: + description: Array of calibration entry identifiers that were deleted + type: array + items: + type: string + example: "5c4f0834174ae321b8a95a03" + failed: + description: Array of calibration entry identifiers that failed to delete + type: array + items: + type: string + example: "5c4f0834174ae321b8a95a03" + error: + $ref: '#/definitions/Error' SendToFileIngestionOrDownloadResponse: description: Response for the query operation that consists either in the file information for when the result was sent to the file ingestion service or the report file content for download. In the latter case, the name of the file is provided in the header of the resonse with key='Filename'. schema: @@ -1889,7 +1912,7 @@ paths: - $ref: '#/parameters/DeleteCalibrationsRequestBody' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/DeleteCalibrationsPartialSuccessResponse' 204: description: No Content 400: From 340bebef598e96fe391fb50467ef2e8d5a1ff2e9 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 29 Jan 2020 11:14:12 +0000 Subject: [PATCH 040/108] Merged PR 58392: Get asset by id never returns 400 # Justification The route to get an asset by id never returns bad request. If the id is bad, not found is returned. If the id is empty the route that responds is different (get all assets). # Implementation Delete error code from documentation. # Testing N/A # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962497 --- asset-managment/niapm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index eb2a35a..e7dbecf 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1802,8 +1802,6 @@ paths: responses: 200: $ref: '#/responses/AssetDetailsResponse' - 400: - $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' 404: From f7d0321cace5fb65554e0f7ffd4af9907c2c4cff Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Wed, 29 Jan 2020 11:45:10 +0000 Subject: [PATCH 041/108] Merged PR 58119: Implemented the end multiple utilizations http route. # Justification We need to enable the users to update multiple utilization entries with the end timestamp over HTTP. # Implementation Implemented the web service logic and added a new method in the UtilizationFacade. This new method allows multiple utilizations to have the end timestamp updated. Up until now, updating the end timestamp was possible for one utilization at a time. # Testing Added tests for the new method from the UtilizationFacade and for the new method in the WebServiceFacade. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #961050 --- asset-managment/niapm.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index e7dbecf..21544d0 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -602,7 +602,7 @@ definitions: example: "2916201B245D642430" utilizationTimestamp: description: >- - A date time value which can be used to specify the end of an utilization. + A date time value which can be used to specify the end of an asset utilization. This parameter must have the "ISO 8601" format in order to be considered valid. type: string @@ -2030,8 +2030,8 @@ paths: It will return a partial success when end utilization information can be stored for only a subset of the utilization identifiers provided in the request. It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: end-multiple-asset-utilization - x-ni-operation: updateUtilization - x-ni-privilege: Update + x-ni-operation: writeAssets + x-ni-privilege: Write parameters: - $ref: '#/parameters/EndUtilizationRequest' responses: @@ -2056,8 +2056,8 @@ paths: It will return a partial success when utilization heartbeat information can be stored for only a subset of the utilization identifiers provided in the request. It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: asset-utilization-multiple-heartbeats - x-ni-operation: updateUtilization - x-ni-privilege: Update + x-ni-operation: writeAssets + x-ni-privilege: Write parameters: - $ref: '#/parameters/HeartbeatUtilizationRequest' responses: From 86bd98a9b3c797c8624c0baa2a008ab6bfcbe63c Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 29 Jan 2020 12:08:52 +0000 Subject: [PATCH 042/108] Merged PR 58395: Update query assets example to work with no changes # Justification The example filter for query-assets was too specific: filter assets with a specific name and take 0. It should be updated to a more generic filter so that no matter what you have in your database to get something, and take all (-1). # Implementation Add "example" next to "x-example" so that we have take: -1. Update the asset filter to obtain all system controllers. # Testing Checked yml in editor.swagger.io # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962510 --- asset-managment/niapm.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 21544d0..b8bdefb 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -615,6 +615,7 @@ definitions: entries 51 through 100. type: integer default: 0 + example: 0 x-example: 0 Take: description: @@ -624,6 +625,7 @@ definitions: entries 1 through 25. type: integer default: -1 + example: -1 x-example: -1 maximum: 1000 parameters: @@ -891,7 +893,7 @@ parameters: - ExternalCalibration.Operator.DisplayName: String representing the name of the operator which performed an external calibration on a third-party asset. type: string - example: AssetName = "APMPXI1Slot3" and ExternalCalibration.NextRecommendedDate > "2018-05-01T00:00:00.519Z" + example: IsSystemController = true QueryHistoryRequestBody: in: body name: queryHistory @@ -1032,8 +1034,10 @@ parameters: - SupportsSelfCalibration: Boolean flag specifying whether the asset supports self-calibration. - SelfCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was self-calibrated. Example: "2018-05-20T00:00:00Z" - + - SupportsExternalCalibration: Boolean flag specifying whether the asset supports external calibration. + + - CalibrationStatus: String enumeration representing the calibration status of an asset. Possible values are: OK, APPROACHING_RECOMMENDED_DUE_DATE, PAST_RECOMMENDED_DUE_DATE. - ExternalCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was externally-calibrated. Example: "2018-05-20T00:00:00Z" @@ -1047,7 +1051,7 @@ parameters: - ExternalCalibration.Operator.DisplayName: String representing the name of the operator which performed an external calibration on a third-party asset. type: string - example: AssetName = "APMPXI1Slot3" and ExternalCalibration.NextRecommendedDate > "2018-05-01T00:00:00.519Z" + example: IsSystemController = true utilizationIntervals: description: Multiple time intervals for which to retrieve asset utilization. type: array @@ -1215,6 +1219,8 @@ parameters: - SelfCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was self-calibrated. Example: "2018-05-20T00:00:00Z" - SupportsExternalCalibration: Boolean flag specifying whether the asset supports external calibration. + + - CalibrationStatus: String enumeration representing the calibration status of an asset. Possible values are: OK, APPROACHING_RECOMMENDED_DUE_DATE, PAST_RECOMMENDED_DUE_DATE. - ExternalCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was externally-calibrated. Example: "2018-05-20T00:00:00Z" @@ -1227,9 +1233,8 @@ parameters: - ExternalCalibration.IsLimited: Boolean flag specifying whether the last external calibration was a limited calibration. - ExternalCalibration.Operator.DisplayName: String representing the name of the operator which performed an external calibration on a third-party asset. - type: string - example: AssetName = "APMPXI1Slot3" and ExternalCalibration.NextRecommendedDate > "2018-05-01T00:00:00.519Z" + example: IsSystemController = true continuationToken: description: >- A token which allows the user to resume a query at the next item in From 2c4e01f7bed93ec1ebec44705f9e1fbb500c0288 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 29 Jan 2020 12:12:06 +0000 Subject: [PATCH 043/108] Merged PR 58397: Update Destination description and example for query location and calibration # Justification The provided example has JSON/INLINE which is an invalid combination. Change the example to CSV, DOWNLOAD. Reusing response Destination causes some weird documentation when viewing it on the query-locations route: "INLINE (default) returns the list of assets...". We should rename to "resources" # Implementation Changed "assets" to "resources" in the documentation. Provide a working example to the query (override the default one). # Testing View Swagger in the editor and run the example. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962517, #962518 --- asset-managment/niapm.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index b8bdefb..3925b92 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -494,9 +494,9 @@ definitions: title: Request Destination description: The destination of the request. - "INLINE" (default) returns the list of assets as the body of the response. - "DOWNLOAD" returns the list of assets as the body of the response and indicates to the client that it should be downloaded as a file. - "FILE_SERVICE" sends the list of assets to the file ingestion service and returns the ID of the file to the client in a JSON object. + "INLINE" (default) returns the list of resources as the body of the response. + "DOWNLOAD" returns the list of resources as the body of the response and indicates to the client that it should be downloaded as a file. + "FILE_SERVICE" sends the list of resources to the file ingestion service and returns the ID of the file to the client in a JSON object. type: string default: INLINE enum: @@ -512,6 +512,9 @@ definitions: $ref: '#/definitions/ResponseFormat' destination: $ref: '#/definitions/Destination' + example: + responseFormat: CSV + destination: DOWNLOAD ServicePolicyModel: title: Service policy description: An object containing the service policy. From 1fc7dbd9c9b4e73143cdc3a488345519c65eab83 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Wed, 29 Jan 2020 12:49:59 +0000 Subject: [PATCH 044/108] Merged PR 58403: Updated the description for query assets. # Justification The swagger document was not fully explaining the query-assets API. # Implementation Updated the documentation. # Testing Manually in the swagger editor. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #962507 --- asset-managment/niapm.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 3925b92..f70acf8 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -780,10 +780,10 @@ parameters: QueryAssetsRequest: in: body name: queryAssets - description: Request body consisting of filters to apply when retrieving assets. Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE] + description: Request body consisting of filters to apply when retrieving assets. Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE]. schema: title: Query Assets Request - description: Object containing filters to apply when retrieving assets. + description: Object containing filters to apply when retrieving assets. If no assets match the filter and the destination is "DOWNLOAD" or "FILE_SERVICE", an empty report will be generated. type: object properties: ids: @@ -801,7 +801,15 @@ parameters: take: $ref: '#/definitions/Take' calibratableOnly: - description: Whether to generate a report with calibrated asset specific columns. + description: >- + Whether to generate a report with calibrated asset specific columns. + + When the destination is "DOWNLOAD or "FILE_SERVICE" this property is used as follows: + + - It determines the type of the report. When true, the file will be a calibration report. If this is false, the file will be an asset report. + + - If asset ids are in the request, this property will not be used for filtering. If no asset ids are in the request, setting this property to true will generate a report only for the calibrated assets. + type: boolean default: false filter: From 56be60ab13b7342fa1d32762c3af99ac37b75ceb Mon Sep 17 00:00:00 2001 From: Alex Weaver Date: Wed, 29 Jan 2020 23:03:28 +0000 Subject: [PATCH 045/108] Merged PR 58541: Add optional ID part to file upload request # Justification The File AMQP API supports a client pre-determining the ID when uploading a file. This is used to solve an issue in the store & forward where file IDs are assigned after upload, but these IDs must also be attached to test results. This is extremely difficult to solve using other means, because files and test results are different services, and may not both be present at the same time. # Implementation The multipart/form-data request to upload a file now supports an optional third part, `id`, which may contain a UTF8-encoded file ID. If this is supplied, the service will use this ID for the new file, rather than generating one. If this provided ID is invalid, the service will simply generate its own, rather than reject the request. # Testing Uploaded a file using postman, specifying the ID. Verified that the file was created in FIS with the expected ID. # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki --- file/nifile.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/file/nifile.yml b/file/nifile.yml index d5cebc6..8c43b1f 100644 --- a/file/nifile.yml +++ b/file/nifile.yml @@ -842,6 +842,13 @@ paths: name: metadata description: JSON Dictionary with key/value pairs type: string + - in: formData + name: id + description: >- + Optional field that allows the client to specify the ID of the file + once it is uploaded. An ID is expected to be a 24-digit hex string, + which is unique among all files. + type: string responses: 201: description: OK From 2e476f570e0752c708c0199e2724948887fa78da Mon Sep 17 00:00:00 2001 From: Cameron Waterman Date: Wed, 29 Jan 2020 23:39:43 +0000 Subject: [PATCH 046/108] Merged PR 58560: Update Test Mon swagger doc example id's # Justification #900485 # Implementation Updated example id's # Testing N/A # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #900485 --- test-monitor/nitestmonitor-v1.yml | 32 +++++++++++++++---------------- test-monitor/nitestmonitor-v2.yml | 30 ++++++++++++++--------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/test-monitor/nitestmonitor-v1.yml b/test-monitor/nitestmonitor-v1.yml index 2309ea1..30e8157 100644 --- a/test-monitor/nitestmonitor-v1.yml +++ b/test-monitor/nitestmonitor-v1.yml @@ -349,7 +349,7 @@ definitions: type: array items: type: string - example: [df1b63da-4fd8-4466-b721-5a28de036f56] + example: [5e30934193cac8046851acb2] startedAt: description: ISO-8601 formatted timestamp indicating when the test result began type: string @@ -386,11 +386,11 @@ definitions: id: description: Id of the test result type: string - example: df1b63da-4fd8-4466-b721-5a28de036f56 + example: 5e30938d93cac80468534720 systemId: description: Id of the system type: string - example: 9c75f1b5-5882-490e-a2e2-1c14123d68b2 + example: 5e30931993cac8046850a996 hostName: description: Host name of the system type: string @@ -450,7 +450,7 @@ definitions: id: description: Test result id to update type: string - example: df1b63da-4fd8-4466-b721-5a28de036f56 + example: 5e30938d93cac80468534720 programName: description: Program name type: string @@ -497,7 +497,7 @@ definitions: type: array items: type: string - example: [df1b63da-4fd8-4466-b721-5a28de036f56] + example: [5e30934193cac8046851acb2] startedAt: description: ISO-8601 formatted timestamp indicating when the test result began type: string @@ -519,7 +519,7 @@ definitions: items: type: string example: - - 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + - 5e30938d93cac80468534720 programNames: description: Array of program names type: array @@ -554,7 +554,7 @@ definitions: items: type: string example: - - 9c75f1b5-5882-490e-a2e2-1c14123d68b2 + - 5e30931993cac8046850a996 hostNames: description: Array of host names type: array @@ -616,10 +616,10 @@ definitions: properties: stepId: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30934193cac8046851acb4 resultId: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 StepDataObject: title: Step Data description: Data returned by the test step @@ -683,14 +683,14 @@ definitions: items: type: string example: - - 3265bc91-f214-4efa-adfd-56f8ea717349 + - 5e30934193cac8046851acb4 resultIds: description: Array of result ids type: array items: type: string example: - - 9c75f1b5-5882-490e-a2e2-1c14123d68b2 + - 5e30938d93cac80468534720 path: description: Step path type: string @@ -701,8 +701,8 @@ definitions: items: type: string example: - - 9c75f1b5-5882-490e-a2e2-1c14123d68b2 - - 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + - 5e30934193cac8046851acb2 + - 5e30931993cac8046850a996 statuses: description: Array of step statuses type: array @@ -782,7 +782,7 @@ definitions: resultId: description: Result id type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 children: description: Nested child steps type: array @@ -860,7 +860,7 @@ definitions: resultId: description: Result id type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 path: description: Step path type: string @@ -1283,7 +1283,7 @@ paths: type: array items: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 deleteSteps: description: Indicates whether to delete the test steps associated with the test result type: boolean diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index dd8eaf9..52d7114 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -348,7 +348,7 @@ definitions: id: description: ID of the product type: string - example: 0365cee9-0e5d-4802-b0f6-9fedb8f08800 + example: 5e30931793cac80468509487 partNumber: description: The part number of the product type: string @@ -388,7 +388,7 @@ definitions: type: array items: type: string - example: [5ccb19ce5aa0a3348872c3e3] + example: [5e30934193cac8046851acb2] ProductUpdateRequestObject: title: Product Update Request type: object @@ -396,7 +396,7 @@ definitions: id: description: ID of the product to update type: string - example: 0365cee9-0e5d-4802-b0f6-9fedb8f08800 + example: 5e30931793cac80468509487 name: description: The name of the product type: string @@ -425,7 +425,7 @@ definitions: type: array items: type: string - example: [5ccb19ce5aa0a3348872c3e3] + example: [5e30934193cac8046851acb2] TestResultRequestObject: title: Test Result Request type: object @@ -476,7 +476,7 @@ definitions: type: array items: type: string - example: [df1b63da-4fd8-4466-b721-5a28de036f56] + example: [5e30934193cac8046851acb2] startedAt: description: ISO-8601 formatted timestamp indicating when the test result began type: string @@ -513,11 +513,11 @@ definitions: id: description: Id of the test result type: string - example: df1b63da-4fd8-4466-b721-5a28de036f56 + example: 5e30938d93cac80468534720 systemId: description: Id of the system type: string - example: 9c75f1b5-5882-490e-a2e2-1c14123d68b2 + example: 5e30931993cac8046850a996 hostName: description: Host name of the system type: string @@ -577,7 +577,7 @@ definitions: id: description: Test result id to update type: string - example: df1b63da-4fd8-4466-b721-5a28de036f56 + example: 5e30938d93cac80468534720 programName: description: Program name type: string @@ -624,7 +624,7 @@ definitions: type: array items: type: string - example: [df1b63da-4fd8-4466-b721-5a28de036f56] + example: [5e30934193cac8046851acb2] startedAt: description: ISO-8601 formatted timestamp indicating when the test result began type: string @@ -1103,10 +1103,10 @@ definitions: properties: stepId: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30934193cac8046851acb4 resultId: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 StepDataObject: title: Step Data description: Data returned by the test step @@ -1156,7 +1156,7 @@ definitions: resultId: description: Result id type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 children: description: Nested child steps type: array @@ -1238,7 +1238,7 @@ definitions: resultId: description: Result id type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 path: description: Step path type: string @@ -1885,7 +1885,7 @@ paths: type: array items: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30931793cac80468509487 responses: 200: $ref: '#/responses/DeleteProductsResponse' @@ -2116,7 +2116,7 @@ paths: type: array items: type: string - example: 1f05c3c8-7a8c-4ebb-a87f-7a60d5dd8938 + example: 5e30938d93cac80468534720 deleteSteps: description: Indicates whether to delete the test steps associated with the test result type: boolean From dfd8236f303f05a847614cfc5b952782fcdccae9 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Thu, 30 Jan 2020 08:21:36 +0000 Subject: [PATCH 047/108] Merged PR 57346: Asset Management OpenAPI updates to support create and update assets from beacons over HTTP # Justification We need to change our client beacons to send data over HTTP to the server. The current beacons either update asset's calibration information or create 3rd party assets (users define assets in a JSON file on the client machines and those are sent to the server). # Implementation Define 2 new HTTP routes in the APM Swagger document. These routes are: - [POST] v1/assets - to create a new asset - [POST] v1/upate-assets - to update an asset Here is [the design doc](https://ni.visualstudio.com/DevCentral/_git/Skyline/pullrequest/52380?_a=files&path=%2FSpecs%2FAsset%20Management%2F%5B20.0%5D%20Asset%20Salt%20Components%20over%20HTTP%2F%5BDesignDoc%5D%20Salt%20Components%20HTTP%20Communication.md). From the design document, we tackle only the minimum change for the 20.0 usecases (so not the full API to create or update any asset in any way). I created some base models to be shared between the routes used for querying the assets and the 2 new routes. # Testing Build and run unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 478 +++++++++++++++++++++++++++----------- 1 file changed, 337 insertions(+), 141 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index f70acf8..2330057 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -25,7 +25,7 @@ securityDefinitions: in: header name: Cookie security: - - apiKeyAuth: [] + - apiKeyAuth: [] - basicAuth: [] - cookieAuth: [] x-ni-routing-key: Skyline.AssetPerformanceManagement @@ -129,8 +129,18 @@ definitions: - ACCESSORY - CAN - SWITCH_BLOCK_DEVICE - SystemConnectionState: - title: System Connection State + AssetType: + title: Asset Type + description: All supported asset types. + type: string + default: GENERIC + enum: + - GENERIC + - DEVICE_UNDER_TEST + - FIXTURE + - SYSTEM + SystemConnectionStatus: + title: System Connection Status description: Whether or not the minion is connected to the server and has updated the server with its data. type: string enum: @@ -145,21 +155,22 @@ definitions: title: Asset Presence Status description: The status of an asset's presence in a system. type: string + default: NOT_PRESENT enum: - INITIALIZING - UNKNOWN - NOT_PRESENT - PRESENT CalibrationHistoryModel: + title: Calibration History + description: The calibration history for an asset. allOf: - $ref: '#/definitions/ExternalCalibrationModel' - - title: Calibration History - - description: The calibration history for an asset. - type: object - - required: + required: - id - calibrationType - - properties: + properties: id: description: The calibration entry identifier. type: string @@ -193,15 +204,24 @@ definitions: enum: - SELF_CALIBRATION - EXTERNAL_CALIBRATION - AssetStateModel: - title: Asset State - description: The status of an asset and the system to which it is connected. + AssetPresenceModel: + title: Asset Presence Model + description: The presence of an asset. Wraps the AssetPresenceStatus into an object. type: object + required: + - assetPresence properties: - systemConnection: - $ref: '#/definitions/SystemConnectionState' assetPresence: $ref: '#/definitions/AssetPresenceStatus' + AssetPresenceWithSystemConnectionModel: + title: Asset Presence With System Connection Model + description: The presence of an asset and the connection of the system in which it resides. + allOf: + - $ref: '#/definitions/AssetPresenceModel' + - type: object + properties: + systemConnection: + $ref: '#/definitions/SystemConnectionStatus' TemperatureSensorModel: title: Temperature Sensor description: The sensor name and temperature reading in Celsius. @@ -218,10 +238,12 @@ definitions: type: number format: double example: 25.8 - AssetLocationModel: - title: Asset Location - description: Information about the asset and the system in which it resides. + BaseAssetLocationModel: + title: Base Asset Location Model + description: Basic information about the asset and the system in which it resides. Base class for other models. type: object + required: + - minionId properties: minionId: description: Identifier of the minion where the asset is located. @@ -239,12 +261,28 @@ definitions: description: The number of the slot in which the asset is located. type: integer example: 2 - systemName: - description: Hostname of the system. - type: string - example: APM-PXI1 - state: - $ref: '#/definitions/AssetStateModel' + AssetLocationWithPresenceModel: + title: Asset Location With Presence Model + description: Information about the asset location and presence. Used in create or update operations. + allOf: + - $ref: '#/definitions/BaseAssetLocationModel' + - type: object + properties: + state: + $ref: '#/definitions/AssetPresenceModel' + AssetLocationModel: + title: Asset Location Model + description: Information about the asset location, presence and the connection status of the system in which it resides. + allOf: + - $ref: '#/definitions/BaseAssetLocationModel' + - type: object + properties: + systemName: + description: Hostname of the system. + type: string + example: APM-PXI1 + state: + $ref: '#/definitions/AssetPresenceWithSystemConnectionModel' ExternalCalibrationOperatorModel: title: External Calibration Operator description: The information about the operator who performed the calibration. @@ -253,9 +291,11 @@ definitions: displayName: description: Display name of logged in user. type: string + example: John Doe userId: description: Identifier of the logged in user. type: string + example: johnDoe2020 SelfCalibrationModel: title: Self-Calibration description: Contains data from the last self-calibration. @@ -313,119 +353,135 @@ definitions: comments: description: Calibration comments provided by an operator. type: string + example: This is a comment. ExternalCalibrationModel: + title: External Calibration + description: Data from the last external calibration. allOf: - $ref: '#/definitions/ExternalCalibrationBaseModel' - - title: External Calibration - - description: Data from the last external calibration - type: object - - properties: + properties: entryType: $ref: '#/definitions/CalibrationMode' operator: $ref: '#/definitions/ExternalCalibrationOperatorModel' + BaseAssetModel: + title: Base Asset Model + description: An object describing basic properties of an asset. Base class for other models. + allOf: + - $ref: '#/definitions/AssetIdentificationModel' + - type: object + properties: + name: + description: Name of the asset. + type: string + example: PCISlot2 + assetType: + $ref: '#/definitions/AssetType' + firmwareVersion: + description: Firmware version of the asset. + type: string + example: A1 + hardwareVersion: + description: Hardware version of the asset. + type: string + example: 12A + visaResourceName: + description: VISA resource name of the asset. + type: string + example : vs-1234 + temperatureSensors: + description: An array of temperature sensor information. + type: array + items: + $ref: '#/definitions/TemperatureSensorModel' + supportsSelfCalibration: + description: Whether the asset supports self-calibration. + type: boolean + example: true + supportsExternalCalibration: + description: Whether the asset supports external calibration. + type: boolean + example: true + selfCalibration: + $ref: '#/definitions/SelfCalibrationModel' + externalCalibration: + $ref: '#/definitions/ExternalCalibrationModel' + isNIAsset: + description: Whether this asset is an NI asset (true) or a third-party asset (false). + type: boolean + example: true + AssetCreateModel: + title: Asset Create Model + description: >- + An object describing the properties for creating an asset. + + + Unique Asset Identification is required to create an asset. See AssetIdentificationModel for details. + allOf: + - $ref: '#/definitions/BaseAssetModel' + - type: object + required: + - name + - location + properties: + location: + $ref: '#/definitions/AssetLocationWithPresenceModel' + AssetUpdateModel: + title: Asset Update Model + description: >- + An object describing the properties for updating an asset. + + + Unique Asset Identification is required to create an asset. If the id property is not specified, a set of properties are required to identify an asset. See AssetIdentificationModel for details. + If the id is specified on the model, the following properties will be ignored: busType, modelName, modelNumber, vendorName, vendorNumber and serialNumber. + allOf: + - $ref: '#/definitions/BaseAssetModel' + - type: object + properties: + id: + description: Unique identifier of the asset. + type: string + example: "29162;01B245D6;4243;0" + location: + $ref: '#/definitions/AssetLocationWithPresenceModel' AssetModel: title: Asset Model description: An object describing an asset with all of its properties. - type: object - required: - - id - - modelName - - modelNumber - - serialNumber - - vendorName - - vendorNumber - - busType - properties: - id: - description: Unique identifier of the asset. - type: string - example: "29162;01B245D6;4243;0" - serialNumber: - description: Serial number of the asset. - type: string - example: "01BB877A" - modelName: - description: Model name of the asset. - type: string - example: "NI PXIe-6368" - modelNumber: - description: Model number of the asset. - type: integer - example : 123 - vendorName: - description: Vendor name of the asset. - type: string - example: National Instruments - vendorNumber: - description: Vendor number of the asset. - type: integer - example: 4244 - name: - description: Name of the asset. - type: string - example: PCISlot2 - firmwareVersion: - description: Firmware version of the asset. - type: string - example: A1 - hardwareVersion: - description: Hardware version of the asset. - type: string - example: 12A - busType: - $ref: '#/definitions/BusType' - visaResourceName: - description: VISA resource name of the asset. - type: string - example : vs-1234 - location: - $ref: '#/definitions/AssetLocationModel' - temperatureSensors: - description: An array of temperature sensor information. - type: array - items: - $ref: '#/definitions/TemperatureSensorModel' - supportsSelfCalibration: - description: Whether the asset supports self-calibration. - type: boolean - example: true - supportsExternalCalibration: - description: Whether the asset supports external calibration. - type: boolean - example: true - selfCalibration: - $ref: '#/definitions/SelfCalibrationModel' - externalCalibration: - $ref: '#/definitions/ExternalCalibrationModel' - calibrationStatus: - $ref: '#/definitions/CalibrationStatus' - lastUpdatedTimestamp: - description: ISO-8601 formatted timestamp specifying the last date that the asset has had a property update. - type: string - format: date-time - example: '2018-05-07T18:58:05.219692Z' - isNIAsset: - description: Whether this asset is an NI asset (true) or a third-party asset (false). - type: boolean - example: true - isSystemController: - description: Whether this asset represents a System Controller. - type: boolean - example: true - properties: - description: Key-value-pair metadata associated with an asset. - type: object - additionalProperties: - type: string - example: - Key1: Value1 - keywords: - description: Words or phrases associated with an asset. - type: array - items: - type: string - example: Keyword1 + allOf: + - $ref: '#/definitions/BaseAssetModel' + - type: object + properties: + id: + description: Unique identifier of the asset. + type: string + example: "29162;01B245D6;4243;0" + location: + $ref: '#/definitions/AssetLocationModel' + calibrationStatus: + $ref: '#/definitions/CalibrationStatus' + isSystemController: + description: Whether this asset represents a System Controller. + type: boolean + example: true + properties: + description: Key-value-pair metadata associated with an asset. + type: object + additionalProperties: + type: string + example: + Key1: Value1 + keywords: + description: Words or phrases associated with an asset. + type: array + items: + type: string + example: Keyword1 + lastUpdatedTimestamp: + description: ISO-8601 formatted timestamp specifying the last date that the asset has had a property update. + type: string + format: date-time + example: '2018-05-07T18:58:05.219692Z' AssetWithAvailabilityHistoryModel: title: Asset With Availability History description: Information about the availability, or connection, history of an asset, which also contains information about each system in which the asset was present. @@ -723,6 +779,36 @@ parameters: items: type: string example: ["29162;01B245D6;4243;0"] + CreateAssetsRequestBody: + in: body + name: createAssets + description: Request body containing an array of assets that should be created. + required: true + schema: + title: Create Assets Request + description: Request body containing an array of assets that should be created. + type: object + properties: + assets: + description: Multiple assets that should be created. + type: array + items: + $ref: '#/definitions/AssetCreateModel' + UpdateAssetsRequestBody: + in: body + name: updateAssets + description: Request body containing an array of assets to update. + required: true + schema: + title: Update Assets Request + description: Request body containing an array of assets to update. + type: object + properties: + assets: + description: Multiple assets that should be updated. + type: array + items: + $ref: '#/definitions/AssetUpdateModel' DeleteCalibrationsRequestBody: in: body name: deleteCalibrationsRequestBody @@ -1407,11 +1493,11 @@ responses: description: Asset summary response containing the count of active assets, inactive assets and the total number of assets. schema: title: Asset Summary Response - description: Asset summary response containing the total number of assets, the number of assets which are active (present in a connected system) and the number of assets which are not active. + description: Asset summary response containing the total number of assets, the number of assets which are active, i.e. present in a connected system, and the number of assets which are not active. type: object properties: active: - description: Number of assets which are active (present in a connected system). + description: Number of assets which are active, i.e. present in a connected system. type: integer example: 12 notActive: @@ -1527,6 +1613,25 @@ responses: example: "5c4f0834174ae321b8a95a03" error: $ref: '#/definitions/Error' + CreateAssetsPartialSuccessResponse: + description: Create Assets Partial Success Response + schema: + title: CreateAssetsPartialSuccessResponse + description: Create Assets Partial Success Response + type: object + properties: + assets: + description: Array of created assets + type: array + items: + $ref: '#/definitions/AssetModel' + failed: + description: Array of assets create requests that failed + type: array + items: + $ref: '#/definitions/AssetCreateModel' + error: + $ref: '#/definitions/Error' SendToFileIngestionOrDownloadResponse: description: Response for the query operation that consists either in the file information for when the result was sent to the file ingestion service or the report file content for download. In the latter case, the name of the file is provided in the header of the resonse with key='Filename'. schema: @@ -1544,6 +1649,25 @@ responses: description: Service policy response containing the service calibration policy with the number of days for an asset to be considered as approaching calibration. schema: $ref: '#/definitions/ServicePolicyModel' + UpdateAssetsPartialSuccessResponse: + description: Update Assets Partial Success Response + schema: + title: UpdateAssetsPartialSuccessResponse + description: Update Assets Partial Success Response + type: object + properties: + assets: + description: Array of updated assets + type: array + items: + $ref: '#/definitions/AssetModel' + failed: + description: Array of assets update requests that failed + type: array + items: + $ref: '#/definitions/AssetUpdateModel' + error: + $ref: '#/definitions/Error' UtilizationWithPercentageResponse: description: Utilization response containing the collection of utilizations matching the provided filters, in a specific time interval. Besides a time interval, each element contains an asset identifier, a minion id, an utilization category, and a percentage of time that the asset was utilized in the time interval. schema: @@ -1754,14 +1878,86 @@ paths: $ref: '#/responses/Unauthorized' default: $ref: '#/responses/Error' + post: + tags: [assets] + summary: Creates assets + description: >- + Creates new assets with the provided information. + + + If an asset with the provided identification does not exist on the server, a new asset is created. If an asset with the provided identification already exists on the server, no create or update operation will be performed for the respective identification and the final response will contain an error message describing the actual reason. + + + If the selfCalibration property is set, the supportsSelfCalibration property is automatically set to true by the service no matter if it is specified as false. The same is true for the externalCalibration and supportsExternalCalibration properties. + operationId: create-assets + x-ni-operation: writeAssets + x-ni-privilege: Write + parameters: + - $ref: '#/parameters/CreateAssetsRequestBody' + responses: + 200: + $ref: '#/responses/CreateAssetsPartialSuccessResponse' + 201: + description: Created + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /v1/update-assets: + post: + tags: [assets] + summary: Updates multiple assets + description: >- + Updates multiple assets. If an asset with the provided identification does not exist, that asset is not created and an error is returned instead. + Any property that is not set or set to null is ignored. + + The properties that cannot be updated are: + + - busType + + - modelName + + - modelNumber + + - vendorName + + - vendorNumber + + - serialNumber + + - id + + + If the selfCalibration property is set, the supportsSelfCalibration property is automatically set to true by the service, no matter if it is specified as false. The same is true for the externalCalibration and supportsExternalCalibration properties. + + + Updating the assetPresence property to NOT_PRESENT succeeds only if it is updated with the same minionId, parent and slotNumber. Updating it to PRESENT always succeeds. + operationId: update-assets + x-ni-operation: writeAssets + x-ni-privilege: Write + parameters: + - $ref: '#/parameters/UpdateAssetsRequestBody' + responses: + 200: + $ref: '#/responses/UpdateAssetsPartialSuccessResponse' + 204: + description: No Content + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' /v1/asset-summary: get: tags: [assets] summary: Gets a summary of assets - description: Gets asset summary response containing the total number of assets, the number of assets which are active (present in a connected system) and the number of assets which are not active. + description: Gets asset summary response containing the total number of assets, the number of assets which are active, i.e. present in a connected system, and the number of assets which are not active. operationId: get-asset-summary x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read responses: 200: $ref: '#/responses/AssetSummaryResponse' @@ -1776,7 +1972,7 @@ paths: description: Gets asset summary of the total number of assets supporting calibration, the number of assets approaching calibration date and the number of assets past their calibration date operationId: get-calibratable-asset-summary x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read responses: 200: $ref: '#/responses/CalibratedAssetSummaryResponse' @@ -1812,7 +2008,7 @@ paths: description: Gets the asset which has the given identifier. operationId: get-asset-with-identifier x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetId' responses: @@ -1831,7 +2027,7 @@ paths: description: Returns availability information for an asset in the specified timespan and split based on the specified time granularity. operationId: get-asset-availability-history x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetId' - in: query @@ -1875,7 +2071,7 @@ paths: description: Returns the calibration history of the asset which has the given identifier. operationId: get-asset-calibration-history x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/Skip' @@ -1897,7 +2093,7 @@ paths: description: Creates a new calibration history entry for a third-party asset. operationId: post-asset-calibration-history x-ni-operation: writeAssets - x-ni-priviledge: Write + x-ni-privilege: Write x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: - $ref: '#/parameters/AssetId' @@ -1920,7 +2116,7 @@ paths: description: Deletes multiple calibration history entries for an asset. operationId: post-delete-asset-calibration-history x-ni-operation: deleteAssets - x-ni-priviledge: Write + x-ni-privilege: Write parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/DeleteCalibrationsRequestBody' @@ -1944,7 +2140,7 @@ paths: description: Computes the calibration history of an asset in CSV format. If the destination is download, the response will contain the calibration history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-calibration-history x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/QueryHistoryRequestBody' @@ -1968,7 +2164,7 @@ paths: description: Computes the location history of an asset in CSV format. If the destination is download, the response will contain the location history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-location-history x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/QueryHistoryRequestBody' @@ -1992,7 +2188,7 @@ paths: description: Performs a request to update the metadata information of an asset. operationId: update-asset-metadata x-ni-operation: writeAssets - x-ni-priviledge: Write + x-ni-privilege: Write consumes: - application/merge-patch+json parameters: @@ -2088,7 +2284,7 @@ paths: 404: $ref: '#/responses/NotFound' default: - $ref: '#/responses/Error' + $ref: '#/responses/Error' /v1/compare-assets-availability: post: tags: [assets] @@ -2096,7 +2292,7 @@ paths: description: Gets availability history for multiple assets based on a specified timespan. operationId: compare-asset-availability x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read parameters: - $ref: '#/parameters/AssetAvailabilityComparison' responses: @@ -2128,7 +2324,7 @@ paths: description: Deletes all persisted data for the assets with the provided identifiers. This includes asset properties and all related historical information. operationId: delete-assets x-ni-operation: deleteAssets - x-ni-priviledge: Write + x-ni-privilege: Write parameters: - $ref: '#/parameters/DeleteAssetsRequestBody' responses: @@ -2189,7 +2385,7 @@ paths: description: Retrieves the service policy. operationId: get-policy x-ni-operation: readAssets - x-ni-priviledge: Read + x-ni-privilege: Read responses: 200: $ref: '#/responses/ServicePolicyResponse' @@ -2203,7 +2399,7 @@ paths: description: Performs a request to update the service policy. operationId: update-policy x-ni-operation: writeAssets - x-ni-priviledge: Write + x-ni-privilege: Write consumes: - application/merge-patch+json parameters: From 5cd6f3079b6de9b0053edbbc6a7a7120af8d987d Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Thu, 30 Jan 2020 14:03:49 +0000 Subject: [PATCH 048/108] Merged PR 58425: Update metadata returns updated and not updated keywords and properties # Justification Update Asset Metadata must return a partial success with the updated and not updated properties and keywords. # Implementation Changed AssetsFacade to return what it updated and what not. Changed web service facade to put that info on the partial success response. Update tests. # Testing Ran all unit tests. Looked at the swagger document in editor.swagger.io # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #964582, #966359 --- asset-managment/niapm.yml | 80 +++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 8 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 2330057..d46724e 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -482,6 +482,24 @@ definitions: type: string format: date-time example: '2018-05-07T18:58:05.219692Z' + AssetMetadata: + title: Asset Metadata + description: Information about asset metadata + type: object + properties: + keywords: + description: Words or phrases associated with an asset. + type: array + items: + type: string + example: Keyword1 + properties: + description: Key-value-pair metadata associated with an asset. + type: object + additionalProperties: + type: string + example: + Key1: Value1 AssetWithAvailabilityHistoryModel: title: Asset With Availability History description: Information about the availability, or connection, history of an asset, which also contains information about each system in which the asset was present. @@ -877,7 +895,7 @@ parameters: type: array items: type: string - example: ["29162;01B245D6;4243;0"] + example: [] responseFormat: $ref: '#/definitions/ResponseFormat' destination: @@ -1160,18 +1178,22 @@ parameters: description: >- A date time value which can be used to specify the beginning of a timespan. - This parameter is required to have the "ISO 8601" format in order to be considered valid. + This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. type: string format: date-time - example: '2019-05-01T00:00:00.519Z' + example: '2019-05-01T00:00:00.000Z' endDate: description: >- A date time value which can be used to specify the end of a timespan. This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. type: string format: date-time - example: '2019-05-20T00:00:00Z' + example: '2019-05-20T00:00:000Z' QueryAssetUtilizationHistoryRequest: in: body name: queryBody @@ -1528,7 +1550,7 @@ responses: type: array items: type: string - example: "29162;01B245D6;4243;0" + example: "13562;01B245D6;4243;0" error: $ref: '#/definitions/Error' AvailabilityInSystemResponse: @@ -1668,6 +1690,44 @@ responses: $ref: '#/definitions/AssetUpdateModel' error: $ref: '#/definitions/Error' + UpdateAssetMetadataPartialSuccessResponse: + description: Update Asset Metadata Partial Success Response + schema: + description: Update Asset Metadata Partial Success Response + title: UpdateAssetMetadataPartialSuccessResponse + type: object + required: + - succeeded + properties: + succeeded: + $ref: '#/definitions/AssetMetadata' + failed: + $ref: '#/definitions/AssetMetadata' + error: + $ref: '#/definitions/Error' + example: + succeeded: + keywords: [ Keyword1 ] + properties: + Key1: Value1 + failed: + keywords: [ BadKeyword1 ] + properties: + BadKey1: BadValue1 + error: + name: Skyline.OneOrMoreErrorsOccurred + code: -251040 + message: >- + One or more errors occurred. See the contained list for details of each + error. + args: [] + innerErrors: + - name: AssetPerformanceManagement.InvalidKeywordInUpdateMetadataRequest + code: -253435 + resourceType: Asset + resourceId: BadKeyword1 + message: 'Invalid keyword value: BadKeyword1.' + args: [BadKeyword1] UtilizationWithPercentageResponse: description: Utilization response containing the collection of utilizations matching the provided filters, in a specific time interval. Besides a time interval, each element contains an asset identifier, a minion id, an utilization category, and a percentage of time that the asset was utilized in the time interval. schema: @@ -1841,7 +1901,11 @@ paths: get: tags: [assets] summary: Gets assets - description: Gets a list of assets. Calibrated assets can be obtained by setting calibratableOnly=true. To obtain a report of the assets, reponseFormat=csv&destination=download should be sent as query parameters. + description: >- + Gets a list of assets. Calibrated assets can be obtained by setting calibratableOnly=true. To obtain a report of the assets, reponseFormat=csv&destination=download should be sent as query parameters. + + + Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE]. operationId: get-assets x-ni-operation: readAssets x-ni-privilege: Read @@ -2040,7 +2104,7 @@ paths: The time component of the request is ignored. type: string - x-example: '2018-05-01T00:00:00.519Z' + x-example: '2018-05-01T00:00:00.000Z' - in: query name: endDate required: true @@ -2196,7 +2260,7 @@ paths: - $ref: '#/parameters/UpdateMetadata' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/UpdateAssetMetadataPartialSuccessResponse' 204: description: No Content 400: From 565c3ef0bebe5bd547b5a9b0d585f45315c409dd Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Mon, 3 Feb 2020 02:30:08 +0000 Subject: [PATCH 049/108] Merged PR 58658: Add checksum for the create/update asset models # Justification After discussion with Josh, we should add the checksum for external calibration to the asset-create and asset-update routes # Implementation Update Swagger to contain this change. # Testing Visualize objects in editor.swagger.io # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index d46724e..80829f9 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -365,6 +365,17 @@ definitions: $ref: '#/definitions/CalibrationMode' operator: $ref: '#/definitions/ExternalCalibrationOperatorModel' + ExternalCalibrationWithChecksumModel: + title: External Calibration + description: Data from the last external calibration including checksum. + allOf: + - $ref: '#/definitions/ExternalCalibrationModel' + - type: object + properties: + checksum: + description: Checksum for the external calibration. + type: string + example: 7d9f4953655d48a6a5fd68e9dfd41345 BaseAssetModel: title: Base Asset Model description: An object describing basic properties of an asset. Base class for other models. @@ -405,8 +416,6 @@ definitions: example: true selfCalibration: $ref: '#/definitions/SelfCalibrationModel' - externalCalibration: - $ref: '#/definitions/ExternalCalibrationModel' isNIAsset: description: Whether this asset is an NI asset (true) or a third-party asset (false). type: boolean @@ -427,6 +436,8 @@ definitions: properties: location: $ref: '#/definitions/AssetLocationWithPresenceModel' + externalCalibration: + $ref: '#/definitions/ExternalCalibrationWithChecksumModel' AssetUpdateModel: title: Asset Update Model description: >- @@ -445,6 +456,8 @@ definitions: example: "29162;01B245D6;4243;0" location: $ref: '#/definitions/AssetLocationWithPresenceModel' + externalCalibration: + $ref: '#/definitions/ExternalCalibrationWithChecksumModel' AssetModel: title: Asset Model description: An object describing an asset with all of its properties. @@ -464,6 +477,8 @@ definitions: description: Whether this asset represents a System Controller. type: boolean example: true + externalCalibration: + $ref: '#/definitions/ExternalCalibrationModel' properties: description: Key-value-pair metadata associated with an asset. type: object From 8ab798275c8c04388671e751e2e8bd1d2919e977 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Mon, 3 Feb 2020 08:41:47 +0000 Subject: [PATCH 050/108] Merged PR 58819: Added utilization ids arrays for failed and succeeded end utilization updates. Also 404 -> 200. # Justification Added utilization ids arrays for failed and succeeded end utilization updates. Also 404 -> 200. # Implementation The utilization facade returns a summary of the succeeded and failed operations and the web service facade builds the errors. # Testing Updated the existing tests. Since the web service deals with the error codes now, a new test was added to ensure the proper error codes are returned. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #964584 --- asset-managment/niapm.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 80829f9..062d742 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1871,6 +1871,29 @@ responses: type: string example: token + UpdateUtilizationPartialSuccessResponse: + description: Update utilization partial success response. The update operation can be either a heartbeat update or a utilization end. + schema: + description: Update utilization partial success response. + title: UpdateUtilizationPartialSuccessResponse + type: object + required: + - updatedUtilizationIds + properties: + updatedUtilizationIds: + description: Array of utilization identifiers for the entries that were updated. + type: array + items: + type: string + example: "5c4f0834174ae321b8a95a03" + failed: + description: Array of utilization identifiers for the entries that failed to update. + type: array + items: + type: string + example: "5c4f0834174ae321b8a95a04" + error: + $ref: '#/definitions/Error' paths: /: get: @@ -2327,15 +2350,13 @@ paths: - $ref: '#/parameters/EndUtilizationRequest' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/UpdateUtilizationPartialSuccessResponse' 204: description: No Content 400: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/assets/utilization-heartbeat: @@ -2353,15 +2374,13 @@ paths: - $ref: '#/parameters/HeartbeatUtilizationRequest' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/UpdateUtilizationPartialSuccessResponse' 204: description: No Content 400: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/compare-assets-availability: From cbbc39bf6590a010c006afe859980f7cafa1522a Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Mon, 3 Feb 2020 11:21:12 +0000 Subject: [PATCH 051/108] Merged PR 58790: Do not return 404 when the URL is found # Justification In SystemLink, we return 404 only if the URL is not found. If the URL is found, but some/all resources in the request body are not found, partial success or bad request or empty response is returned, depending on the actual route. # Implementation Changed several routes to not return 404 any more. Update the Swagger and the web service facade. Routes covered: - compare availability - delete assets - query assets - query asset utilization - read asset utilization # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #966272, #966308, #966348, #966349, #966874 --- asset-managment/niapm.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 062d742..4ba3212 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2099,8 +2099,6 @@ paths: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/assets/{assetId}: @@ -2405,14 +2403,18 @@ paths: type: array items: $ref: '#/definitions/AssetWithAvailabilityHistoryModel' + failed: + description: Array of asset identifiers for which obtaining availability failed + type: array + items: + type: string + example: [ "13562;01B245D6;4243;0" ] error: $ref: '#/definitions/Error' 400: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/delete-assets: @@ -2451,8 +2453,6 @@ paths: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/query-asset-utilization-history: @@ -2472,8 +2472,6 @@ paths: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/policy: From 3f40e7cbf4b4fe1d2ea718bdb8b6380e3bec4f7e Mon Sep 17 00:00:00 2001 From: Tudor Ludusan Date: Wed, 5 Feb 2020 08:36:13 +0000 Subject: [PATCH 052/108] Merged PR 59233: Update peristance model for Assets to contain AssetType and DiscoveryType # Justification In accordance with the design doc here: !52380 # Implementation This is the follow-up change to !57335 in the series of changes to split the AssetClass into an AssetType and a DiscoveryType for assets. Here's the diagram to illustrate the plan: https://ni.visualstudio.com/94b22d7b-ad7b-4f5e-88f0-867910f91c94/_apis/git/repositories/8159353b-4403-4eed-9a32-0c2ee30abe3d/Items?path=%2FSpecs%2FAsset+Management%2F[20.0]+Asset+Salt+Components+over+HTTP%2FAssetClassChanges.png&versionDescriptor[versionOptions]=0&versionDescriptor[versionType]=2&versionDescriptor[version]=d2ccbf15a49bec3a97981df8aee69b90bd7c2019&download=false&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1 This change updates the persistence model to contain the AssetType and DiscoveryType properties, while removing the AssetClass and IsSystemController properties. The AssetClass property is removed throughout the layers, as it was a half-baked way of specifying both discovery type and asset type, and we're moving away from that. The IsSystemController is currently exposed on the query-assets route, so we're going to continue supporting it, but this will just be a computed property on the DomainModel alone. This also requires the following changes: 1. Create a migration to create the new properties and drop the existing ones (see MigrationManager.cs) 2. Preprocess the filter `"IsSystemController = True"` to be converted into an `"AssetType = \"SYSTEM\""` filter (see AssetsFacade.cs) The migration happened in accordance with the table bellow: | IsSystemController|AssetClass|**DiscoveryType**|**AssetType**| |---|---|---|---| |false|Unspecified|Manual|Generic| |false|Discovered|_Automatic_|Generic| |false|Asset|Manual|Generic| |false|Dut|Manual|DeviceUnderTest| |false|Fixture|Manual|Fixture| |true|Unspecified|Manual|_System_| |true|Discovered|_Automatic_|_System_| |true|Asset|Manual|_System_| |true|Dut|Manual|_System_| |true|Fixture|Manual|_System_| # Testing Updated existing tests to verify the new properties. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #961048 --- asset-managment/niapm.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 4ba3212..7f61cb2 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -967,8 +967,6 @@ parameters: - AssetIdentifier: String representing the unique identifier of an asset. - - AssetClass: String enumeration representing the class of an asset. Possible values are: UNDEFINED, DISCOVERED, ASSET, DUT, FIXTURE. - - SerialNumber: String representing the serial number of an asset. - ModelName: String representing the model name of an asset. @@ -1125,8 +1123,6 @@ parameters: - AssetIdentifier: String representing the unique identifier of an asset. - - AssetClass: String enumeration representing the class of an asset. Possible values are: UNDEFINED, DISCOVERED, ASSET, DUT, FIXTURE. - - SerialNumber: String representing the serial number of an asset. - ModelName: String representing the model name of an asset. @@ -1312,8 +1308,6 @@ parameters: - AssetIdentifier: String representing the unique identifier of an asset. - - AssetClass: String enumeration representing the class of an asset. Possible values are: UNDEFINED, DISCOVERED, ASSET, DUT, FIXTURE. - - SerialNumber: String representing the serial number of an asset. - ModelName: String representing the model name of an asset. From 8a63f175db9a02b9cd90c37097815102a2a914a4 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Thu, 6 Feb 2020 10:16:33 +0000 Subject: [PATCH 053/108] Merged PR 59545: Groupname and channel name are not always required. This is a showstopper for argon. # Justification There are times when groupName and channelName can be null. This was broken in the yml transition. # Implementation Mark group and channel names as not required. # Testing Tested in product. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 0d4ded4..d43b8ea 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -251,8 +251,6 @@ definitions: example: Channel 1 required: - fileId - - groupName - - channelName ChannelSpecifications: description: Array of x-y channel groups. The x channel of each grouping is optional. properties: From 88869d751855de0c59203391cdcae7729ddc03c9 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Thu, 6 Feb 2020 14:09:01 +0000 Subject: [PATCH 054/108] Merged PR 59571: do grouping 1st class by adding stride, group, max, groupChannels, etc. # Justification Argon requires fancier grouping behavior: stride, max, groupChannels, etc. # Implementation yml, midl, etc. and refactorings to get these things in. # Testing Tested in argon, new c# tests for grouping. All other tests run. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index d43b8ea..42a6bf6 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -233,7 +233,29 @@ definitions: type: boolean description: Look for specific properties in a channel that define the start and increment x values to use for each channel. default: false - + groupBy: + type: string + description: List of channels to group by. + default: null + example: 'y0,x' + groupStride: + type: integer + description: Number of samples per group. + default: null + format: int32 + example: 100 + groupChannels: + type: array + items: + $ref: '#/definitions/OneChannelSpecifier' + default: null + description: Channels to use only to group. Values from these channels are not returned. + maxGroupsToReturn: + type: integer + default: null + format: int32 + description: Maximum number of groups to return when grouping. + example: 100 OneChannelSpecifier: description: Specification for a channel of data properties: From dba0454d17959d5889a273b2c099dd28c6067235 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Fri, 7 Feb 2020 10:27:04 +0000 Subject: [PATCH 055/108] Merged PR 59722: calculate function prior to grouping - it won't work the other way. Add more tests with group and filter channels. # Justification Users may want to combine all/most tdmreader features. Further testing revealed a few more bugs with combined operations. # Implementation Reorder some calls, add some tests. Add sortChannels, generalize the concept of 'special channels' which aren't returned, but which are used for sorting, grouping, etc. # Testing Added more tests to test function combinations. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 42a6bf6..2e6bdf1 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -228,7 +228,13 @@ definitions: type: string default: null description: Specify how to sort values before returning them. - example: '-y0,x' + example: '-y0,x,s0' + sortChannels: + type: array + items: + $ref: '#/definitions/OneChannelSpecifier' + default: null + description: Channels to use only to sort. Values from these channels are not returned. useWaveformProperties: type: boolean description: Look for specific properties in a channel that define the start and increment x values to use for each channel. From 15fd59fa03c5f8412a26e3889173d31a4cf2f882 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Mon, 10 Feb 2020 12:57:51 +0000 Subject: [PATCH 056/108] Merged PR 59824: AM HTTP Route Update - Start Utilization should return partial success instead of 404 and the failed and successful asset identifications. # Justification Start Utilization should return partial success instead of 404 and the failed and successful asset identifications. # Implementation The utilization facade deals with starting the utilization and returning a class that contains a summary of the failed and succeeded operations. The webservice then builds the error message and returns it. # Testing Updated all the tests to validate the new specification. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #964583, #966877 --- asset-managment/niapm.yml | 43 +++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 7f61cb2..7a8033e 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1397,7 +1397,7 @@ parameters: required: - utilizationIdentifier - minionId - - assetIdentifiers + - assetIdentifications - utilizationCategory - utilizationTimestamp properties: @@ -1409,7 +1409,7 @@ parameters: description: Identifier of the minion where the utilized assets are located. type: string example: NI_PXIe-8135_Embedded_Controller--MAC-00-80-2F-23-52-65 - assetIdentifiers: + assetIdentifications: description: Array of the identification information for the assets which are utilized. type: array items: @@ -1482,15 +1482,6 @@ responses: No asset found with the specified identifier: 29162;01B245D6;4243;0. args: [29162;01B245D6;4243;0] innerErrors: [] - PartialSuccess: - description: Partial Success is returned in the case when only a part of the request body information was processed successfully. - schema: - title: Partial Success Response - description: Partial success response containing error information. - type: object - properties: - error: - $ref: '#/definitions/Error' Unauthorized: description: Not authorized headers: @@ -1888,6 +1879,27 @@ responses: example: "5c4f0834174ae321b8a95a04" error: $ref: '#/definitions/Error' + StartUtilizationPartialSuccessResponse: + description: Start utilization partial success response. + schema: + description: Start utilization partial success response. + title: StartUtilizationPartialSuccessResponse + type: object + required: + - assetsWithStartedUtilization + properties: + assetsWithStartedUtilization: + description: Array containing the asset identification data for the assets that started being utilized. + type: array + items: + $ref: '#/definitions/AssetIdentificationModel' + failed: + description: Array containing the asset identification data for the assets that failed to start being utilized. + type: array + items: + $ref: '#/definitions/AssetIdentificationModel' + error: + $ref: '#/definitions/Error' paths: /: get: @@ -2307,24 +2319,21 @@ paths: summary: Stores assets utilization start description: >- Stores information related to assets utilization start. The operation is succesful when utilization information can be stored for all asset identifiers provided in the request. - It will return a partial success when utilization information can be stored for only a subset of the asset identifiers provided in the request. - It will return a not found response when no stored assets matched the provided asset identifiers. + It will return a partial success when storing the utilization start information failed for one or more assets. operationId: start-multiple-asset-utilization x-ni-operation: createUtilization - x-ni-privilege: Create + x-ni-privilege: Write parameters: - $ref: '#/parameters/StartUtilizationRequest' responses: 200: - $ref: '#/responses/PartialSuccess' + $ref: '#/responses/StartUtilizationPartialSuccessResponse' 201: description: Created 400: $ref: '#/responses/BadRequest' 401: $ref: '#/responses/Unauthorized' - 404: - $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' /v1/assets/end-utilization: From 6be3397fb6cf955d2b6f85a065afd7fa39db5df2 Mon Sep 17 00:00:00 2001 From: Sergey Kizunov Date: Tue, 11 Feb 2020 08:15:13 +0000 Subject: [PATCH 057/108] Merged PR 60019: NBExec OpenAPI doc changes for org modeling # Justification Support org modeling for NBExec. # Testing Tested with perforce changes here: https://review-board.natinst.com/r/325787/ --- ni-notebook-execution/ninbexec.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ni-notebook-execution/ninbexec.yml b/ni-notebook-execution/ninbexec.yml index e3c97fc..8549194 100644 --- a/ni-notebook-execution/ninbexec.yml +++ b/ni-notebook-execution/ninbexec.yml @@ -1032,6 +1032,7 @@ paths: - $ref: '#/parameters/notebookPath' get: operationId: GetNotebook + x-ni-auth: true x-ni-operation: queryNotebooks x-ni-privilege: Read x-ni-oldest-compatible-version: 1 @@ -1051,6 +1052,7 @@ paths: /v2/query-notebooks: post: operationId: QueryNotebooksV2 + x-ni-auth: true x-ni-operation: queryNotebooks x-ni-privilege: Read x-ni-request-variables: [REMOTE_USER] @@ -1099,6 +1101,7 @@ paths: Downloads a notebook file in a single HTTP response. Use the inline parameter in the query string to control the download behavior. operationId: DownloadNotebook + x-ni-auth: true x-ni-operation: downloadNotebook x-ni-privilege: Read x-ni-request-variables: @@ -1137,6 +1140,7 @@ paths: - $ref: '#/parameters/executionId' get: operationId: GetExecution + x-ni-auth: true x-ni-operation: queryExecutions x-ni-privilege: Read x-ni-oldest-compatible-version: 1 @@ -1171,6 +1175,7 @@ paths: /v2/delete-executions: post: operationId: DeleteExecutions + x-ni-auth: true x-ni-operation: deleteExecutions x-ni-privilege: Write x-ni-oldest-compatible-version: 1 @@ -1207,6 +1212,7 @@ paths: /v2/query-executions: post: operationId: QueryExecutionsV2 + x-ni-auth: true x-ni-operation: queryExecutions x-ni-privilege: Read summary: Query executions of Jupyter notebooks @@ -1247,6 +1253,7 @@ paths: /v2/executions: post: operationId: CreateExecutions + x-ni-auth: true x-ni-operation: createExecutions x-ni-privilege: Read x-ni-request-all-privileges: true @@ -1288,6 +1295,7 @@ paths: /v2/cancel-executions: post: operationId: CancelExecutions + x-ni-auth: true x-ni-operation: cancelExecutions x-ni-privilege: Write x-ni-oldest-compatible-version: 1 @@ -1324,6 +1332,7 @@ paths: /v1/query-notebooks: post: operationId: QueryNotebooks + x-ni-auth: true x-ni-operation: queryNotebooks x-ni-privilege: Read x-ni-request-variables: [REMOTE_USER] @@ -1384,6 +1393,7 @@ paths: /v1/query-executions: post: operationId: QueryExecutions + x-ni-auth: true x-ni-operation: queryExecutions x-ni-privilege: Read summary: Query executions of Jupyter notebooks From f54d43d6a43ac5e8b73e12cf7a81a7a8b26434a7 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Tue, 11 Feb 2020 14:33:00 +0000 Subject: [PATCH 058/108] Merged PR 59699: Implement update-assets route # Justification Clients need a way to update assets using HTTP. # Implementation Implement the HTTP update-assets route. Handle error cases. Make sure only the provided properties are updated. # Testing Wrote unit tests and make sure they pass. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #961042 --- asset-managment/niapm.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 7a8033e..b05427d 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -133,7 +133,6 @@ definitions: title: Asset Type description: All supported asset types. type: string - default: GENERIC enum: - GENERIC - DEVICE_UNDER_TEST @@ -453,7 +452,7 @@ definitions: id: description: Unique identifier of the asset. type: string - example: "29162;01B245D6;4243;0" + example: "123;01BB877A;4244;0" location: $ref: '#/definitions/AssetLocationWithPresenceModel' externalCalibration: @@ -653,8 +652,6 @@ definitions: - vendorName or vendorNumber - serialNumber or minionId (part of the Location) type: object - required: - - busType properties: modelName: description: Model name of the asset. From b0743efb9fc8e24ad6825654013f9ce543ca53c5 Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Tue, 11 Feb 2020 16:45:37 +0000 Subject: [PATCH 059/108] Merged PR 60214: Start Utilization Route only returns Partial Success. Removed Created Fully Succeeded response. # Justification RPC style route. Does not need the 201 created empty response. Can reuse the 200 partial success as a 'response' object for the RPC method. # Implementation Updated the facade and the test. # Testing Actually tested IN the product, calling the route from C++ :) # Checklist - [X] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index b05427d..cdd1038 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2325,8 +2325,6 @@ paths: responses: 200: $ref: '#/responses/StartUtilizationPartialSuccessResponse' - 201: - description: Created 400: $ref: '#/responses/BadRequest' 401: From 62d9a3b9297452b4ebaef57ed4bae8e7411fb81e Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 12 Feb 2020 08:50:30 +0000 Subject: [PATCH 060/108] Merged PR 60222: Return PartialSuccess in case of full success for create and for update assets routes # Justification Returning no content or created generates bad C++ code. The rest of the APIs always return the partial success object in these cases. So be consistent with them. # Implementation Always return partial success. # Testing All unit tests pass. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index cdd1038..4c9458e 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2002,8 +2002,6 @@ paths: responses: 200: $ref: '#/responses/CreateAssetsPartialSuccessResponse' - 201: - description: Created 400: $ref: '#/responses/BadRequest' 401: @@ -2047,8 +2045,6 @@ paths: responses: 200: $ref: '#/responses/UpdateAssetsPartialSuccessResponse' - 204: - description: No Content 400: $ref: '#/responses/BadRequest' 401: From f47292447e73904bbe7d0c54f1f3e69e0c84608e Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Wed, 12 Feb 2020 09:32:45 +0000 Subject: [PATCH 061/108] Merged PR 60299: Removed the 204 No Content response from the end utilization and heartbeat # Justification Final change for updating the utilization routes to not return full success responses. Updated the end utilization and heartbeat routes. # Implementation Updated the web service facade. # Testing Updated existing tests which used to validate NoContent # Checklist - [X] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-managment/niapm.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 4c9458e..cd6c2a5 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2343,8 +2343,6 @@ paths: responses: 200: $ref: '#/responses/UpdateUtilizationPartialSuccessResponse' - 204: - description: No Content 400: $ref: '#/responses/BadRequest' 401: @@ -2367,8 +2365,6 @@ paths: responses: 200: $ref: '#/responses/UpdateUtilizationPartialSuccessResponse' - 204: - description: No Content 400: $ref: '#/responses/BadRequest' 401: From 2b63291c9de24344b0200eb353e63c33b3c4206d Mon Sep 17 00:00:00 2001 From: Sergey Kizunov Date: Wed, 12 Feb 2020 14:14:53 +0000 Subject: [PATCH 062/108] Merged PR 60219: Remove legacy privileges from nbexec OpenAPI doc # Justification Part of port to org modeling. # Testing Tested with https://review-board.natinst.com/r/325787/ --- ni-notebook-execution/ninbexec.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/ni-notebook-execution/ninbexec.yml b/ni-notebook-execution/ninbexec.yml index 8549194..b9895e6 100644 --- a/ni-notebook-execution/ninbexec.yml +++ b/ni-notebook-execution/ninbexec.yml @@ -969,7 +969,7 @@ paths: /: get: operationId: RootEndpoint - x-ni-request-all-privileges: true + x-ni-request-variables: [API_KEY] summary: API information description: Returns information about API versions and available operations. tags: [versioning] @@ -995,7 +995,7 @@ paths: summary: API version 1 information description: Returns available operations for version 1 of the API. operationId: RootEndpointV1 - x-ni-request-all-privileges: true + x-ni-request-variables: [API_KEY] # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1014,7 +1014,7 @@ paths: summary: API version 2 information description: Returns available operations for version 2 of the API. operationId: RootEndpointV2 - x-ni-request-all-privileges: true + x-ni-request-variables: [API_KEY] # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1034,7 +1034,6 @@ paths: operationId: GetNotebook x-ni-auth: true x-ni-operation: queryNotebooks - x-ni-privilege: Read x-ni-oldest-compatible-version: 1 summary: Get information about the specified Jupyter notebook description: >- @@ -1054,7 +1053,6 @@ paths: operationId: QueryNotebooksV2 x-ni-auth: true x-ni-operation: queryNotebooks - x-ni-privilege: Read x-ni-request-variables: [REMOTE_USER] summary: Query Jupyter notebooks description: >- @@ -1103,7 +1101,6 @@ paths: operationId: DownloadNotebook x-ni-auth: true x-ni-operation: downloadNotebook - x-ni-privilege: Read x-ni-request-variables: - REMOTE_USER - REQUEST_METHOD @@ -1142,7 +1139,6 @@ paths: operationId: GetExecution x-ni-auth: true x-ni-operation: queryExecutions - x-ni-privilege: Read x-ni-oldest-compatible-version: 1 summary: Get information on the specified execution of a Jupyter notebook description: >- @@ -1160,7 +1156,6 @@ paths: delete: operationId: DeleteExecution x-ni-operation: deleteExecutions - x-ni-privilege: Write x-ni-oldest-compatible-version: 1 summary: Delete the specified execution of a Jupyter notebook description: Deletes the execution of a Jupyter notebook specified by an execution ID. @@ -1177,7 +1172,6 @@ paths: operationId: DeleteExecutions x-ni-auth: true x-ni-operation: deleteExecutions - x-ni-privilege: Write x-ni-oldest-compatible-version: 1 summary: Delete executions of Jupyter notebooks description: >- @@ -1214,7 +1208,6 @@ paths: operationId: QueryExecutionsV2 x-ni-auth: true x-ni-operation: queryExecutions - x-ni-privilege: Read summary: Query executions of Jupyter notebooks description: >- Queries the executions of Jupyter notebooks. If no sort order is specified, @@ -1255,8 +1248,6 @@ paths: operationId: CreateExecutions x-ni-auth: true x-ni-operation: createExecutions - x-ni-privilege: Read - x-ni-request-all-privileges: true x-ni-request-variables: [REMOTE_USER] x-ni-oldest-compatible-version: 1 summary: Create one or more executions of Jupyter notebooks @@ -1297,7 +1288,6 @@ paths: operationId: CancelExecutions x-ni-auth: true x-ni-operation: cancelExecutions - x-ni-privilege: Write x-ni-oldest-compatible-version: 1 summary: Cancel executions of Jupyter notebooks description: >- @@ -1334,7 +1324,6 @@ paths: operationId: QueryNotebooks x-ni-auth: true x-ni-operation: queryNotebooks - x-ni-privilege: Read x-ni-request-variables: [REMOTE_USER] summary: Query Jupyter notebooks description: >- @@ -1395,7 +1384,6 @@ paths: operationId: QueryExecutions x-ni-auth: true x-ni-operation: queryExecutions - x-ni-privilege: Read summary: Query executions of Jupyter notebooks description: >- Queries the executions of Jupyter notebooks. If no execution IDs or notebook paths are From 19770387f8f09462b03e5c11cd7d2bb6a0963825 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Fri, 14 Feb 2020 15:28:30 +0000 Subject: [PATCH 063/108] Merged PR 60639: add groupItemIndexStart and maxCount so callers can limit the data that is # Justification showing grouped data in a table requires limiting how much is returned. # Implementation add groupItemIndexStart and maxCount so callers can limit the data that is returned from grouping # Testing Added tests, ran existing tests, tested in product. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 2e6bdf1..cbcbafa 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -262,6 +262,18 @@ definitions: format: int32 description: Maximum number of groups to return when grouping. example: 100 + groupItemIndexStart: + type: integer + default: null + format: int32 + description: Index of first item in each group to return. + example: 100 + groupItemMaxCount: + type: integer + default: null + format: int32 + description: Maximum number of items to return per group. + example: 100 OneChannelSpecifier: description: Specification for a channel of data properties: From 3d8c0f0acd078ad02219aa73e09c59d41459eb33 Mon Sep 17 00:00:00 2001 From: Paul Spangler Date: Fri, 14 Feb 2020 18:50:22 +0000 Subject: [PATCH 064/108] Merged PR 60729: Add numeric error codes to TDM Reader and increase request timeout # Justification The LabVIEW API relies on numeric error codes to populate the error wire. With the switch to OpenAPIGenerator instead of a pass-through web service, the TDM Reader web service stopped passing numeric error codes back to clients. Additionally, the request timeout when from 60 seconds in the pass-through to the AMQP web service default of 30 seconds. # Implementation Add numeric error codes to all TDM Reader and file fetcher errors. Note that the FileIdIncorrect error was not being used, was not in the error dictionary, and not in the Skyline Error Codes document, so I removed it. Set request timeout to 60 seconds for all routes. Long term, we should instead add calls to `IHttpRequest.ResetRequestTimeout` to indicate progress is being made. This will be cherry-picked to 20.0. # Testing Ran the LabVIEW tests and verified they now all pass. Examined the generated web service INI file and verified the 60 second request timeout is present on all handlers. # Checklist - [x] I tested changes to product code in product - [ ] ~~I considered updates to the wiki~~ Related work items: #972314, #972321 --- tdm-reader/nitdmreader.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index cbcbafa..df8f871 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -503,6 +503,7 @@ paths: description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getAllFileInfo x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -527,6 +528,7 @@ paths: description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getMultipleFileInfo x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -552,6 +554,7 @@ paths: description: 'Gets all channel names, channel information, and properties for the channel. This does not return channel data.' operationId: queryChannels x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -577,6 +580,7 @@ paths: description: Lists all group names in the file. operationId: getChannelPropertiesCount x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -616,6 +620,7 @@ paths: description: Lists all channel names for a group in a specific file. operationId: getChannels x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -660,6 +665,7 @@ paths: description: Queries files based on channel and window specifications and returns channel data that matches the query. The channel specifications select channels by group and channel relationships. Window specifications determine a bounding box of minimum and maximum x and y values, as well as specify the type of decimation performed on data within the window. operationId: queryData x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -685,6 +691,7 @@ paths: description: Queries files based on channel specifications and returns unique channel data values. The channel specifications select channels by group and channel relationships. The maximum number of unique values to return is determined by MaxNumberOfUniqueValues. If there are more unique values, then the first MaxNumberOfUniqueValues + 1 values are returned. operationId: queryUniqueValues x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: @@ -710,6 +717,7 @@ paths: description: Creates a channel based on values from other channels. operationId: createCalculatedResult x-ni-request-variables: [REMOTE_USER] + x-ni-request-timeout: 60000 produces: - application/json parameters: From c2aac5a306e2ef9be1480e553c1920386cc8197e Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Mon, 17 Feb 2020 11:04:42 +0000 Subject: [PATCH 065/108] Merged PR 60666: Validate calibration entry before creating or updating asset. # Justification Need to validate a calibration entry before using it to create or update an asset. This prevents the user for specifying a wrong next calibration date or invalid recommended interval etc. # Implementation Extract the validation done for adding external calibration for 3rd party assets into an extension class (to not pollute the model with ErrorCode and ITraceLogger). Use the validation extension method from the mapping used for create and update assets. Catch the exception at the right level for each case. Unit test. # Testing Wrote unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #973980, #973982 --- asset-managment/niapm.yml | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index cd6c2a5..c821aba 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -181,6 +181,22 @@ definitions: type: string format: date-time example: '2018-05-07T18:58:05.219692Z' + example: + temperatureSensors: [ + { name: 'Sensor0' , reading: 25.7 } + ] + isLimited: false + date: '2018-05-07T18:58:05.000Z' + recommendedInterval: 12 + nextRecommendedDate: '2019-05-07T18:58:05.000Z' + comments: 'This is a comment.' + entryType: MANUAL + operator: + displayName: John Doe + userId: johnDoe2020 + id: 5c4f0834174ae321b8a95a03 + calibrationType: EXTERNAL_CALIBRATION + timestamp: '2018-05-07T18:58:05.219692Z' CalibrationStatus: title: Calibration Status description: The calibration category the asset belongs to based on the next due calibration date. @@ -353,6 +369,15 @@ definitions: description: Calibration comments provided by an operator. type: string example: This is a comment. + example: + temperatureSensors: [ + { name: 'Sensor0' , reading: 25.7 } + ] + isLimited: false + date: '2018-05-07T18:58:05.000Z' + recommendedInterval: 12 + nextRecommendedDate: '2019-05-07T18:58:05.000Z' + comments: 'This is a comment.' ExternalCalibrationModel: title: External Calibration description: Data from the last external calibration. @@ -364,6 +389,19 @@ definitions: $ref: '#/definitions/CalibrationMode' operator: $ref: '#/definitions/ExternalCalibrationOperatorModel' + example: + temperatureSensors: [ + { name: 'Sensor0' , reading: 25.7 } + ] + isLimited: false + date: '2018-05-07T18:58:05.000Z' + recommendedInterval: 12 + nextRecommendedDate: '2019-05-07T18:58:05.000Z' + comments: 'This is a comment.' + entryType: MANUAL + operator: + displayName: John Doe + userId: johnDoe2020 ExternalCalibrationWithChecksumModel: title: External Calibration description: Data from the last external calibration including checksum. @@ -375,6 +413,20 @@ definitions: description: Checksum for the external calibration. type: string example: 7d9f4953655d48a6a5fd68e9dfd41345 + example: + temperatureSensors: [ + { name: 'Sensor0' , reading: 25.7 } + ] + isLimited: false + date: '2018-05-07T18:58:05.000Z' + recommendedInterval: 12 + nextRecommendedDate: '2019-05-07T18:58:05.000Z' + comments: 'This is a comment.' + entryType: MANUAL + operator: + displayName: John Doe + userId: johnDoe2020 + checksum: 7d9f4953655d48a6a5fd68e9dfd41345 BaseAssetModel: title: Base Asset Model description: An object describing basic properties of an asset. Base class for other models. From 8f12d8779024256d12067082b5b7b475591ccfa9 Mon Sep 17 00:00:00 2001 From: Jeff Washington Date: Wed, 19 Feb 2020 02:54:37 +0000 Subject: [PATCH 066/108] Merged PR 61157: add ignoreXForDecimation, which allows graphs to change x axis and not use sort # Justification Sorting + decimation on the graph needs to be able to ignore the synthetic or user-passed x and instead return synthetic indices. Otherwise, sorting has no practical effect on the graph and decimating sorted data is not possible, apart from the sort being lossy. # Implementation Add parameter specifying that the x (synthetic or passed) that we use for decimation will be ignored. # Testing Added new tests, tested in argon, ran existing tests. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index df8f871..7c6116b 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -274,6 +274,11 @@ definitions: format: int32 description: Maximum number of items to return per group. example: 100 + ignoreXForDecimation: + type: boolean + default: null + description: If true, x is not used in decimation. Instead, indices are returend for x. + example: true OneChannelSpecifier: description: Specification for a channel of data properties: From f74aabacc8c4e842940d6c75a3167acd37ba7195 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 19 Feb 2020 14:29:09 +0000 Subject: [PATCH 067/108] Merged PR 61260: Updating one or more identification properties return partial update instead of failed # Justification Updating the serial number or other identification property fails when the asset identifier is provided. This is ok, but it should be partial update in order to update other properties that were specified. Also, the error must say we cannot update the serial number instead of saying that building the asset identifier failed. # Implementation If the id is on the request, use that and don't try to build one from the identification properties. In that case, if the identification properties are different that then stored asset ones, return error/warning that those could not be updated. # Testing Added a unit test that fails without this change and passes with this change. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #976106 --- asset-managment/niapm.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index c821aba..e1543f9 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2065,7 +2065,15 @@ paths: tags: [assets] summary: Updates multiple assets description: >- - Updates multiple assets. If an asset with the provided identification does not exist, that asset is not created and an error is returned instead. + Updates multiple assets. To identify the assets that need to be updated, the following properties must be provided: + + - id + + OR + + - asset identification properties. See AssetIdentificationModel for details. + + If an asset with the provided identification does not exist, that asset is not created and an error is returned instead. Any property that is not set or set to null is ignored. The properties that cannot be updated are: From 9010d9f6822d08ef66467cba7f5b533964f37e34 Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Mon, 24 Feb 2020 14:25:23 +0000 Subject: [PATCH 068/108] Merged PR 61948: Added workspace to the asset model. # Justification To enable org-modeling, the asset model needs to expose a Workspace property. # Implementation Added the workspace property. Related work items: #977915 --- asset-managment/niapm.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index e1543f9..4af4b1c 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -530,6 +530,10 @@ definitions: example: true externalCalibration: $ref: '#/definitions/ExternalCalibrationModel' + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' properties: description: Key-value-pair metadata associated with an asset. type: object From f8424f8572b0dc34c46646fe6254c24437dcc430 Mon Sep 17 00:00:00 2001 From: Vlad Deac Date: Fri, 28 Feb 2020 10:11:42 +0000 Subject: [PATCH 069/108] Merged PR 62190: Add x-ni-auth to enable ApiKey in generated open api code. # Justification To support API Keys in our HTTP APIs, the routes in our OpenAPI document need to have the x-ni-auth attribute set. # Testing Ran unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #977929 --- asset-managment/niapm.yml | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 4af4b1c..2115863 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -1960,7 +1960,7 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true + x-ni-auth: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1985,7 +1985,7 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true + x-ni-auth: true security: [] responses: 200: @@ -2005,7 +2005,7 @@ paths: Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE]. operationId: get-assets x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/Skip' - $ref: '#/parameters/Take' @@ -2052,7 +2052,7 @@ paths: If the selfCalibration property is set, the supportsSelfCalibration property is automatically set to true by the service no matter if it is specified as false. The same is true for the externalCalibration and supportsExternalCalibration properties. operationId: create-assets x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/CreateAssetsRequestBody' responses: @@ -2103,7 +2103,7 @@ paths: Updating the assetPresence property to NOT_PRESENT succeeds only if it is updated with the same minionId, parent and slotNumber. Updating it to PRESENT always succeeds. operationId: update-assets x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/UpdateAssetsRequestBody' responses: @@ -2122,7 +2122,7 @@ paths: description: Gets asset summary response containing the total number of assets, the number of assets which are active, i.e. present in a connected system, and the number of assets which are not active. operationId: get-asset-summary x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true responses: 200: $ref: '#/responses/AssetSummaryResponse' @@ -2137,7 +2137,7 @@ paths: description: Gets asset summary of the total number of assets supporting calibration, the number of assets approaching calibration date and the number of assets past their calibration date operationId: get-calibratable-asset-summary x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true responses: 200: $ref: '#/responses/CalibratedAssetSummaryResponse' @@ -2152,7 +2152,7 @@ paths: description: Returns the assets satisfying the provided filtering criteria. If the the caller requests a JSON inline response, the returned assets are filtered based on the filter string and the ids and calibratableOnly properties are not taken into consideration. When the caller requests a CSV response, the filter is not taken into consideration, but the ids and calibratableOnly properties are used to filter the assets from the response. operationId: query-assets x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetsRequest' responses: @@ -2171,7 +2171,7 @@ paths: description: Gets the asset which has the given identifier. operationId: get-asset-with-identifier x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' responses: @@ -2190,7 +2190,7 @@ paths: description: Returns availability information for an asset in the specified timespan and split based on the specified time granularity. operationId: get-asset-availability-history x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' - in: query @@ -2234,7 +2234,7 @@ paths: description: Returns the calibration history of the asset which has the given identifier. operationId: get-asset-calibration-history x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/Skip' @@ -2256,7 +2256,7 @@ paths: description: Creates a new calibration history entry for a third-party asset. operationId: post-asset-calibration-history x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: - $ref: '#/parameters/AssetId' @@ -2279,7 +2279,7 @@ paths: description: Deletes multiple calibration history entries for an asset. operationId: post-delete-asset-calibration-history x-ni-operation: deleteAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/DeleteCalibrationsRequestBody' @@ -2303,7 +2303,7 @@ paths: description: Computes the calibration history of an asset in CSV format. If the destination is download, the response will contain the calibration history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-calibration-history x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/QueryHistoryRequestBody' @@ -2327,7 +2327,7 @@ paths: description: Computes the location history of an asset in CSV format. If the destination is download, the response will contain the location history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-location-history x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' - $ref: '#/parameters/QueryHistoryRequestBody' @@ -2351,7 +2351,7 @@ paths: description: Performs a request to update the metadata information of an asset. operationId: update-asset-metadata x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true consumes: - application/merge-patch+json parameters: @@ -2379,7 +2379,7 @@ paths: It will return a partial success when storing the utilization start information failed for one or more assets. operationId: start-multiple-asset-utilization x-ni-operation: createUtilization - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/StartUtilizationRequest' responses: @@ -2401,7 +2401,7 @@ paths: It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: end-multiple-asset-utilization x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/EndUtilizationRequest' responses: @@ -2423,7 +2423,7 @@ paths: It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: asset-utilization-multiple-heartbeats x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/HeartbeatUtilizationRequest' responses: @@ -2442,7 +2442,7 @@ paths: description: Gets availability history for multiple assets based on a specified timespan. operationId: compare-asset-availability x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/AssetAvailabilityComparison' responses: @@ -2478,7 +2478,7 @@ paths: description: Deletes all persisted data for the assets with the provided identifiers. This includes asset properties and all related historical information. operationId: delete-assets x-ni-operation: deleteAssets - x-ni-privilege: Write + x-ni-auth: true parameters: - $ref: '#/parameters/DeleteAssetsRequestBody' responses: @@ -2497,7 +2497,7 @@ paths: description: Retrieves asset utilization matching the provided filters. operationId: read-asset-utilization x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetUtilizationRequest' responses: @@ -2516,7 +2516,7 @@ paths: description: Retrieves historical asset utilization data matching the provided filters. An empty request body queries all historical asset utilization data. operationId: query-asset-utilizations x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetUtilizationHistoryRequest' responses: @@ -2535,7 +2535,7 @@ paths: description: Retrieves the service policy. operationId: get-policy x-ni-operation: readAssets - x-ni-privilege: Read + x-ni-auth: true responses: 200: $ref: '#/responses/ServicePolicyResponse' @@ -2549,7 +2549,7 @@ paths: description: Performs a request to update the service policy. operationId: update-policy x-ni-operation: writeAssets - x-ni-privilege: Write + x-ni-auth: true consumes: - application/merge-patch+json parameters: From e42e3e4d79d2f8b58dde5dd975f0e21f7b32732f Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Mon, 2 Mar 2020 15:45:57 +0000 Subject: [PATCH 070/108] Merged PR 62574: Fix platform enum value braking change. # Justification Changing the enum value was a braking change. It has to be reverted. # Implementation Replaced "_" with "-" in the enum name. # Testing Successfully generated classes with the new value. --- repo/nirepo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index f467fd7..c5accf5 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -171,7 +171,7 @@ definitions: $ref: '#/definitions/ErrorObject' Platform: type: string - enum: [WINDOWS, NI_LINUX_RT] + enum: [windows, ni-linux-rt] description: "Depending on the selected platform, the following package extensions are available: .nipkg for windows feeds, .ipk and .deb for ni-linux-rt feeds." example: windows PackageImportDescriptor: From ffc136a4ad2c8d5f4350af7fa68a6cb63b897be1 Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Wed, 11 Mar 2020 09:00:33 +0000 Subject: [PATCH 071/108] Merged PR 63799: Fixed example of Generate Systems Report route # Justification Fixed examples of Generate Systems Report route. Display text/csv only on 200 response. It seems that for 200, application/json option is present in the drop-down by default and has "string" value. All our APIs(file, notebook,etc.) have this behavior and I don't know how we can fix it since we will not produce application/json in the 200 use case. Related work items: #981057 --- systems-management/nisysmgmt.yml | 7 ++----- systems-state/nisystemsstate.yml | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index 21fc508..99a43dc 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -2035,9 +2035,6 @@ paths: required: true schema: $ref: '#/definitions/SystemsReportRequest' - produces: - - text/csv - - application/json responses: 200: description: OK. @@ -2045,8 +2042,8 @@ paths: description: The file data type: file examples: - application/octet-stream: - File data + text/csv: + Systems report file data 400: $ref: '#/responses/BadRequest' 401: diff --git a/systems-state/nisystemsstate.yml b/systems-state/nisystemsstate.yml index ad9a016..e776e98 100644 --- a/systems-state/nisystemsstate.yml +++ b/systems-state/nisystemsstate.yml @@ -958,9 +958,6 @@ paths: required: true schema: $ref: '#/definitions/ExportStateFromSystemRequest' - produces: - - text/x-yaml - - application/json responses: 200: description: OK @@ -968,8 +965,8 @@ paths: description: The file data type: file examples: - application/octet-stream: - File data + text/x-yaml: + State file data 401: $ref: '#/responses/Unauthorized' default: From fc7c1da62e94dc9ce78240c6027ce61e0e4f3593 Mon Sep 17 00:00:00 2001 From: Cameron Waterman Date: Wed, 11 Mar 2020 21:17:00 +0000 Subject: [PATCH 072/108] Merged PR 54312: Test Monitor Service - Org Modeling Support # Justification #968380 #968381 #968412 # Implementation - Add default workspace migration - Add workspace support to result and step operations # Testing - Tested all result/step routes with and without workspaces specified. # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #947942, #968380, #968381, #968412 --- test-monitor/nitestmonitor-v1.yml | 26 +++++----- test-monitor/nitestmonitor-v2.yml | 84 +++++++++++++++++++------------ 2 files changed, 64 insertions(+), 46 deletions(-) diff --git a/test-monitor/nitestmonitor-v1.yml b/test-monitor/nitestmonitor-v1.yml index 30e8157..56358a2 100644 --- a/test-monitor/nitestmonitor-v1.yml +++ b/test-monitor/nitestmonitor-v1.yml @@ -1085,7 +1085,6 @@ paths: summary: API version 1 information description: Returns available operations for version 1 of the API. operationId: root-endpoint-v1 - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1105,7 +1104,7 @@ paths: description: Uses input criteria to filter and return test results. An empty request body queries all test results. operationId: query-results x-ni-operation: queryResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -1139,7 +1138,7 @@ paths: description: Gets a list of test results. operationId: get-results x-ni-operation: getResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: skip @@ -1166,7 +1165,7 @@ paths: description: Updates existing test results by merging or replacing values. operationId: update-results x-ni-operation: updateResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1205,7 +1204,7 @@ paths: description: Creates new test results from the supplied models. The server automatically generates the result ids. The server will populate the start time if one is not provided. operationId: create-results x-ni-operation: createResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1239,7 +1238,7 @@ paths: description: Deletes the test result with the specified id. The request succeeds for result ids that do not exist. operationId: DeleteResult x-ni-operation: deleteResult - x-ni-privilege: Write + x-ni-auth: true parameters: - in: path name: resultId @@ -1265,7 +1264,7 @@ paths: description: Deletes multiple test results in a single request. operationId: delete-results x-ni-operation: deleteResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1304,7 +1303,7 @@ paths: description: Uses input criteria to filter and return test steps. An empty request body queries all test steps. operationId: query-steps x-ni-operation: querySteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -1338,7 +1337,7 @@ paths: description: Gets a list of test steps. operationId: get-steps x-ni-operation: getSteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: skip @@ -1365,7 +1364,7 @@ paths: description: Updates existing test steps by replacing values for the specified fields. operationId: update-steps x-ni-operation: updateSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1391,7 +1390,7 @@ paths: description: Creates new test steps from the supplied models. The result associated with the step must exist prior to step creation. The server automatically generates step ids if not supplied. operationId: create-steps x-ni-operation: createSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1420,7 +1419,7 @@ paths: description: Deletes the test step with the specified id. The request succeeds for step ids that do not exist. operationId: DeleteStep x-ni-operation: deleteStep - x-ni-privilege: Write + x-ni-auth: true parameters: - in: path name: resultId @@ -1451,7 +1450,7 @@ paths: description: Deletes multiple test steps in a single request. operationId: delete-steps x-ni-operation: deleteSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1479,7 +1478,6 @@ paths: summary: Pings the test monitor service description: Deprecated. Pings the test monitor service to ensure that it is online. operationId: ping - x-ni-privilege: Read deprecated: true responses: 204: diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index 52d7114..d5113e4 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -244,6 +244,7 @@ definitions: - PROPERTIES - FILE_IDS - STATUS_TYPE_SUMMARY + - WORKSPACE example: PROGRAM_NAME StepField: @@ -267,6 +268,7 @@ definitions: - DATA_MODEL - DATA - HAS_CHILDREN + - WORKSPACE example: STEP_TYPE PathField: @@ -488,6 +490,10 @@ definitions: format: double default: 0 example: 29.9 + workspace: + description: The workspace the test result belongs to + type: string + example: MyWorkspace TestResultResponseObject: title: Test Result Response type: object @@ -568,6 +574,10 @@ definitions: format: int32 example: FAILED: 5 + workspace: + description: The workspace the test result belongs to + type: string + example: MyWorkspace TestResultUpdateRequestObject: title: Test Result Update type: object @@ -636,6 +646,10 @@ definitions: format: double default: 0 example: 29.9 + workspace: + description: The workspace the test step belongs to + type: string + example: MyWorkspace UpdateTestResultsRequest: title: Update Test Results Request type: object @@ -1200,6 +1214,10 @@ definitions: type: array items: $ref: '#/definitions/NamedValueObject' + workspace: + description: The workspace the step belongs to + type: string + example: MyWorkspace TestStepCreateOrUpdateRequestObject: title: Test Step Create or Update Request type: object @@ -1290,6 +1308,10 @@ definitions: that this step object is a leaf node. type: boolean example: false + workspace: + description: The workspace the test step belongs to + type: string + example: MyWorkspace responses: Error: description: Error @@ -1623,7 +1645,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: root-endpoint - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1648,7 +1669,6 @@ paths: summary: API version 2 information description: Returns available operations for version 2 of the API. operationId: root-endpoint-v2 - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -1670,7 +1690,7 @@ paths: product. An empty request body queries all products. operationId: query-products-v2 x-ni-operation: queryProducts - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -1692,7 +1712,7 @@ paths: description: Gets a list of products. operationId: get-products-v2 x-ni-operation: getProducts - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: continuationToken @@ -1730,7 +1750,7 @@ paths: description: Creates new products from the supplied models. The server automatically generates the product ids. operationId: create-products-v2 x-ni-operation: createProducts - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1764,7 +1784,7 @@ paths: description: Gets a single product. operationId: get-product-v2 x-ni-operation: getProducts - x-ni-privilege: Read + x-ni-auth: true parameters: - in: path name: productId @@ -1786,7 +1806,7 @@ paths: description: Deletes the product with the specified id. The request succeeds for products that do not exist. operationId: delete-product-v2 x-ni-operation: deleteProduct - x-ni-privilege: Write + x-ni-auth: true parameters: - in: path name: productId @@ -1809,7 +1829,7 @@ paths: fields are `ID`, `PART_NUMBER`, `NAME`, `FAMILY`, and `UPDATED_AT`. operationId: query-product-values-v2 x-ni-operation: queryProducts - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -1831,7 +1851,7 @@ paths: description: Updates existing products by merging or replacing values. operationId: update-products-v2 x-ni-operation: updateProducts - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1867,7 +1887,7 @@ paths: description: Deletes multiple products in a single request. operationId: delete-products-v2 x-ni-operation: deleteProducts - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -1905,7 +1925,7 @@ paths: results are returned. An empty request body queries all test results. operationId: query-results-v2 x-ni-operation: queryResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -1930,7 +1950,7 @@ paths: description: Gets a list of test results. operationId: get-results-v2 x-ni-operation: getResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: continuationToken @@ -1968,7 +1988,7 @@ paths: description: Creates new test results from the supplied models. The server automatically generates the result ids. The server will populate the start time if one is not provided. operationId: create-results-v2 x-ni-operation: createResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2002,7 +2022,7 @@ paths: description: Gets a single test result. operationId: get-result-v2 x-ni-operation: getResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: path name: resultId @@ -2024,7 +2044,7 @@ paths: description: Deletes the test result with the specified id. The request succeeds for result ids that do not exist. operationId: delete-result-v2 x-ni-operation: deleteResult - x-ni-privilege: Write + x-ni-auth: true parameters: - in: path name: resultId @@ -2051,10 +2071,10 @@ paths: Queries known values for an indexed, scalar result field. Supported fields are `ID`, `STARTED_AT`, `UPDATED_AT`, `PROGRAM_NAME`, `SYSTEM_ID`, `HOST_NAME`, `OPERATOR`, `SERIAL_NUMBER`, `PART_NUMBER`, - and `TOTAL_TIME_IN_SECONDS`. + `TOTAL_TIME_IN_SECONDS`, and `WORKSPACE`. operationId: query-result-values-v2 x-ni-operation: queryResults - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -2076,7 +2096,7 @@ paths: description: Updates existing test results by merging or replacing values. operationId: update-results-v2 x-ni-operation: updateResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2098,7 +2118,7 @@ paths: description: Deletes multiple test results in a single request. operationId: delete-results-v2 x-ni-operation: deleteResults - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2140,7 +2160,7 @@ paths: steps are returned. An empty request body queries all test steps. operationId: query-steps-v2 x-ni-operation: querySteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -2165,7 +2185,7 @@ paths: description: Gets a list of test steps. operationId: get-steps-v2 x-ni-operation: getSteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: continuationToken @@ -2203,7 +2223,7 @@ paths: description: Creates new test steps from the supplied models. The result associated with the step must exist prior to step creation. The server automatically generates step ids if not supplied. operationId: create-steps-v2 x-ni-operation: createSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2227,7 +2247,7 @@ paths: description: Gets a single test step. operationId: get-step-v2 x-ni-operation: getSteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: path name: resultId @@ -2254,7 +2274,7 @@ paths: description: Deletes the test step with the specified id. The request succeeds for step ids that do not exist. operationId: delete-step-v2 x-ni-operation: deleteStep - x-ni-privilege: Write + x-ni-auth: true parameters: - in: path name: resultId @@ -2285,11 +2305,11 @@ paths: description: >- Queries known values for an indexed, scalar step field. Supported fields are `NAME`, `STEP_TYPE`, `STEP_ID`, `PARENT_ID`, `RESULT_ID`, - `PATH`, `TOTAL_TIME_IN_SECONDS`, `STARTED_AT`, `UPDATED_AT`, and - `DATA_MODEL`. + `PATH`, `TOTAL_TIME_IN_SECONDS`, `STARTED_AT`, `UPDATED_AT`, + `DATA_MODEL`, and `WORKSPACE`. operationId: query-step-values-v2 x-ni-operation: querySteps - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody @@ -2311,7 +2331,7 @@ paths: description: Updates existing steps by merging or replacing values. operationId: update-steps-v2 x-ni-operation: updateSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2333,7 +2353,7 @@ paths: description: Deletes multiple test steps in a single request. operationId: delete-steps-v2 x-ni-operation: deleteSteps - x-ni-privilege: Write + x-ni-auth: true parameters: - in: body name: requestBody @@ -2362,7 +2382,7 @@ paths: description: Gets a list of paths. operationId: get-paths-v2 x-ni-operation: queryPaths - x-ni-privilege: Read + x-ni-auth: true parameters: - in: query name: continuationToken @@ -2401,7 +2421,7 @@ paths: description: Gets a single path. operationId: get-path-v2 x-ni-operation: queryPaths - x-ni-privilege: Read + x-ni-auth: true parameters: - in: path name: pathId @@ -2426,7 +2446,7 @@ paths: paths. An empty request body queries all paths. operationId: query-paths-v2 x-ni-operation: queryPaths - x-ni-privilege: Read + x-ni-auth: true parameters: - in: body name: postBody From 97fdf3506e22550c5ea4456909bbc7799bec4a8a Mon Sep 17 00:00:00 2001 From: Alex Weaver Date: Thu, 12 Mar 2020 15:39:53 +0000 Subject: [PATCH 073/108] Merged PR 64337: Fix a couple broken/incorrect examples in Test Monitor Swagger doc # Justification A couple example fields were not present, and another contained an incorrect identifier. # Implementation Fixed the examples. # Testing Verified the rendered documentation is correct. # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #985321, #985325 --- test-monitor/nitestmonitor-v2.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index d5113e4..5eac542 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -803,7 +803,7 @@ definitions: filter: description: The query filter in Dynamic Linq type: string - example: programName == "MyTests.seq" || product == "cRIO-9030" + example: programName == "MyTests.seq" || partNumber == "cRIO-9030" substitutions: description: >- Makes substitutions in the query filter expression. Substitutions for the query expression @@ -1377,11 +1377,14 @@ responses: type: array items: type: string + example: + - 5e30931793cac80468509487 failed: description: Array of product ids that failed to delete type: array items: type: string + example: [] error: $ref: '#/definitions/Error' ProductsQueryResponse: From 46ca5a7851c4f3452b8f6525911e09ee0f8f14ca Mon Sep 17 00:00:00 2001 From: Eliza Olariu Date: Wed, 18 Mar 2020 07:42:52 +0000 Subject: [PATCH 074/108] Merged PR 61970: New route updating multiple system in Systems Management HTTP API # Justification We want to modify the metadata (for the moment the workspace) for more system in one call. # Implementation Defined a new rpc route of type POST that operate on multiple systems. For this, we use a list of systems ids and a metadata property defined in a patch way. There will be bools that show if the values are set or not for the metadata information. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-management/nisysmgmt.yml | 57 +++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index 99a43dc..de5e1f9 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -1087,7 +1087,38 @@ definitions: type: string description: The ID of the workspace. example: '5bc5e9092a4fa4c71cfa7197' - + + UpdateSystemsRequest: + description: List of systems and metadata to be updated. + title: Update Systems Request + type: object + properties: + SystemsUpdateInformation: + description: The list of system ids and changes. + type: array + items: + description: System ids and changes that need to be applied to the systems. + title: SystemUpdateInformation + type: object + properties: + systemId: + type: string + description: The system id. + example: 'VMware_Virtual_Platform--SN-VMware-56_4d_d2_08_ce_89_1b_70-e6_32_fc_21_6c_d0_d9_f9--MAC-00-0C-29-D0-D9-F9' + systemMetadata: + $ref: '#/definitions/SystemMetadata' + + SystemMetadata: + description: System metadata to be updated. + title: SystemMetadata + x-ni-sparse: true + type: object + properties: + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' + QueryAvailablePackagesRequest: title: Get Available Packages Request description: Request to get the available packages from the feeds specified in the request. @@ -2308,6 +2339,30 @@ paths: $ref: '#/responses/NotFound' default: $ref: '#/responses/Error' + /v1/update-systems: + post: + operationId: UpdateSystemsMetadata + x-ni-auth: true + x-ni-operation: updateSystemMetadata + tags: [systems] + summary: Update systems metadata + description: Update metadata for a list of systems. + parameters: + - in: body + name: UpdateSystemsRequest + required: true + description: The new metadata associated with a list of systems. + schema: + $ref: '#/definitions/UpdateSystemsRequest' + responses: + 200: + $ref: '#/responses/PartialSuccess' + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' /v1/query-available-packages: post: operationId: GetAvailablePackagesByQuery From 4257b0c55c107659b999324db4c728c468185d30 Mon Sep 17 00:00:00 2001 From: Andrei Rogobete Date: Sun, 22 Mar 2020 18:08:15 +0000 Subject: [PATCH 075/108] Merged PR 63258: Design Document and Swagger documentation for the Service Registry # Justification Added a design document and Swagger HTTP documentation for the Service Registry service # Implementation N/A # Testing N/A # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- service-registry/niserviceregistry.yml | 120 +++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 service-registry/niserviceregistry.yml diff --git a/service-registry/niserviceregistry.yml b/service-registry/niserviceregistry.yml new file mode 100644 index 0000000..c147cdf --- /dev/null +++ b/service-registry/niserviceregistry.yml @@ -0,0 +1,120 @@ +swagger: '2.0' +info: + version: '1' + title: Service Registry Web Service + description: View information about installed SystemLink services + contact: + name: National Instruments + url: 'https://www.ni.com/systemlink' + email: support@ni.com +basePath: /niserviceregistry +consumes: + - application/json +produces: + - application/json +definitions: + Statement: + description: Contains information about a statement + type: object + properties: + actions: + description: Contains information about actions that can be performed + type: array + items: + type: string + example: ['asset:*'] + type: + description: Contains information about the resource type for which the statement applies + type: string + example: "asset" + Translation: + description: Contains translation information for a permission configuration + type: object + properties: + en-us: + description: The united states english permission name translation + type: string + example: "All" + zn-ch: + description: The traditional chinese permission name translation + type: string + example: "所有" + de: + description: The german permission name translation + type: string + example: "Alle" + ja: + description: The japanese permission name translation + type: string + example: "すべて" + Permission: + description: Contains information about a installed permission + type: object + properties: + id: + description: The ID of the permission + type: string + example: "1242342" + translation: + $ref: '#/definitions/Translation' + statements: + type: array + items: + $ref: '#/definitions/Statement' + Privilege: + description: Contains information about a installed privilege + type: object + properties: + id: + description: The ID of the privilege + type: string + example: "12314121" + dependsOnService: + description: Specifies the logical dependency of this privilege. Usually, this is a backend service + type: string + example: "AssetPerformanceManagement" + show: + description: Specifies whether this privilege is user visible + type: boolean + example: true + showResource: + description: Specifies whether the resource specificity to be shown + type: boolean + example: false + permissions: + type: array + items: + $ref: '#/definitions/Permission' +responses: + PrivilegeResponse: + description: Response containing a list of installed privileges + schema: + description: Response containing a list of installed privileges + title: Privilege Response + type: object + required: + - privileges + properties: + privileges: + description: Array of installed privilege information + type: array + items: + $ref: '#/definitions/Privilege' + Unauthorized: + description: Not authorized + headers: + WWW_Authenticate: + description: Information for how to authenticate + type: string +paths: + /v1/privileges: + get: + tags: [privileges] + summary: Get installed SystemLink privilege configuration + description: Gets information about installed privileges + operationId: get-privileges + responses: + 200: + $ref: '#/responses/PrivilegeResponse' + 401: + $ref: '#/responses/Unauthorized' \ No newline at end of file From b0eb073728a14183a137221586daeac9e22cd489 Mon Sep 17 00:00:00 2001 From: Tudor Ludusan Date: Wed, 1 Apr 2020 09:02:23 +0000 Subject: [PATCH 076/108] Merged PR 66825: Added x-ni-auth to APM RuleEgine routes # Justification Added x-ni-auth to the APM RuleEngine routes. See design doc: https://ni.visualstudio.com/DevCentral/_git/Skyline?path=%2FSpecs%2FAsset%20Management%2F%5B20.1%5D%20Org%20Modeling%2FAsset%20Management%20Rule%20Engine%20Org%20Modeling.md&version=GBmaster&fullScreen=true # Implementation Updated yml. Added some placeholder logic in the WebService facade until task #997704 is implemented. # Testing Validated / and /v1 routes return the same privileges as before. Validated that the HTTP routes work. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #997696 --- asset-management-rule/niapmrule.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/asset-management-rule/niapmrule.yml b/asset-management-rule/niapmrule.yml index dfc9245..7ff2734 100644 --- a/asset-management-rule/niapmrule.yml +++ b/asset-management-rule/niapmrule.yml @@ -296,7 +296,7 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true + x-ni-auth: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -326,7 +326,7 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true + x-ni-auth: true security: [] responses: 200: @@ -344,7 +344,7 @@ paths: description: Gets a list containing all rules specific to calibration. operationId: get-calibration-rules x-ni-operation: getCalibrationRule - x-ni-privilege: assetrule.Read + x-ni-auth: true responses: 200: $ref: '#/responses/CalibrationRulesResponse' @@ -361,7 +361,7 @@ paths: description: Gets the calibration rule with the specified identifier. operationId: get-calibration-rule-by-id x-ni-operation: getCalibrationRule - x-ni-privilege: assetrule.Read + x-ni-auth: true responses: 200: $ref: '#/responses/CalibrationRuleResponse' @@ -379,7 +379,7 @@ paths: description: Replaces a specific calibration rule with the given one. operationId: put-calibration-rule x-ni-operation: updateCalibrationRule - x-ni-privilege: assetrule.Write + x-ni-auth: true parameters: - in: body name: CalibrationRulePutRequestModel @@ -405,7 +405,7 @@ paths: description: Sets specific calibration rules state by enabling or disabling them. operationId: set-calibration-rules-state x-ni-operation: updateCalibrationRule - x-ni-privilege: assetrule.Write + x-ni-auth: true parameters: - $ref: '#/parameters/SetRulesState' responses: From 6bc5721e687b096bd6588a312039d917a09c8fc2 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 1 Apr 2020 16:48:43 +0000 Subject: [PATCH 077/108] Merged PR 67144: Add workspace property to calibration rule models, except DB one # Justification For org modelling, we must assign calibration rules to workspaces. # Implementation Adding the workspace property to calibration rule models, except DB. Because the DB model does not have the workspace property, there is some minor temporary code marked with TODO and task number. # Testing Ran all unit tests. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #997606 --- asset-management-rule/niapmrule.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/asset-management-rule/niapmrule.yml b/asset-management-rule/niapmrule.yml index 7ff2734..4ddb75a 100644 --- a/asset-management-rule/niapmrule.yml +++ b/asset-management-rule/niapmrule.yml @@ -190,6 +190,10 @@ definitions: type: string format: date-time example: '2018-05-07T18:58:05.219692Z' + workspace: + type: string + description: The ID of the workspace. + example: '5bc5e9092a4fa4c71cfa7197' RuleStateUpdateModel: title: Rule State Update Model description: The collection of rule identifiers and the enable/disable state to apply on them. From a5d994938e9f62e8df2f3cfce65f2b2d2738278a Mon Sep 17 00:00:00 2001 From: Andreas Krantz Date: Mon, 6 Apr 2020 20:58:06 +0000 Subject: [PATCH 078/108] Merged PR 67600: ORG Model: Preparations Step1 - TDM Reader - File Fetcher # Justification Implement Org model into File Fetcher and TDM Reader # Implementation Send around ApiKey and add workspace # Testing Adjust module test to work with changes # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- tdm-reader/nitdmreader.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 7c6116b..a8a84d3 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -382,6 +382,14 @@ definitions: $ref: '#/definitions/ChannelSpecifications' required: - channelSpecifications + CreateCalculatedResultSpecifier: + properties: + channelSpecifications: + $ref: '#/definitions/ChannelSpecifications' + workspace: + type: string + required: + - channelSpecifications ReturnedUniqueValues: properties: uniqueValues: @@ -507,6 +515,7 @@ paths: summary: Gets file, group, and channel information description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getAllFileInfo + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -532,6 +541,7 @@ paths: summary: Gets file, group, and channel information description: 'Gets all group names, channel names, channel information, and properties at all levels. This does not return channel data.' operationId: getMultipleFileInfo + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -558,6 +568,7 @@ paths: summary: Gets channel information description: 'Gets all channel names, channel information, and properties for the channel. This does not return channel data.' operationId: queryChannels + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -584,6 +595,7 @@ paths: summary: Lists all groups in the file description: Lists all group names in the file. operationId: getChannelPropertiesCount + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -624,6 +636,7 @@ paths: summary: Lists all channels in the group description: Lists all channel names for a group in a specific file. operationId: getChannels + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -669,6 +682,7 @@ paths: summary: Returns data from channels. description: Queries files based on channel and window specifications and returns channel data that matches the query. The channel specifications select channels by group and channel relationships. Window specifications determine a bounding box of minimum and maximum x and y values, as well as specify the type of decimation performed on data within the window. operationId: queryData + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -695,6 +709,7 @@ paths: summary: Returns unique data from channels. description: Queries files based on channel specifications and returns unique channel data values. The channel specifications select channels by group and channel relationships. The maximum number of unique values to return is determined by MaxNumberOfUniqueValues. If there are more unique values, then the first MaxNumberOfUniqueValues + 1 values are returned. operationId: queryUniqueValues + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -721,6 +736,7 @@ paths: summary: Returns a calculated result channel. description: Creates a channel based on values from other channels. operationId: createCalculatedResult + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] x-ni-request-timeout: 60000 produces: @@ -731,7 +747,7 @@ paths: in: body required: true schema: - $ref: '#/definitions/QueryDataSpecifier' + $ref: '#/definitions/CreateCalculatedResultSpecifier' responses: 200: description: OK From c268ab4082308a6139c1d2520fc4390738734a45 Mon Sep 17 00:00:00 2001 From: Bogdan Maris Date: Thu, 9 Apr 2020 15:32:23 +0000 Subject: [PATCH 079/108] Merged PR 67997: Add Query Assets Availability Route in YAML # Justification In order to update our notebooks to use HTTP instead of AMQP we need to start by ensuring that we have similar HTTP routes to those exposed by our AMQP API. We currently do not have a http route which returns availability for multiple assets during multiple time intervals. A workaround would be to call the compare availability route several times, but this would lead to a significant decrease in performance. # Implementation Modified the yaml document and implemented the new method in web service facade. The final implementation of this method will follow in the next PR. # Testing Ran code gen, checked the generated models. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #1001821 --- asset-managment/niapm.yml | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 2115863..dd6a368 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -592,6 +592,71 @@ definitions: - assetName - assetIdentifier - availabilityHistory + AvailabilityTimeInterval: + title: Availability Time Interval + description: Time interval containing a start and an end date. + type: object + properties: + startDate: + description: >- + A date value which can be used to specify the beginning of a timespan. + + This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. + type: string + format: date-time + example: '2018-05-01T00:00:00Z' + endDate: + description: >- + A date value which can be used to specify the end of a timespan. + + This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. + type: string + format: date-time + example: '2018-05-20T00:00:00Z' + required: + - startDate + - endDate + AssetWithAvailabilityInIntervalModel: + title: Asset With Availability In Interval + description: Information about the availability, or connection history, of an asset. This includes the name of each system in which the asset was present during an interval of time you specify. + type: object + properties: + assetName: + description: The asset name for which the availability was computed. + type: string + example: PCI-Slot2 + assetIdentifier: + description: The identifier of the asset for which the availability was computed. + type: string + example: 29162;01B245D6;4243;0 + interval: + $ref: '#/definitions/AvailabilityTimeInterval' + availabilityInSystems: + description: List containing the availability percentage of an asset for each system it was present in during a given time interval. + type: array + items: + $ref: '#/definitions/AssetAvailabilityInSystemModel' + AssetAvailabilityInSystemModel: + title: Asset Availability In System Model + description: Contains the availability percentage and the name of the system an asset was present in during an interval. + type: object + properties: + systemName: + description: Name of the system to which the availability data corresponds. + type: string + example: 'PXI1' + availabilityPercentage: + description: The percentage of time in which the asset was available in the system. + type: number + format: double + example: 7.38958 + required: + - systemName + - availabilityPercentage OverallAvailabilityInSystemModel: title: Overall Availability In System description: Availability information for an asset in a single system for the specified timespan. @@ -849,6 +914,28 @@ parameters: type: string example: '2018-05-20T00:00:00Z' required: true + QueryAssetsAvailabilityRequestBody: + in: body + name: queryAssetsAvailability + description: Request body containing a list of asset identifiers and a list of time intervals. + schema: + title: Query Assets Availability Request Body + type: object + required: + - ids + - intervals + properties: + ids: + description: Multiple asset identifiers for which the availability data is retrieved. + type: array + items: + type: string + example: ["29162;01B245D6;4243;0", "29162;01B245D6;4243;1"] + intervals: + description: Time intervals for which the availability data is retrieved. + type: array + items: + $ref: '#/definitions/AvailabilityTimeInterval' DeleteAssetsRequestBody: in: body name: deleteAssets @@ -2471,6 +2558,42 @@ paths: $ref: '#/responses/Unauthorized' default: $ref: '#/responses/Error' + /v1/assets/history/query-assets-availability: + post: + tags: [assets] + summary: Gets availability history for multiple assets. + description: Gets availability history for multiple assets based on the specified timespans. + operationId: query-assets-availability + x-ni-operation: readAssets + x-ni-auth: true + parameters: + - $ref: '#/parameters/QueryAssetsAvailabilityRequestBody' + responses: + 200: + description: Query assets availability response containing information about the availability of the assets specified by their ids during the given time intervals. + schema: + title: Query Assets Availability Response + description: Query assets availability response containing availability history for the requested assets. If availability history could not be resolved for some assets, the response contains error information on the assets which could not be resolved. + type: object + properties: + availabilityData: + type: array + items: + $ref: '#/definitions/AssetWithAvailabilityInIntervalModel' + failed: + description: Array of asset identifiers for which obtaining availability failed. + type: array + items: + type: string + example: [ "13562;01B245D6;4243;0" ] + error: + $ref: '#/definitions/Error' + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' /v1/delete-assets: post: tags: [assets] From 1320a6278865715af31de60552bda34c3fafb0f4 Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Thu, 9 Apr 2020 16:16:49 +0000 Subject: [PATCH 080/108] Merged PR 68353: Add examples in query projection fields We have to provide better descriptions/examples. See referred bug. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #953776 --- systems-management/nisysmgmt.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index de5e1f9..f6d7309 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -1534,7 +1534,13 @@ definitions: projection: type: string example: 'new(id,grains,lastUpdatedTimestamp)' - description: Specifies the projection for resources. This field can be used if we don't want to receive the entire model but only certain properties of the model. + description: >- + Specifies the projection for resources. Use this field to receive specific properties of the model. + + Examples: + - 'new(id,connected)' + - 'new(id,alias,grains.data.host as host)' + - 'new(id,lastUpdatedTimestamp,properties.data.location as location)' orderBy: type: string example: 'lastUpdatedTimestamp descending' @@ -1626,7 +1632,13 @@ definitions: projection: type: string example: 'new(id,jid,state,lastUpdatedTimestamp,config.fun as fun)' - description: Specifies the projection for resources. This field can be used if we don't want to receive the entire model but only certain properties of the model. + description: >- + Specifies the projection for resources. Use this field to receive specific properties of the model. + + Examples: + - 'new(id,jid,state)' + - 'new(id,jid,config.user as user)' + - 'new(id,jid,state,lastUpdatedTimestamp,metadata.queued as queued)' orderBy: type: string example: 'lastUpdatedTimestamp descending' From e788f9dfb764f5b15cdb8197adc7ecba72f650e4 Mon Sep 17 00:00:00 2001 From: Cameron Waterman Date: Mon, 13 Apr 2020 15:03:25 +0000 Subject: [PATCH 081/108] Merged PR 68458: Update test monitor v2 swagger doc to have a better example for workspace # Justification #1001577 # Implementation Updated examples # Testing N/A # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #1001577 --- test-monitor/nitestmonitor-v2.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index 5eac542..0b51e0f 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -493,7 +493,7 @@ definitions: workspace: description: The workspace the test result belongs to type: string - example: MyWorkspace + example: f94b178e-288c-4101-afb1-833992413aa7 TestResultResponseObject: title: Test Result Response type: object @@ -577,7 +577,7 @@ definitions: workspace: description: The workspace the test result belongs to type: string - example: MyWorkspace + example: f94b178e-288c-4101-afb1-833992413aa7 TestResultUpdateRequestObject: title: Test Result Update type: object @@ -647,9 +647,9 @@ definitions: default: 0 example: 29.9 workspace: - description: The workspace the test step belongs to + description: The workspace the test result belongs to type: string - example: MyWorkspace + example: f94b178e-288c-4101-afb1-833992413aa7 UpdateTestResultsRequest: title: Update Test Results Request type: object @@ -1214,10 +1214,6 @@ definitions: type: array items: $ref: '#/definitions/NamedValueObject' - workspace: - description: The workspace the step belongs to - type: string - example: MyWorkspace TestStepCreateOrUpdateRequestObject: title: Test Step Create or Update Request type: object @@ -1311,7 +1307,7 @@ definitions: workspace: description: The workspace the test step belongs to type: string - example: MyWorkspace + example: f94b178e-288c-4101-afb1-833992413aa7 responses: Error: description: Error From 7eeed4a841c0678096eaf45aab48ac89b0ec81fb Mon Sep 17 00:00:00 2001 From: Andreas Krantz Date: Mon, 20 Apr 2020 14:27:57 +0000 Subject: [PATCH 082/108] Merged PR 69714: In API workspace is referenced by "workspaceid" instead of "workspace" # Justification It was decided to rename the workspace member in the APIs to workspaceid. There is currently no client that needs to be adapted. --- tdm-reader/nitdmreader.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index a8a84d3..11addd3 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -386,7 +386,7 @@ definitions: properties: channelSpecifications: $ref: '#/definitions/ChannelSpecifications' - workspace: + workspaceId: type: string required: - channelSpecifications From a21d9b7f34d63da7088f0cd74069df58f7b8f1aa Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 22 Apr 2020 10:26:56 +0000 Subject: [PATCH 083/108] Add workspaces query parameter to GetCalibrationRules route # Justification Clients may one to filter what rules they query based on workspace. This is the case of the asset details page, where only rules that are on the same workspace as the assets are displayed. Here is [the design doc](https://ni.visualstudio.com/DevCentral/_git/Skyline?path=%2FSpecs%2FAsset%20Management%2F%5B20.1%5D%20Org%20Modeling%2FAsset%20Management%20Rule%20Engine%20Org%20Modeling.md&_a=preview) that covers this need in the "New Inputs" sub-chapter. # Implementation Added workspaces query parameter to the route that gets calibration rules. Filter the rules based on the passed workspaces. Added tests. If no workspace is passed, return all accessible workspaces. # Testing Unit tests pass. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- asset-management-rule/niapmrule.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/asset-management-rule/niapmrule.yml b/asset-management-rule/niapmrule.yml index 4ddb75a..28396c1 100644 --- a/asset-management-rule/niapmrule.yml +++ b/asset-management-rule/niapmrule.yml @@ -227,6 +227,13 @@ parameters: required: true schema: $ref: '#/definitions/RuleStateUpdateModel' + Workspaces: + in: query + name: workspaces + description: A string representing the collection of workspace IDs separated by comma used to filter the rules. + required: false + type: string + x-example: '5bc5e9092a4fa4c71cfa7197,3a83d3fc174ae3491890f7ae' responses: BadRequest: description: The server was unable to process the request because of invalid syntax. @@ -349,6 +356,8 @@ paths: operationId: get-calibration-rules x-ni-operation: getCalibrationRule x-ni-auth: true + parameters: + - $ref: '#/parameters/Workspaces' responses: 200: $ref: '#/responses/CalibrationRulesResponse' From 903997a1d180ddf5f6c69f07ea167f1d7ce3ca35 Mon Sep 17 00:00:00 2001 From: Radu Dragan Date: Wed, 22 Apr 2020 17:55:33 +0000 Subject: [PATCH 084/108] Merged PR 69983: Remove ni-auth atribute from ping and packages download routes. # Justification Anyone should be able to ping the service even without authentication. The package pool is public so any user with the exact download link of a package should be able to download it. Also the resources of repository service are feeds, not packages. # Implementation removed 'x-ni-auth: true' from /v1/files get route and /v1/ping get route from the yml file. # Testing Pinged the service and download a package from a unauthenticated private browser session. # Checklist - [x ] I tested changes to product code in product - [ ] I considered updates to the wiki --- repo/nirepo.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/repo/nirepo.yml b/repo/nirepo.yml index c5accf5..6e269dc 100644 --- a/repo/nirepo.yml +++ b/repo/nirepo.yml @@ -921,7 +921,6 @@ paths: /v1/ping: get: operationId: Ping - x-ni-auth: true x-ni-operation: ping tags: [ping] summary: Ping the service @@ -947,7 +946,6 @@ paths: x-example: "filePath" get: operationId: DownloadFiles - x-ni-auth: true x-ni-operation: getResource x-ni-route-type: Static x-ni-static-download: true From 5d931e5e37bcd7f4a72ade89b4cd4cc85c57d948 Mon Sep 17 00:00:00 2001 From: Paul Spangler Date: Fri, 24 Apr 2020 14:51:15 +0000 Subject: [PATCH 085/108] Merged PR 70266: Update alarm Swagger document with org modeling changes # Justification #975559 # Implementation Added workspace and the new route to the document as described in the [design document](https://dev.azure.com/ni/DevCentral/_git/Skyline?path=%2FSpecs%2FSystems%20Integration%2FOrg%20Modeling%2FAlarm%2FDesign.md&version=GBmaster) and matching the current implementation with partial success. # Testing Made the changes using https://editor.swagger.io and verified there weren't any errors or warnings and that everything looked correct in the UI. # Checklist - [x] I tested changes to product code in product - [ ] ~~I considered updates to the wiki~~ Related work items: #975559 --- alarm/nialarm.yml | 176 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 156 insertions(+), 20 deletions(-) diff --git a/alarm/nialarm.yml b/alarm/nialarm.yml index 8acc1b7..8c697c6 100644 --- a/alarm/nialarm.yml +++ b/alarm/nialarm.yml @@ -42,11 +42,33 @@ definitions: type: array items: type: string + resourceType: + description: Type of resource associated with the error. + This field is only present for entries in *innerErrors*. + type: string + enum: [instanceId] + resourceId: + description: Identifier of the resource associated with the error. + This field is only present for entries in *innerErrors*. + type: string + innerErrors: + description: Array of individual errors when a request results in multiple errors. + This field is only present when *name* is 'Skyline.OneOrMoreErrorsOccurred'. + type: array + items: + $ref: '#/definitions/Error' example: - name: AlarmInstance.InstanceNotFound - code: -253006 - message: An instance with instanceId '5c2cf7e0e0d64403b486fcb4' was not found. + name: Skyline.OneOrMoreErrorsOccurred + code: -251041 + message: One or more errors occurred. See the contained list for details of each error. args: [] + innerErrors: + - name: AlarmInstance.InstanceNotFound + code: -253006 + message: An instance with instanceId '5c2cf7e0e0d64403b486fcb4' was not found. + resourceType: instanceId + resourceId: 5c2cf7e0e0d64403b486fcb4 + args: [5c2cf7e0e0d64403b486fcb4] Operation: description: Operation provided by the API type: object @@ -104,6 +126,11 @@ definitions: rule. type: string example: CRIO1.System.Health.DiskSpaceUsePercentage.Bdd9u!4aMd!$pYrf*CnaIZ2tbu$-Ct%? + workspace: + description: The ID of the workspace to which this alarm instance belongs. Added in version 3 of the + readAlarmInstances operation. + type: string + example: 3d411024-9db8-42d1-8ab8-6cee0e6cd841 active: description: Whether or not the alarm instance is active. An active alarm deserves human or automated attention. Alarm instances always begin life with *active*/true. This field will be automatically @@ -410,6 +437,16 @@ definitions: example: - keyword1 - keyword2 + workspaces: + type: array + description: Workspace query. The service will return instances whose *workspace* field is one of + the specified workspaces. By default, only instances in the default workspace are returned. + Specify an array containing a single value of *\** to query all workspaces. Added in version 3 of the + readAlarmInstances operation. + items: + type: string + example: + - '*' QueryRequest: title: Query Request description: Object describing the request body for an alarm instance query request @@ -487,7 +524,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -516,7 +552,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -529,12 +564,81 @@ paths: description: Not Found schema: $ref: '#/definitions/Error' - /v1/acknowledge-instances: + /v1/acknowledge-instances-by-instance-id: post: tags: [alarm instances] summary: Acknowledge alarm instances description: Acknowledges one or more alarm instances, optionally forcing them clear and adding notes to - them. + them. Added in version 2 of the writeAlarmInstances operation. + operationId: AcknowledgeInstancesByInstanceId + x-ni-operation: writeAlarmInstances + parameters: + - in: body + name: Request body + required: true + schema: + type: object + title: AcknowledgeByInstanceIdRequestBody + required: + - instanceIds + properties: + instanceIds: + description: The *instanceId*s of the alarm instances which should be acknowledged. + type: array + items: + type: string + example: [5c33c212e0d6444320d9a9f4, 5c2cf7e0e0d64403b486fcb4] + forceClear: + description: Whether or not the affected alarm instances should have their *clear* field set + to true. + type: boolean + default: false + notes: + description: Notes which should be added to the alarm instances. + type: array + items: + $ref: '#/definitions/AlarmNote' + responses: + 200: + description: Success - Indicates the request to acknowledge was processed successfully. + If any instances failed to be acknowledged, the included *error* object will contain + an entry in the *innerErrors* array for each failed instance. + schema: + type: object + title: AcknowledgeByInstanceIdResponse + properties: + acknowledged: + description: The *instanceId*s of the alarm instances which were successfully acknowledged. + type: array + items: + type: string + example: [5c33c212e0d6444320d9a9f4] + failed: + description: The *instanceId*s of the alarm instances which were not acknowledged. + See *error* for why each instance failed to be acknowledged. Reasons include the instance + could not be found, the instance was already acknowledged, or the caller is not authorized + to acknowledge the instance. + type: array + items: + type: string + example: [5c2cf7e0e0d64403b486fcb4] + error: + $ref: '#/definitions/Error' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /v1/acknowledge-instances: + post: + tags: [deprecated] + deprecated: true + summary: Acknowledge alarm instances + description: As of version 2 of the writeAlarmInstances operation, this route is deprecated. + Instead, use the POST /v1/acknowledge-instances-by-instance-id route. + + + Acknowledges one or more alarm instances in the default workspace by alarm id, + optionally forcing them clear and adding notes to them. operationId: AcknowledgeInstances x-ni-operation: writeAlarmInstances parameters: @@ -571,23 +675,23 @@ paths: title: AcknowledgeResponse properties: acknowledged: - description: The *alarmIds* which were successfully acknowledged. + description: The *alarmId*s which were successfully acknowledged. type: array items: type: string - example: [5c40ec55e0d6441168b4c543, 5c40ec55e0d6441168b4c543] + example: [System1.Health.DiskSpaceAlarm, System2.Health.DiskSpaceAlarm] alreadyAcknowledged: - description: The *alarmIds* which had already been previously acknowledged. + description: The *alarmId*s which had already been previously acknowledged. type: array items: type: string - example: [5c40ec55e0d6441168b4c541] + example: [System1.Health.DiskSpaceAlarm] notFound: - description: A collection of *alarmIds* for which no active alarm instances were found. + description: A collection of *alarmId*s for which no active alarm instances were found. type: array items: type: string - example: [5c40ec55e0d6441168b4c549] + example: [System2.Health.DiskSpaceAlarm] 401: $ref: '#/responses/Unauthorized' default: @@ -604,7 +708,7 @@ paths: - in: body name: Request body description: Container which holds data for the request. If an alarm instance is being updated, only - alarmId and transition are applied. + alarmId, workspace, and transition are applied. schema: type: object title: CreateOrUpdateInstanceRequest @@ -614,11 +718,17 @@ paths: properties: alarmId: description: A value meant to uniquely identify the particular process or condition tracked - by a given alarm. For example, alarms created by the Tag Rule Engine Service have their - alarmIds set to the concatenation of the path of the tag which caused the rule to be - triggered and the ID of the rule. + by a given alarm within a workspace. For example, alarms created by the Tag Rule Engine + Service have their alarmIds set to the concatenation of the path of the tag which caused + the rule to be triggered and the ID of the rule. type: string example: CRIO1.System.Health.DiskSpaceMeanUsePercentage.Bdd9u!4aMd!$pYrf*CnaIZ2tbu$-Ct%? + workspace: + description: The ID of the workspace in which to create or update the alarm. When not specified, + the default workspace is used based on the requesting user. Added in version 2 of the + writeAlarmInstances operation. + type: string + example: 3d411024-9db8-42d1-8ab8-6cee0e6cd841 transition: $ref: '#/definitions/AlarmTransition' createdBy: @@ -760,7 +870,7 @@ paths: tags: [alarm instances] summary: Query alarm instances description: Queries for alarm instances. Specifying an empty JSON object in the request body will - result in all alarm instances being returned. + result in all alarm instances in the default workspace being returned. operationId: QueryInstances x-ni-operation: readAlarmInstances parameters: @@ -798,10 +908,36 @@ paths: type: string example: - 5c33c212e0d6444320d9a9f4 - - 5c33c212e0d6444320d9a9f5 + - 5c2cf7e0e0d64403b486fcb4 responses: + 200: + description: Partial Success - Indicates the request to delete was processed successfully, + but one or more instances failed to delete. The included *error* object will contain + an entry in the *innerErrors* array for each failed instance. + schema: + type: object + title: DeleteInstancesByInstanceIdPartialSuccess + properties: + deleted: + description: The *instanceId*s of the alarm instances that were successfully deleted. + type: array + items: + type: string + example: + - 5c33c212e0d6444320d9a9f4 + failed: + description: The *instanceId*s of the alarm instances that were not deleted. + See *error* for why each instance failed to delete. Reasons include the + instance could not be found or the caller is not authorized to delete the instance. + type: array + items: + type: string + example: + - 5c2cf7e0e0d64403b486fcb4 + error: + $ref: '#/definitions/Error' 204: - description: No Content + description: Success - Indicates all requested instances were deleted successfully. 401: $ref: '#/responses/Unauthorized' default: From 83668b83eae7899f3c19a25a64bf0b0a9f6ecec3 Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Tue, 28 Apr 2020 07:52:22 +0000 Subject: [PATCH 086/108] Merged PR 70664: Add error object on Register Systems response model We need to return an Error object for unauthorized/failed register requests. I will add tests for the HTTP Handler in a different PR. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-management/nisysmgmt.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index f6d7309..6b217fd 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -250,6 +250,8 @@ definitions: description: The ID of the registration request. type: string example: '068530b9-b059-4c0e-9820-9e9cc4e0832c' + error: + $ref: '#/definitions/Error' required: [requestId] UnregisterSystemsRequest: From 5f52513a3886955b71435cbe7eb2a16927bfa334 Mon Sep 17 00:00:00 2001 From: Milan Raj Date: Wed, 6 May 2020 15:28:27 -0500 Subject: [PATCH 087/108] OpcClient service policy-based auth --- opcclient/niopcclient.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/opcclient/niopcclient.yml b/opcclient/niopcclient.yml index 1306410..75a8a21 100644 --- a/opcclient/niopcclient.yml +++ b/opcclient/niopcclient.yml @@ -16,7 +16,7 @@ securityDefinitions: apiKeyAuth: type: apiKey name: x-ni-api-key - in: header + in: header basicAuth: type: basic cookieAuth: @@ -82,7 +82,7 @@ paths: /v1/client-certificate: get: operationId: HandleHttpGetClientCertificate - x-ni-privilege: Read + x-ni-auth: true tags: [certificate] summary: Gets SystemLink OPC UA client certificate description: Gets SystemLink OPC UA client certificate @@ -100,7 +100,7 @@ paths: /v1/server-certificates: get: operationId: HandleHttpGetServerCertificates - x-ni-privilege: Read + x-ni-auth: true tags: [certificate] summary: Gets list of certificates from the application's trusted store description: Returns list of certificates from the application's trusted store @@ -115,7 +115,7 @@ paths: $ref: '#/responses/Error' post: operationId: HandleHttpUploadServerCertificate - x-ni-privilege: Write + x-ni-auth: true tags: [certificate] summary: Uploads a certificate to application's trusted store description: Uploads the certificate file @@ -137,7 +137,7 @@ paths: /v1/delete-server-certificates: post: operationId: HandleHttpDeleteServerCertificates - x-ni-privilege: Write + x-ni-auth: true tags: [certificate] summary: Deletes certificates from application's trusted store description: Deletes specified certificates @@ -164,7 +164,7 @@ paths: /v1/endpoints: get: operationId: HandleHttpGetEndpoints - x-ni-privilege: Read + x-ni-auth: true tags: [sessions] summary: Gets OPC UA server endpoints description: Returns endpoints of an OPC UA server @@ -187,7 +187,7 @@ paths: /v1/sessions: get: operationId: HandleHttpGetSessionsRequest - x-ni-privilege: Read + x-ni-auth: true tags: [sessions] summary: Gets existing OPC UA sessions description: Returns information about in-progress OPC UA sessions @@ -202,7 +202,7 @@ paths: $ref: '#/responses/Error' post: operationId: HandleHttpCreateSessionRequest - x-ni-privilege: Write + x-ni-auth: true tags: [sessions] summary: Creates a new OPC UA session description: Connects to an OPC UA server to start a new session @@ -223,7 +223,7 @@ paths: /v1/delete-sessions: post: operationId: HandleHttpDeleteSessionsRequest - x-ni-privilege: Write + x-ni-auth: true tags: [sessions] summary: Deletes existing OPC UA sessions description: Deletes existing OPC UA sessions @@ -263,7 +263,7 @@ paths: /v1/update-sessions: post: operationId: HandleHttpUpdateSessionsRequest - x-ni-privilege: Write + x-ni-auth: true tags: [sessions] summary: Updates existing OPC UA sessions description: Modifies name and publishing interval of the existing session @@ -295,7 +295,7 @@ paths: /v1/sessions/{id}/nodes/{path}: get: operationId: HandleHttpBrowseRequest - x-ni-privilege: Read + x-ni-auth: true tags: [browse] summary: Gets child nodes of a node description: Gets child nodes of the node specified by {path} @@ -332,7 +332,7 @@ paths: /v1/sessions/{id}/attributes/{opcNodeId}: get: operationId: HandleHttpReadAttributesRequest - x-ni-privilege: Read + x-ni-auth: true tags: [read] summary: Reads attributes of a node description: Gets attributes for the node speicified by {opcNodeId} @@ -358,7 +358,7 @@ paths: /v1/sessions/{id}/monitors: get: operationId: HandleHttpGetMonitorsRequest - x-ni-privilege: Read + x-ni-auth: true tags: [monitors] summary: Gets existing monitored items description: Creates SystemLink tags with specified display names @@ -379,7 +379,7 @@ paths: $ref: '#/responses/Error' post: operationId: HandleHttpCreateMonitorsRequest - x-ni-privilege: Write + x-ni-auth: true x-ni-request-timeout: 50000 tags: [monitors] summary: Creates new monitored items @@ -415,7 +415,7 @@ paths: /v1/sessions/{id}/delete-monitors: post: operationId: HandleHttpDeleteMonitorRequest - x-ni-privilege: Write + x-ni-auth: true tags: [monitors] summary: Removes existing monitored items description: Removes OPC UA nodes from subscription to stop monitoring them. Can optionally remove the SystemLink tags @@ -451,7 +451,7 @@ paths: /v1/sessions/{id}/pause-monitors: post: operationId: HandleHttpPauseMonitorRequest - x-ni-privilege: Write + x-ni-auth: true tags: [monitors] summary: Pauses existing monitored items description: Pauses to update tag history for the specified OPC UA variables. Doesn't remove the SystemLink tags. @@ -483,7 +483,7 @@ paths: /v1/sessions/{id}/resume-monitors: post: operationId: HandleHttpResumeMonitorRequest - x-ni-privilege: Write + x-ni-auth: true tags: [monitors] summary: Resumes paused monitored items description: Resumes to update the tag history for the specified OPC UA variables. From 13f7f6a76234e701456fad47fa1bc931bf2d9bb0 Mon Sep 17 00:00:00 2001 From: rajsite Date: Fri, 15 May 2020 18:26:34 -0500 Subject: [PATCH 088/108] Style and remove old privilege config --- opcclient/niopcclient.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/opcclient/niopcclient.yml b/opcclient/niopcclient.yml index 75a8a21..6152100 100644 --- a/opcclient/niopcclient.yml +++ b/opcclient/niopcclient.yml @@ -33,7 +33,6 @@ paths: /: get: operationId: HandleGetVersionInfo - x-ni-request-all-privileges: true summary: Gets API information tags: [versioning] description: Returns permissions and operations for the OpcClientService @@ -62,7 +61,6 @@ paths: required: true get: operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true summary: API version information description: Returns available operations for a single version of the API. tags: [versioning] From f8364b98142ff136b45f1ce7c25c3cbe22b3d716 Mon Sep 17 00:00:00 2001 From: Alex Weaver Date: Mon, 18 May 2020 16:07:32 +0000 Subject: [PATCH 089/108] Merged PR 74288: Use a more realistic OpenAPI doc example for step data # Justification The step data object is freeform, and the testmon UI looks for special keys in the step data object, but the OpenAPI doc does not describe what these keys are. # Implementation Use a more realistic example for step data, that utilizes some of the special values. # Testing Rendered docs. # Checklist ~~- [ ] I tested changes to product code in product~~ ~~- [ ] I considered updates to the wiki~~ --- test-monitor/nitestmonitor-v2.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index 0b51e0f..32e5d01 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -1141,9 +1141,16 @@ definitions: example: key1: value1 example: - - key1: value1 - key2: value2 - - key1: value3 + - name: Voltage + status: Passed + measurement: "3.725" + lowLimit: "3.65" + highLimit: "3.8" + nominalValue: "3.7" + units: volt + comparisonType: GELE + - nitmParameterType: ADDITIONAL_RESULTS + additionalProp: myValue TestStepsDeleteRequest: title: Test Steps Delete Request type: object From 164eeb59c5849fd1e6ae383ac4d14148ef6e5514 Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Tue, 19 May 2020 09:49:11 +0000 Subject: [PATCH 090/108] Merged PR 74035: Add error model on CreateJob response We have to return the not found/unauthorized systems # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-management/nisysmgmt.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index 6b217fd..3987044 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -193,6 +193,8 @@ definitions: timeout: 600 refresh_minion_cache: grains: true + error: + $ref: '#/definitions/Error' required: [jid, tgt, fun] RegisterSystemsRequest: From 8fd84f8e05391bd1bbcb29fc9b6e65de8db2890c Mon Sep 17 00:00:00 2001 From: Andrei Zaicescu Date: Thu, 21 May 2020 16:20:58 +0000 Subject: [PATCH 091/108] Merged PR 74215: Query System Utilization to http # Justification We need to expose the system utilization to http so that it can be used in Asset Utilization Notebook Report. # Implementation In the yml file I created QuerySystemUtilizationsRequest which represents the request model. Also in yml I created a model that represents the returned type of the result. Although query asset utilization and query system utilization return an object that contains the same properties and on amqp we could use the same model, on http I had to create a new one for query system utilization ('SystemUtilizationWithPercentageModel') because on the model returned by asset utilization, the assetIdentifier property is required and this property on query system utilization is always null. Also in the yml file I entered the / v1 / query-system-utilization route using the created models. # Testing Unit test I tested the route with Postman # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Query System Utilization to http Related work items: #1001825 --- asset-managment/niapm.yml | 285 ++++++++++++++++++++++++++++++++------ 1 file changed, 239 insertions(+), 46 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index dd6a368..fb61c1f 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -838,6 +838,31 @@ definitions: example: -1 x-example: -1 maximum: 1000 + UtilizationTimeIntervalModel: + title: Utilization Time Interval + description: Time interval for which to retrieve asset/system utilization. + type: object + properties: + startDate: + description: >- + A date time value which can be used to specify the beginning of a timespan. + + This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. + type: string + format: date-time + example: '2019-05-01T00:00:00.000Z' + endDate: + description: >- + A date time value which can be used to specify the end of a timespan. + + This parameter is required to have the "ISO 8601" format in order to be considered valid. + + The time component of the request is ignored. + type: string + format: date-time + example: '2019-05-20T00:00:000Z' parameters: TimespanGranularity: in: query @@ -1317,34 +1342,160 @@ parameters: - ExternalCalibration.Operator.DisplayName: String representing the name of the operator which performed an external calibration on a third-party asset. type: string - example: IsSystemController = true + example: IsNIAsset = true utilizationIntervals: description: Multiple time intervals for which to retrieve asset utilization. type: array items: - title: Utilization Time Interval - type: object - properties: - startDate: - description: >- - A date time value which can be used to specify the beginning of a timespan. + $ref: '#/definitions/UtilizationTimeIntervalModel' + QuerySystemUtilizationRequest: + in: body + name: queryBody + description: Request body consisting of filters for asset utilization, assets, and time intervals. + schema: + title: Query System Utilizations Request + description: Object containing filters for asset utilization, assets, and time intervals. + type: object + required: + - utilizationIntervals + properties: + utilizationFilter: + description: >- + The filter criteria for asset utilization. Consists of a string of queries composed using AND/OR operators. + String values and date strings need to be enclosed in double quotes. + Parenthesis can be used around filters to better define the order of operations. - This parameter is required to have the "ISO 8601" format in order to be considered valid. - - The time component of the request is ignored. - type: string - format: date-time - example: '2019-05-01T00:00:00.000Z' - endDate: - description: >- - A date time value which can be used to specify the end of a timespan. + Filter syntax: '[property name][operator][operand] and [property name][operator][operand]' - This parameter is required to have the "ISO 8601" format in order to be considered valid. - - The time component of the request is ignored. - type: string - format: date-time - example: '2019-05-20T00:00:000Z' + + Operators: + + - Equals operator '='. Example: 'x = y' + + - Not equal operator '!='. Example: 'x != y' + + - Greater than operator '>'. Example: 'x > y' + + - Greater than or equal operator '>='. Example: 'x >= y' + + - Less than operator '<'. Example: 'x < y' + + - Less than or equal operator '<='. Example: 'x <= y' + + - Logical AND operator 'and'. Example: 'x and y' + + - Logical OR operator 'or'. Example: 'x or y' + + - Contains operator '.Contains()', used to check whether a string contains another string. Example: 'x.Contains(y)' + + - Does not contain operator '!.Contains()', used to check whether a string does not contain another string. Example: '!x.Contains(y)' + + + Valid asset utilization properties that can be used in the filter: + + - MinionId: String representing the identifier of a minion in which an asset might be located in. + + - Category: String representing the utilization task category. + + - UserName: : String representing the name of the operator who utilized the asset. + type: string + example: Category = "Test" + assetFilter: + description: >- + The filter criteria for assets. Consists of a string of queries composed using AND/OR operators. + String values and date strings need to be enclosed in double quotes. + Parenthesis can be used around filters to better define the order of operations. + + Filter syntax: '[property name][operator][operand] and [property name][operator][operand]' + + + Operators: + + - Equals operator '='. Example: 'x = y' + + - Not equal operator '!='. Example: 'x != y' + + - Greater than operator '>'. Example: 'x > y' + + - Greater than or equal operator '>='. Example: 'x >= y' + + - Less than operator '<'. Example: 'x < y' + + - Less than or equal operator '<='. Example: 'x <= y' + + - Logical AND operator 'and'. Example: 'x and y' + + - Logical OR operator 'or'. Example: 'x or y' + + - Contains operator '.Contains()', used to check whether a string contains another string. Example: 'x.Contains(y)' + + - Does not contain operator '!.Contains()', used to check whether a string does not contain another string. Example: '!x.Contains(y)' + + + Valid asset properties that can be used in the filter: + + - AssetIdentifier: String representing the unique identifier of an asset. + + - SerialNumber: String representing the serial number of an asset. + + - ModelName: String representing the model name of an asset. + + - ModelNumber: Unsigned integer representing the model number of an asset. + + - VendorName: String representing the vendor name of an asset. + + - VendorNumber: Unsigned integer representing the vendor number of an asset. + + - AssetName: String representing the asset name. + + - FirmwareVersion: String representing the firmware version of an asset. + + - HardwareVersion: String representing the hardware version of an asset. + + - BusType: String enumeration representing the bus type of an asset. Possible values are: BUILT_IN_SYSTEM, PCI_PXI, USB, GPIB, VXI, SERIAL, TCP_IP, CRIO, SCXI, CDAQ, SWITCH_BLOCK, SCC, FIRE_WIRE, ACCESSORY, CAN, SWITCH_BLOCK_DEVICE. + + - IsNIAsset: Boolean flag specifying whether the asset is an NI asset or a third-party asset. + + - Keywords: Collection of string values representing asset metadata keywords. Example: 'Keywords=["keyword1", "keyword2"]'. + + - Properties: Collection of key-value pairs, each key-value pair representing an asset metadata property. Example: 'Properties=["key1":"value1", "key2":"value2"]'. + + - Location.MinionId: String representing the identifier of the minion in which the asset is located in. + + - Location.SystemName: String representing the name of the system that the asset is located in. + + - Location.SlotNumber: Unsigned integer representing the slot number the asset is located in. + + - Location.AssetState.SystemConnection: String enumeration representing the connection state of the system the asset is currently located in. Possible values are: APPROVED, DISCONNECTED, CONNECTED_UPDATE_PENDING, CONNECTED_UPDATE_SUCCESSFUL, CONNECTED_UPDATE_FAILED, UNSUPPORTED, ACTIVATED. + + - Location.AssetState.AssetPresence: String enumeration representing the present status of an asset in a system. Possible values are: INITIALIZING, UNKNOWN, NOT_PRESENT, PRESENT. + + - SupportsSelfCalibration: Boolean flag specifying whether the asset supports self-calibration. + + - SelfCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was self-calibrated. Example: "2018-05-20T00:00:00Z" + + - SupportsExternalCalibration: Boolean flag specifying whether the asset supports external calibration. + + - CalibrationStatus: String enumeration representing the calibration status of an asset. Possible values are: OK, APPROACHING_RECOMMENDED_DUE_DATE, PAST_RECOMMENDED_DUE_DATE. + + - ExternalCalibration.CalibrationDate: ISO-8601 formatted timestamp string specifying the last date the asset was externally-calibrated. Example: "2018-05-20T00:00:00Z" + + - ExternalCalibration.NextRecommendedDate: ISO-8601 formatted timestamp string specifying the recommended date for the next external calibration. Example: "2018-05-20T00:00:00Z" + + - ExternalCalibration.RecommendedInterval: Integer representing the manufacturer-recommended calibration interval, in months. + + - ExternalCalibration.Comments: String representing any external calibration comments. + + - ExternalCalibration.IsLimited: Boolean flag specifying whether the last external calibration was a limited calibration. + + - ExternalCalibration.Operator.DisplayName: String representing the name of the operator which performed an external calibration on a third-party asset. + type: string + example: IsNIAsset = true + utilizationIntervals: + description: Multiple time intervals for which to retrieve system utilization. + type: array + items: + $ref: '#/definitions/UtilizationTimeIntervalModel' QueryAssetUtilizationHistoryRequest: in: body name: queryBody @@ -1916,6 +2067,54 @@ responses: type: number format: double example: 7.38958 + SystemUtilizationWithPercentageResponse: + description: Utilization response containing the collection of utilizations matching the provided filters, in a specific time interval. Besides a time interval, each element contains an asset identifier, a minion id, an utilization category, and a percentage of time that the system was utilized in the time interval. + schema: + title: System Utilization with Percentage Response + description: Response for the utilization query containing the collection of utilizations. Besides a time interval, each element contains an asset identifier, a minion id, an utilization category, and a percentage of time that the system was utilized in the time interval. + type: array + items: + title: System Utilization with Percentage Model + type: object + required: + - startTimestamp + - endTimestamp + - minionId + - percentage + properties: + startTimestamp: + description: >- + A date time value representing the beginning of a system utilization interval. + + This parameter has the "ISO 8601" format in order to be considered valid. + type: string + format: date-time + example: '2019-05-01T00:00:00.519Z' + endTimestamp: + description: >- + A date time value representing the end of a system utilization interval. + + This parameter has the "ISO 8601" format in order to be considered valid. + type: string + format: date-time + example: '2019-05-20T00:00:00Z' + assetIdentifier: + description: String representing the unique identifier of an asset. + type: string + example: "29162;01B245D6;4243;0" + minionId: + description: String representing the unique identifier of a system. + type: string + example: NI_PXIe-8135_Embedded_Controller--MAC-00-80-2F-23-52-65 + category: + description: String representing the utilization task category. + type: string + example: Test + percentage: + description: Percentage of time that the system was utilized in the specified time interval. + type: number + format: double + example: 7.38958 QueryUtilizationHistoryResponse: description: Asset Utilization History response containing the collection of utilizations records matching the provided filters. schema: @@ -2091,7 +2290,6 @@ paths: Currently, the valid combinations of ResponseFormat and Destination are [JSON;INLINE], [CSV;DOWNLOAD], [CSV;FILE_SERVICE]. operationId: get-assets - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/Skip' @@ -2138,7 +2336,6 @@ paths: If the selfCalibration property is set, the supportsSelfCalibration property is automatically set to true by the service no matter if it is specified as false. The same is true for the externalCalibration and supportsExternalCalibration properties. operationId: create-assets - x-ni-operation: writeAssets x-ni-auth: true parameters: - $ref: '#/parameters/CreateAssetsRequestBody' @@ -2189,7 +2386,6 @@ paths: Updating the assetPresence property to NOT_PRESENT succeeds only if it is updated with the same minionId, parent and slotNumber. Updating it to PRESENT always succeeds. operationId: update-assets - x-ni-operation: writeAssets x-ni-auth: true parameters: - $ref: '#/parameters/UpdateAssetsRequestBody' @@ -2208,7 +2404,6 @@ paths: summary: Gets a summary of assets description: Gets asset summary response containing the total number of assets, the number of assets which are active, i.e. present in a connected system, and the number of assets which are not active. operationId: get-asset-summary - x-ni-operation: readAssets x-ni-auth: true responses: 200: @@ -2223,7 +2418,6 @@ paths: summary: Gets a summary of assets supporting calibration description: Gets asset summary of the total number of assets supporting calibration, the number of assets approaching calibration date and the number of assets past their calibration date operationId: get-calibratable-asset-summary - x-ni-operation: readAssets x-ni-auth: true responses: 200: @@ -2238,7 +2432,6 @@ paths: summary: Query assets description: Returns the assets satisfying the provided filtering criteria. If the the caller requests a JSON inline response, the returned assets are filtered based on the filter string and the ids and calibratableOnly properties are not taken into consideration. When the caller requests a CSV response, the filter is not taken into consideration, but the ids and calibratableOnly properties are used to filter the assets from the response. operationId: query-assets - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetsRequest' @@ -2257,7 +2450,6 @@ paths: summary: Gets asset with identifier description: Gets the asset which has the given identifier. operationId: get-asset-with-identifier - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2276,7 +2468,6 @@ paths: summary: Retrieves asset availability history description: Returns availability information for an asset in the specified timespan and split based on the specified time granularity. operationId: get-asset-availability-history - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2320,7 +2511,6 @@ paths: summary: Retrieves asset calibration history description: Returns the calibration history of the asset which has the given identifier. operationId: get-asset-calibration-history - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2342,7 +2532,6 @@ paths: summary: Creates a new calibration history entry for an asset description: Creates a new calibration history entry for a third-party asset. operationId: post-asset-calibration-history - x-ni-operation: writeAssets x-ni-auth: true x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: @@ -2365,7 +2554,6 @@ paths: summary: Deletes calibration history entries description: Deletes multiple calibration history entries for an asset. operationId: post-delete-asset-calibration-history - x-ni-operation: deleteAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2389,7 +2577,6 @@ paths: summary: Queries asset calibration history description: Computes the calibration history of an asset in CSV format. If the destination is download, the response will contain the calibration history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-calibration-history - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2413,7 +2600,6 @@ paths: summary: Queries asset location history description: Computes the location history of an asset in CSV format. If the destination is download, the response will contain the location history file content. If the destination is file ingestion service, the CSV file is sent to the file storing service and an object containing the file identifier is returned. Any other format and destination combinations are not supported yet. operationId: post-asset-query-location-history - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetId' @@ -2437,7 +2623,6 @@ paths: summary: Updates asset metadata description: Performs a request to update the metadata information of an asset. operationId: update-asset-metadata - x-ni-operation: writeAssets x-ni-auth: true consumes: - application/merge-patch+json @@ -2465,7 +2650,6 @@ paths: Stores information related to assets utilization start. The operation is succesful when utilization information can be stored for all asset identifiers provided in the request. It will return a partial success when storing the utilization start information failed for one or more assets. operationId: start-multiple-asset-utilization - x-ni-operation: createUtilization x-ni-auth: true parameters: - $ref: '#/parameters/StartUtilizationRequest' @@ -2487,7 +2671,6 @@ paths: It will return a partial success when end utilization information can be stored for only a subset of the utilization identifiers provided in the request. It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: end-multiple-asset-utilization - x-ni-operation: writeAssets x-ni-auth: true parameters: - $ref: '#/parameters/EndUtilizationRequest' @@ -2509,7 +2692,6 @@ paths: It will return a partial success when utilization heartbeat information can be stored for only a subset of the utilization identifiers provided in the request. It will return a not found response when no stored utilizations matched the provided utilization identifiers. operationId: asset-utilization-multiple-heartbeats - x-ni-operation: writeAssets x-ni-auth: true parameters: - $ref: '#/parameters/HeartbeatUtilizationRequest' @@ -2528,7 +2710,6 @@ paths: summary: Gets availability history for multiple assets. description: Gets availability history for multiple assets based on a specified timespan. operationId: compare-asset-availability - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/AssetAvailabilityComparison' @@ -2564,7 +2745,6 @@ paths: summary: Gets availability history for multiple assets. description: Gets availability history for multiple assets based on the specified timespans. operationId: query-assets-availability - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetsAvailabilityRequestBody' @@ -2600,7 +2780,6 @@ paths: summary: Deletes assets and all information associated with assets. description: Deletes all persisted data for the assets with the provided identifiers. This includes asset properties and all related historical information. operationId: delete-assets - x-ni-operation: deleteAssets x-ni-auth: true parameters: - $ref: '#/parameters/DeleteAssetsRequestBody' @@ -2619,7 +2798,6 @@ paths: summary: Query Asset Utilization description: Retrieves asset utilization matching the provided filters. operationId: read-asset-utilization - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetUtilizationRequest' @@ -2632,13 +2810,30 @@ paths: $ref: '#/responses/Unauthorized' default: $ref: '#/responses/Error' + /v1/query-system-utilization: + post: + tags: [utilization] + summary: Query System Utilization + description: Retrieves system utilization matching the provided filters. + operationId: read-system-utilization + x-ni-auth: true + parameters: + - $ref: '#/parameters/QuerySystemUtilizationRequest' + responses: + 200: + $ref: '#/responses/SystemUtilizationWithPercentageResponse' + 400: + $ref: '#/responses/BadRequest' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' /v1/query-asset-utilization-history: post: tags: [utilization] summary: Query Asset Utilization Historical Data description: Retrieves historical asset utilization data matching the provided filters. An empty request body queries all historical asset utilization data. operationId: query-asset-utilizations - x-ni-operation: readAssets x-ni-auth: true parameters: - $ref: '#/parameters/QueryAssetUtilizationHistoryRequest' @@ -2657,7 +2852,6 @@ paths: summary: Retrieves the service policy description: Retrieves the service policy. operationId: get-policy - x-ni-operation: readAssets x-ni-auth: true responses: 200: @@ -2671,7 +2865,6 @@ paths: summary: Updates the service policy description: Performs a request to update the service policy. operationId: update-policy - x-ni-operation: writeAssets x-ni-auth: true consumes: - application/merge-patch+json From 8f22d4b426bda8db0b9c3549f2b08c8b3a0816aa Mon Sep 17 00:00:00 2001 From: Timo Emondts Date: Fri, 22 May 2020 09:20:42 +0000 Subject: [PATCH 092/108] Merged PR 74744: Remove x-ni-privileges from yml file # Justification x-ni-privileges were used for the old web server privileges. Calls are being blocked if privileges are missing. For the new org modeling, we don't need them anymore. All calls can pass through and are being checked in the backend. # Implementation Removed x-ni-privileges from yml file --- file/nifile.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/file/nifile.yml b/file/nifile.yml index 8c43b1f..d3f10db 100644 --- a/file/nifile.yml +++ b/file/nifile.yml @@ -485,7 +485,6 @@ paths: operationId: ListServiceGroups x-ni-auth: true x-ni-operation: listFiles - x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true responses: 200: @@ -525,7 +524,6 @@ paths: operationId: ListAvailableFiles_GET x-ni-auth: true x-ni-operation: listFiles - x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true parameters: - in: query @@ -593,7 +591,6 @@ paths: operationId: Delete x-ni-auth: true x-ni-operation: deleteFiles - x-ni-privilege: DeleteFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] responses: 204: @@ -617,7 +614,6 @@ paths: x-ni-auth: true operationId: ReceiveFile x-ni-operation: downloadData - x-ni-privilege: DownloadFiles x-ni-request-variables: - REQUEST_METHOD parameters: @@ -665,7 +661,6 @@ paths: operationId: UpdateMetadata x-ni-auth: true x-ni-operation: updateMetadata - x-ni-privilege: ModifyFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: - in: body @@ -717,7 +712,6 @@ paths: operationId: DeleteMultiple x-ni-auth: true x-ni-operation: deleteFiles - x-ni-privilege: DeleteFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] parameters: - in: body @@ -766,7 +760,6 @@ paths: operationId: QueryAvailableFiles x-ni-auth: true x-ni-operation: listFiles - x-ni-privilege: ViewMetadata x-ni-request-all-privileges: true parameters: - in: query @@ -828,7 +821,6 @@ paths: operationId: Upload x-ni-auth: true x-ni-operation: uploadFiles - x-ni-privilege: UploadFiles x-ni-request-variables: [REMOTE_USER, USER_NAME] consumes: - multipart/form-data From af453bc4367c89b6fb51a82a0fde284b8ac2a9a8 Mon Sep 17 00:00:00 2001 From: Timo Emondts Date: Thu, 28 May 2020 12:58:09 +0000 Subject: [PATCH 093/108] Merged PR 75761: Bug 1035085: Removed old privileges # Justification File service was still using NI Web Server privileges # Implementation - Deleted Privileges class - Added usage of PolicyEvaluator in all places where Privileges was used before - Removed x-ni-request-all-privileges - Updated OpenAPIGenerator nuget # Testing Manual testing Related work items: #1035085 --- file/nifile.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/file/nifile.yml b/file/nifile.yml index d3f10db..238e859 100644 --- a/file/nifile.yml +++ b/file/nifile.yml @@ -433,7 +433,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -462,7 +461,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -485,7 +483,6 @@ paths: operationId: ListServiceGroups x-ni-auth: true x-ni-operation: listFiles - x-ni-request-all-privileges: true responses: 200: description: OK @@ -524,7 +521,6 @@ paths: operationId: ListAvailableFiles_GET x-ni-auth: true x-ni-operation: listFiles - x-ni-request-all-privileges: true parameters: - in: query name: skip @@ -760,7 +756,6 @@ paths: operationId: QueryAvailableFiles x-ni-auth: true x-ni-operation: listFiles - x-ni-request-all-privileges: true parameters: - in: query name: skip From 390b293be133d1c8f8e92a51168bd9a761780dc4 Mon Sep 17 00:00:00 2001 From: Timo Emondts Date: Wed, 10 Jun 2020 09:14:53 +0000 Subject: [PATCH 094/108] Merged PR 77626: BUG 1047762: Added workspace to swagger doc # Justification The swagger doc missed to mention that workspace is an accepted query parameter # Implementation Added the missing element Related work items: #1047762 --- file/nifile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/file/nifile.yml b/file/nifile.yml index 238e859..8eb6813 100644 --- a/file/nifile.yml +++ b/file/nifile.yml @@ -836,6 +836,12 @@ paths: once it is uploaded. An ID is expected to be a 24-digit hex string, which is unique among all files. type: string + - in: query + name: workspace + description: The id of the workspace the file belongs to + type: string + default: null + x-example: 1f2641dd-a5ac-4869-835e-5340b4cd386c responses: 201: description: OK From 92e5a77f9619fd94ed9f7c7bfdee285b6c3dcf92 Mon Sep 17 00:00:00 2001 From: Claudiu Ursuta Date: Wed, 10 Jun 2020 13:58:55 +0300 Subject: [PATCH 095/108] The query utilization history route failed to get utilization entries without task name or without user name. --- asset-managment/niapm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index fb61c1f..ef37521 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2134,8 +2134,6 @@ responses: - assetIdentifier - minionId - category - - taskName - - userName - startTimestamp properties: utilizationIdentifier: From 0afba83a22db92adf6be46e9c67a276118509a2e Mon Sep 17 00:00:00 2001 From: Cristian Hotea Date: Mon, 15 Jun 2020 11:53:16 +0000 Subject: [PATCH 096/108] Merged PR 78305: Make operations routes public in Systems Management API ServiceRegistry needs a way to tell the status of the service so we will make the Operations routes public instead of adding a new ping/up route # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- systems-management/nisysmgmt.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/systems-management/nisysmgmt.yml b/systems-management/nisysmgmt.yml index 3987044..9a02235 100644 --- a/systems-management/nisysmgmt.yml +++ b/systems-management/nisysmgmt.yml @@ -1692,7 +1692,6 @@ paths: /: get: operationId: HandleGetVersionInfo - x-ni-auth: true summary: API information tags: [versioning] security: [] @@ -1715,7 +1714,6 @@ paths: /{version}: get: operationId: RootEndpointWithVersion - x-ni-auth: true summary: API version information description: Returns available operations for a single version of the API. tags: [versioning] From 88306e573de80b898309555da1a07a96312df8b5 Mon Sep 17 00:00:00 2001 From: Andrei Zaicescu Date: Mon, 15 Jun 2020 13:08:07 +0000 Subject: [PATCH 097/108] Merged PR 78830: Removed assetId from QuerySystemUtilization Response # Justification On the query system utilization response was returned an assetId that represents the id of a random asset in the system. This didn't bring any value so I removed the attribute from the message. # Implementation Removed assetId from SystemUtilizationWithPercentageResponse from yml file. # Testing I tested in the product I ran unit tests # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #1047560 --- asset-managment/niapm.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index ef37521..3d78c13 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2098,10 +2098,6 @@ responses: type: string format: date-time example: '2019-05-20T00:00:00Z' - assetIdentifier: - description: String representing the unique identifier of an asset. - type: string - example: "29162;01B245D6;4243;0" minionId: description: String representing the unique identifier of a system. type: string From d4e403e6d1b6c7f2cdb5b01ff23dd05575eb7c4b Mon Sep 17 00:00:00 2001 From: Andrei Rogobete Date: Mon, 15 Jun 2020 13:48:35 +0000 Subject: [PATCH 098/108] Merged PR 78527: Remove Service Registry project from the Skyline Solution # Justification The Service Registry service can use the Launcher service to be started and doesn't need the C# Elixir Wrapper anymore. # Implementation Removed the ServiceRegistry project from the Skyline Solution. I already added the Service Descriptor and Configuration JSON files in the installer # Testing - Verified that the Solution builds - Updated the Service Registry installer (in another changelist) and verified that it installs as expected and that it starts as expected # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki --- service-registry/niserviceregistry.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/service-registry/niserviceregistry.yml b/service-registry/niserviceregistry.yml index c147cdf..4db5893 100644 --- a/service-registry/niserviceregistry.yml +++ b/service-registry/niserviceregistry.yml @@ -69,10 +69,6 @@ definitions: description: The ID of the privilege type: string example: "12314121" - dependsOnService: - description: Specifies the logical dependency of this privilege. Usually, this is a backend service - type: string - example: "AssetPerformanceManagement" show: description: Specifies whether this privilege is user visible type: boolean From 94aa4fb1783919807dc60bf40461dbed2d617cde Mon Sep 17 00:00:00 2001 From: Lukas Kall Date: Tue, 16 Jun 2020 12:12:02 +0000 Subject: [PATCH 099/108] Merged PR 79064: Bug 1059635: Preview button in File Viewer is disabled for TDMS files # Justification Due to org modeling, the old web server privileges are not considered anymore. Therefore, the availability of operations should always return true. # Checklist - [x] I tested changes to product code in product - [x] I considered updates to the wiki Related work items: #1059635 --- tdm-reader/nitdmreader.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 11addd3..88b0cca 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -470,7 +470,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true security: [] responses: 200: @@ -498,7 +497,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true security: [] responses: 200: From e8e34c2ec77f4a88372f8b44bfb870ba00da51d8 Mon Sep 17 00:00:00 2001 From: Cameron Waterman Date: Tue, 16 Jun 2020 16:53:23 +0000 Subject: [PATCH 100/108] Merged PR 78947: Fix user data 403 # Justification #1046923 # Implementation Update swagger doc to use new auth keys # Testing Built and tested that 403 no longer occurs (cwaterma1/ - admin/admin) # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #1046923 --- user-data/niuserdata.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/user-data/niuserdata.yml b/user-data/niuserdata.yml index a348e60..ee1424b 100644 --- a/user-data/niuserdata.yml +++ b/user-data/niuserdata.yml @@ -571,7 +571,6 @@ paths: /: get: operationId: RootEndpoint - x-ni-request-all-privileges: true summary: API information description: Returns information about API versions and available operations. tags: [versioning] @@ -598,7 +597,6 @@ paths: required: true get: operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true summary: API version information description: Returns available operations for a single version of the API tags: [versioning] @@ -616,7 +614,7 @@ paths: get: operationId: GetUserDataItems x-ni-operation: queryUserDataItems - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Get All User Data Items description: >- @@ -696,7 +694,7 @@ paths: post: operationId: CreateOrUpdateUserDataItems x-ni-operation: createOrUpdateUserDataItems - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Create or update one or more user data items description: >- @@ -737,7 +735,7 @@ paths: get: operationId: GetUserDataItem x-ni-operation: queryUserDataItems - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Get information about the specified user data item description: >- @@ -755,7 +753,7 @@ paths: delete: operationId: DeleteUserDataItem x-ni-operation: deleteUserDataItems - x-ni-privilege: Write + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Delete the specified user data item description: Deletes the specified user data item. @@ -771,7 +769,7 @@ paths: post: operationId: QueryUserDataItems x-ni-operation: queryUserDataItems - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Query User Data Items description: Queries the user data items. @@ -830,8 +828,7 @@ paths: post: operationId: UpdateUserDataItems x-ni-operation: createOrUpdateUserDataItems - x-ni-privilege: Write - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Update one or more user data items description: >- @@ -864,8 +861,7 @@ paths: post: operationId: DeleteUserDataItems x-ni-operation: deleteUserDataItems - x-ni-privilege: Write - x-ni-request-all-privileges: true + x-ni-auth: true x-ni-request-variables: [REMOTE_USER] summary: Delete user data items description: >- From d2c4839088d1f19c31a3952c0e1e473d5a0b1465 Mon Sep 17 00:00:00 2001 From: Cameron Waterman Date: Tue, 16 Jun 2020 16:53:30 +0000 Subject: [PATCH 101/108] Merged PR 78953: Update TM OpenAPI example OneOrMoreErrorsOccurred error code # Justification #1055403 # Implementation Update swagger doc example error code # Testing None # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki Related work items: #1055403 --- test-monitor/nitestmonitor-v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-monitor/nitestmonitor-v2.yml b/test-monitor/nitestmonitor-v2.yml index 32e5d01..611ced4 100644 --- a/test-monitor/nitestmonitor-v2.yml +++ b/test-monitor/nitestmonitor-v2.yml @@ -59,8 +59,8 @@ definitions: items: $ref: '#/definitions/Error' example: - name: Skyline.OneOrMoreErrorsOccurred - code: -251040 + name: TestMonitorErrorCodes.OneOrMoreErrorsOccurred + code: -252921 message: >- One or more errors occurred. See the contained list for details of each error. From 08f6df2c8bb2fa867f3e7c1297d2aecf11291ca8 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 17 Jun 2020 14:29:21 +0000 Subject: [PATCH 102/108] Merged PR 79285: Remove auth from root routes in niapm and niapmrule # Justification Root routes must not require authentication. https://ni.visualstudio.com/DevCentral/_workitems/edit/1063728 # Implementation Removed "x-ni-auth:true" from the yml files. # Testing Tested locally # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #1063728 --- asset-management-rule/niapmrule.yml | 2 -- asset-managment/niapm.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/asset-management-rule/niapmrule.yml b/asset-management-rule/niapmrule.yml index 28396c1..108aa4c 100644 --- a/asset-management-rule/niapmrule.yml +++ b/asset-management-rule/niapmrule.yml @@ -307,7 +307,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-auth: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -337,7 +336,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-auth: true security: [] responses: 200: diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 3d78c13..fe043f7 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2240,7 +2240,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-auth: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -2265,7 +2264,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-auth: true security: [] responses: 200: From e5a381962ae2adca4a21f74dd1d545f76730e052 Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Thu, 18 Jun 2020 07:20:13 +0000 Subject: [PATCH 103/108] Merged PR 79075: Forward ApiKey from asset manager to file ingestion service # Justification APM service has several routes that send a query result to the FileService. We must forward the ApiKey when sending the request to store the file. The user must specify the workspace where to store the file. # Implementation Update all routes (HTTP and AMQP) that sends data to FileIngestionService to have a new parameter that tells in which workspace to put the file. Forward the ApiKey. When the user does not have permissions to store the file, the error is forwarded back to the client (no change for this, already works). Enable again the FileIngestion integration tests and update then to have FileIngestionService permissions and use a valid workspace id. # Testing Tested local in the product and make all integration tests pass. # Checklist - [x] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #1037900 --- asset-managment/niapm.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index fe043f7..7108112 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -712,6 +712,11 @@ definitions: - INLINE - DOWNLOAD - FILE_SERVICE + FileIngestionWorkspace: + title: File Ingestion Workspace + description: The ID of the workspace to put the file into, if the destination is "FILE_SERVICE". + type: string + example: '5bc5e9092a4fa4c71cfa7197' QueryHistoryRequestModel: title: Query History Request Model description: Object containing options for querying history. @@ -721,6 +726,8 @@ definitions: $ref: '#/definitions/ResponseFormat' destination: $ref: '#/definitions/Destination' + fileIngestionWorkspace: + $ref: '#/definitions/FileIngestionWorkspace' example: responseFormat: CSV destination: DOWNLOAD @@ -1080,6 +1087,8 @@ parameters: $ref: '#/definitions/ResponseFormat' destination: $ref: '#/definitions/Destination' + fileIngestionWorkspace: + $ref: '#/definitions/FileIngestionWorkspace' skip: $ref: '#/definitions/Skip' take: @@ -2309,6 +2318,11 @@ paths: - INLINE - DOWNLOAD - FILE_SERVICE + - in: query + name: fileIngestionWorkspace + description: The ID of the workspace to put the file into, if the destination is "FILE_SERVICE". + type: string + x-example: '5bc5e9092a4fa4c71cfa7197' responses: 200: $ref: '#/responses/AssetsResponse' From a515783f88e84b1ac979cda20ce3a270521119da Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Thu, 18 Jun 2020 14:30:30 +0000 Subject: [PATCH 104/108] Merged PR 78628: Updated tag rule swagger doc # Justification Updated the open API document for the tag rule engine to reflect org modeling changes. # Implementation * Updated versions in TagRuleEngine's `V1Operations` * Added duplicate route * Added workspace field to rule * Added workspace param to query route * Added partial success responses to toggle and delete routes # Testing Validated changes in online swagger previewer - not sure if there's anything else I should check? # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki --- tag-rule/nitagrule.yml | 139 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 132 insertions(+), 7 deletions(-) diff --git a/tag-rule/nitagrule.yml b/tag-rule/nitagrule.yml index 54b8ce7..95e49b1 100644 --- a/tag-rule/nitagrule.yml +++ b/tag-rule/nitagrule.yml @@ -42,11 +42,33 @@ definitions: type: array items: type: string + resourceType: + description: Type of resource associated with the error. + This field is only present for entries in *innerErrors*. + type: string + enum: [tagRule] + resourceId: + description: Identifier of the resource associated with the error. + This field is only present for entries in *innerErrors*. + type: string + innerErrors: + description: Array of individual errors when a request results in multiple errors. + This field is only present when *name* is 'Skyline.OneOrMoreErrorsOccurred'. + type: array + items: + $ref: '#/definitions/Error' example: - name: TagRuleEngine.RuleNotFound - code: -253103 - message: A rule with ID '5c2cf7e0e0d64403b486fcb4' was not found. + name: Skyline.OneOrMoreErrorsOccurred + code: -251041 + message: One or more errors occurred. See the contained list for details of each error. args: [] + innerErrors: + - name: TagRuleEngine.RuleNotFound + code: -253103 + message: A rule with ID '5c2cf7e0e0d64403b486fcb4' was not found. + resourceType: tagRule + resourceId: 5c2cf7e0e0d64403b486fcb4 + args: [5c2cf7e0e0d64403b486fcb4] Operation: description: Operation provided by the API type: object @@ -162,7 +184,7 @@ definitions: key1: value1 RuleCommonFields: title: Rule Common Fields - description: A single-sourced definition of available fields in both an udpate request and the rule type + description: A single-sourced definition of available fields in both an update request and the rule type itself. properties: searchPath: @@ -170,6 +192,11 @@ definitions: a single tag's path, or a string containing wildcard characters which can match multiple tags. type: string example: '*.System.Health.DiskUsePercentage' + workspace: + description: The ID of the workspace to which this rule belongs. Added in version 2 of the + readRules operation. + type: string + example: 3d411024-9db8-42d1-8ab8-6cee0e6cd841 tagDataType: $ref: '#/definitions/TagDataType' conditions: @@ -241,7 +268,6 @@ paths: summary: API information description: Returns information about API versions and available operations. operationId: RootEndpoint - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -271,7 +297,6 @@ paths: summary: API version information description: Returns available operations for a single version of the API. operationId: RootEndpointWithVersion - x-ni-request-all-privileges: true # Explicitly mark security as an empty array - this route does not require any privileges. # Marking it this way prevents it from inheriting the top-level security settings. security: [] @@ -308,6 +333,12 @@ paths: a single tag's path, or a string containing wildcard characters which can match multiple tags. type: string example: '*.System.Health.DiskUsePercentage' + workspace: + description: The ID of the workspace in which to create or update the rule. When not specified, + the default workspace is used based on the requesting user. Added in version 2 of the + writeRules operation. + type: string + example: 3d411024-9db8-42d1-8ab8-6cee0e6cd841 tagDataType: $ref: '#/definitions/TagDataType' conditions: @@ -439,8 +470,34 @@ paths: type: string example: [5c40ec55e0d6441168b4c543, 5c40ec55e0d6441168b4c543] responses: + 200: + description: Partial Success - Indicates the request to delete was processed successfully, + but one or more rules failed to delete. The included *error* object will contain + an entry in the *innerErrors* array for each failed rule. + schema: + type: object + title: DeleteRulesPartialSuccess + properties: + deleted: + description: The *ruleId*s of the rules that were successfully deleted. + type: array + items: + type: string + example: + - 5c33c212e0d6444320d9a9f4 + failed: + description: The *ruleId*s of the rules that were not deleted. + See *error* for why each rule failed to delete. Reasons include the + rule could not be found or the caller is not authorized to delete the rule. + type: array + items: + type: string + example: + - 5c2cf7e0e0d64403b486fcb4 + error: + $ref: '#/definitions/Error' 204: - description: No Content + description: Success - Indicated all requested rules were deleted successfully. 401: $ref: '#/responses/Unauthorized' default: @@ -493,6 +550,8 @@ paths: items: type: string example: [5c40ec55e0d6441168b4c541] + error: + $ref: '#/definitions/Error' 401: $ref: '#/responses/Unauthorized' default: @@ -551,6 +610,14 @@ paths: example: - keyword1 - keyword2 + workspaces: + type: array + description: Workspace query. The service will return rules whose *workspace* field is one of + the specified workspaces. Added in version 2 of the readRules operation. + items: + type: string + example: + - '*' skip: description: Number of entries to skip in the response list. Typically used in combination with the take parameter to implement pagination. @@ -582,3 +649,61 @@ paths: $ref: '#/responses/Unauthorized' default: $ref: '#/responses/Error' + /v1/duplicate-rules: + post: + tags: [rules] + summary: Duplicate rules + description: Duplicates multiple rules into a given workspace + operationId: DuplicateRules + x-ni-operation: writeRules + parameters: + - in: body + name: Request body + required: true + schema: + title: DuplicateRequestBody + type: object + required: + - ids + - workspace + properties: + ids: + description: The IDs of the rules which should be duplicated. + type: array + items: + type: string + example: [5c40ec55e0d6441168b4c543, 5c40ec55e0d6441168b4c543] + workspace: + description: The ID of the workspace in which to duplicate the specified rules. + type: string + example: 3d411024-9db8-42d1-8ab8-6cee0e6cd841 + responses: + 200: + description: OK + schema: + title: DuplicateResponse + type: object + properties: + duplicatedIds: + description: A dictionary where the keys are the IDs of the rules which were successfully + duplicated, and the values are the IDs of the new duplicate rules. + type: object + additionalProperties: + type: string + example: + 5c40ec55e0d6441168b4c543: 5c40ec55e0d6441168b4c545 + 5c40ec55e0d6441168b4c544: 5c40ec55e0d6441168b4c546 + failed: + description: The IDs of the rules which were failed to be duplicated. + See *error* for why each rule failed to duplicate. Reasons include the + rule could not be found or the caller is not authorized to create the rule. + type: array + items: + type: string + example: [5c40ec55e0d6441168b4c541] + error: + $ref: '#/definitions/Error' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' \ No newline at end of file From b6798658d7c0e971ef0912c2d036c58862f8821e Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 19 Jun 2020 09:55:57 +0000 Subject: [PATCH 105/108] Merged PR 79662: Pull in the latest changes from systemlink-openapi-documents Pull in the latest changes from systemlink-openapi-documents Related work items: #81 --- tag-historian/nitaghistorian.yml | 44 ++ user/niuser.yaml | 907 +++++++++++++++++++++++++++++++ 2 files changed, 951 insertions(+) create mode 100644 user/niuser.yaml diff --git a/tag-historian/nitaghistorian.yml b/tag-historian/nitaghistorian.yml index e7a42d4..924e22f 100644 --- a/tag-historian/nitaghistorian.yml +++ b/tag-historian/nitaghistorian.yml @@ -147,6 +147,10 @@ definitions: example: - system1.tag1 - system2.tag1 + workspace: + description: The workspace Id for querying decimated tag values. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 startTime: description: Limits the returned historical values to those written at or after the given time in ISO-6801 format. @@ -187,6 +191,10 @@ definitions: example: - system1.tag1 - system2.tag1 + workspace: + description: The workspace Id for querying tag values. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 startTime: description: Limits the returned historical values to those written at or after the given time in ISO-6801 format. @@ -226,6 +234,10 @@ definitions: description: The path of the tag corresponding to the historical value. type: string example: system1.tag1 + workspace: + description: The workspace Id of the tag + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 value: description: The value of the tag at the time it was written, converted to a string. type: string @@ -266,6 +278,10 @@ definitions: timestamp: '2019-03-13T09:51:38Z' - value: '3.2' timestamp: '2019-03-14T09:51:38Z' + workspace: + description: The workspace Id of the tag values + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 error: description: This value is always null. type: object @@ -472,6 +488,10 @@ definitions: - 'system1.tag1' - 'system2.*' - '*.tag2' + workspace: + description: The workspace Id to subscribe to for tag updates. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 WebSocketSubscribeResponse: title: Web Socket Subscribe Response description: A web socket message sent by the server to confirm a *WebSocketSubscribeRequest* sent @@ -522,6 +542,10 @@ definitions: type: array items: type: string + workspace: + description: The workspace Id to unsubscribe from for tag updates. If this is not specified, the default workspace is assumed. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 WebSocketUnsubscribeResponse: title: Web Socket Unsubscribe Response description: A web socket message sent by the server to confirm a *WebSocketUnsubscribeRequest*. @@ -620,6 +644,10 @@ paths: be returned. type: string example: system1.tag1 + workspace: + description: The workspace Id for querying tag values. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 startTime: description: Limits the returned historical values to those written at or after at the given time in ISO-6801 format. @@ -664,6 +692,10 @@ paths: description: For non-decimated queries, a value generated by the server which should be sent in the next request to retrieve the next page of values. type: string + workspace: + description: The workspace Id of the tag values + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 error: $ref: '#/definitions/ErrorEntry' failed: @@ -704,6 +736,10 @@ paths: example: - system1.tag1 - system2.tag1 + workspace: + description: The workspace Id for querying decimated tag values. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 startTime: description: Limits the returned historical values to those written at or after at the given time in ISO-6801 format. @@ -751,6 +787,10 @@ paths: timestamp: '2019-03-13T09:51:38Z' - value: '3.2' timestamp: '2019-03-14T09:51:38Z' + workspace: + description: The workspace Id of the tag values + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 error: $ref: '#/definitions/ErrorEntry' failed: @@ -791,6 +831,10 @@ paths: example: - tag1 - tag2 + workspace: + description: The workspace Id for exporting tag values. If this is not specified, the tag values from the default workspace will be returned. + type: string + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 responseFormat: description: The format of the response. Currently only supports "CSV" type: string diff --git a/user/niuser.yaml b/user/niuser.yaml new file mode 100644 index 0000000..ba33b8e --- /dev/null +++ b/user/niuser.yaml @@ -0,0 +1,907 @@ +swagger: '2.0' +info: + version: '1.0' + title: SystemLink User Service +basePath: /niuser/v1 +consumes: + - application/json +produces: + - application/json +securityDefinitions: + ApiKeyAuth: + type: apiKey + name: x-ni-api-key + in: header +security: + - ApiKeyAuth: [] +schemes: + - https +paths: + '/orgs/{name}': + get: + tags: + - orgs + summary: 'Get organization' + operationId: get-org + description: Returns the organization with the given name + parameters: + - in: path + required: true + name: name + description: The org name, e.g. 'SystemLink Server' + type: string + responses: + 200: + $ref: '#/responses/GetOrgResponse' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + '/users/query': + post: + tags: + - users + summary: Query the users + description: >- + Use the Dynamic Linq query language to specify filters for users. + An empty request body queries all users. + operationId: query-users + parameters: + - $ref: '#/parameters/QueryUsersRequest' + responses: + 200: + $ref: '#/responses/QueryUsersResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + '/users': + post: + tags: + - users + summary: Creates a new user + description: Create a user + operationId: create-user + parameters: + - $ref: '#/parameters/CreateUserRequest' + responses: + 200: + $ref: '#/responses/CreateUserResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + '/users/{id}': + get: + tags: + - users + summary: 'Get user' + operationId: get-user + description: Lookup a user by user id + parameters: + - in: path + required: true + name: id + description: The user id + type: string + responses: + 200: + $ref: '#/responses/GetUserResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - users + summary: 'Update user' + operationId: update-user + description: Update the user record + parameters: + - $ref: '#/parameters/UserId' + - $ref: '#/parameters/UpdateUserRequest' + responses: + 200: + $ref: '#/responses/UpdateUserResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - users + summary: 'Delete user' + description: Delete a user by user id + operationId: delete-user + parameters: + - type: string + required: true + name: id + in: path + description: The user id + responses: + 204: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + '/workspaces': + get: + tags: + - workspaces + summary: List workspaces + description: List the workspaces of an organization + operationId: get-workspaces + responses: + 200: + $ref: '#/responses/GetWorkspacesResponse' + 401: + $ref: '#/responses/Unauthorized' + post: + tags: + - workspaces + summary: Creates a new workspace + description: Create a workspace + operationId: create-workspace + parameters: + - $ref: '#/parameters/CreateWorkspaceRequest' + responses: + 200: + $ref: '#/responses/CreateWorkspaceResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + '/workspaces/{id}': + put: + tags: + - workspaces + summary: 'Update workspace' + operationId: update-workspace + description: Update the workspace + parameters: + - $ref: '#/parameters/WorkspaceId' + - $ref: '#/parameters/UpdateWorkspaceRequest' + responses: + 200: + $ref: '#/responses/UpdateWorkspaceResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + '/auth-mappings': + get: + tags: + - auth-mappings + summary: List auth-mappings + description: List the auth-mappings of an organization + operationId: get-auth-mappings + parameters: + - in: query + name: workspace + description: Filters the auth mappings by workspace + type: string + - in: query + name: skip + description: How many auth mappings to skip in the result when paging. + type: integer + - in: query + name: take + description: How many auth mappings to return in the result + type: integer + default: 50 + maximum: 100 + responses: + 200: + $ref: '#/responses/GetAuthMappingsResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + post: + tags: + - auth-mappings + summary: Creates a new auth-mapping + description: Create a auth-mapping + operationId: create-auth-mapping + parameters: + - $ref: '#/parameters/CreateAuthMappingRequest' + responses: + 200: + $ref: '#/responses/CreateAuthMappingResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + '/auth-mappings/{id}': + put: + tags: + - auth-mappings + summary: 'Update auth-mapping' + operationId: update-auth-mapping + description: Update the auth-mapping + parameters: + - $ref: '#/parameters/AuthMappingId' + - $ref: '#/parameters/UpdateAuthMappingRequest' + responses: + 200: + $ref: '#/responses/UpdateAuthMappingResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - auth-mappings + summary: Deletes an auth-mapping + description: Deletes the auth-mapping with the given Id + operationId: delete-auth-mapping + parameters: + - $ref: '#/parameters/AuthMappingId' + responses: + 204: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + '/websocket': + get: + tags: + - web socket + summary: Open a WebSocket session + description: Opens a persistent connection to the web server that allows two-way communication using + a JSON protocol. After you open a connection, you can subscribe to workspace creation notifications. + Refer to the *Models* section to access the schema for these actions. + operationId: OpenWebSocketSession + parameters: + - in: header + name: Upgrade + type: string + required: true + x-example: websocket + - in: header + name: Connection + type: string + required: true + x-example: Upgrade + - in: header + name: Sec-WebSocket-Version + description: Protocol version of the WebSocket connection. + type: string + required: true + x-example: 13 + - in: header + name: Sec-WebSocket-Key + description: Randomly selected sixteen-byte base64-encoded string. Used to confirm a + valid WebSocket handshake. Must be selected randomly for each new connection. + type: string + required: true + x-example: dGhlIHNhbXBsZSBub25jZQ== + responses: + 101: + description: Switching Protocols + headers: + Sec-WebSocket-Accept: + description: Used in the WebSocket opening handshake. Set to a value derived from the + Sec-WebSocket-Key header. + type: string + 401: + $ref: '#/responses/Unauthorized' + 426: + description: Upgrade Required + default: + $ref: '#/responses/Error' + +parameters: + UserId: + in: path + name: id + description: The identifier of a user + type: string + required: true + WorkspaceId: + in: path + name: id + description: The identifier of a workspace + type: string + required: true + AuthMappingId: + in: path + name: id + description: The identifier of an auth mapping + type: string + required: true + + QueryUsersRequest: + in: body + name: queryUsersRequest + description: Request to query for users + schema: + title: Query Users Request + description: Filters to query for users + type: object + properties: + filter: + description: >- + The filter criteria for users, consisting of a string of queries composed using AND/OR operators. + String values need to be enclosed in double quotes. + Parenthesis can be used within the filter to better define the order of operations. + + + Filter syntax: '[property name][operator][operand] and [property name][operator][operand]' + + + Operators: + + - Equals operator '='. Example: 'x = y' + + - Not equal operator '!='. Example: 'x != y' + + - Greater than operator '>'. Example: 'x > y' + + - Greater than or equal operator '>='. Example: 'x >= y' + + - Less than operator '<'. Example: 'x < y' + + - Less than or equal operator '<='. Example: 'x <= y' + + - Logical AND operator 'and'. Example: 'x and y' + + - Logical OR operator 'or'. Example: 'x or y' + + - Contains operator '.Contains()', used to check whether a string contains another string. Example: 'x.Contains(y)' + + - Does not contain operator '!.Contains()', used to check whether a string does not contain another string. Example: '!x.Contains(y)' + + - String null or empty 'string.IsNullOrEmpty()', used to check whether a string is null or empty. Example: 'string.IsNullOrEmpty(x)' + + - String is not null or empty '!string.IsNullOrEmpty()', used to check whether a string is not null or empty. Example: '!string.IsNullOrEmpty(x)' + + + Valid user properties that can be used in the filter: + + - id + + - firstName + + - lastName + + - email + + - niuaId + + - login + + - status + type: string + example: firstName.Contains("John") && status == "active" + take: + description: The maximum number of users to return + type: integer + default: 100 + minimum: 0 + maximum: 1000 + example: 10 + sortby: + description: The field name for sorting the results + type: string + enum: [firstName, lastName, email, niuaId, login, status] + order: + description: Sort by ascending or descending order + type: string + enum: [ascending, descending] + continuationToken: + description: The continuation token can be used to paginate through the user query results. Provide this token in the next query users call. + type: string + example: token + CreateUserRequest: + in: body + name: createUserRequest + description: Request to create a new user + schema: + title: Create User Request + description: Creates a new user in the callers' organization + type: object + properties: + firstName: + type: string + description: First name filter + lastName: + type: string + description: Last name filter + email: + type: string + description: Email filter + niuaId: + type: string + description: niua Id filter + acceptedToS: + type: boolean + description: Filter for users which accepted or not accepted the terms of services + policies: + type: array + items: + type: string + description: A list of policy ids. Defines the permissions of the user in the organization. + keywords: + type: array + items: + type: string + description: A list of keywords associated with the user + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + UpdateUserRequest: + in: body + name: updateUserRequest + description: Request to update an existing user + schema: + title: Update User Request + description: Updates an existing user + type: object + properties: + firstName: + type: string + description: First name filter + lastName: + type: string + description: Last name filter + email: + type: string + description: Email filter + acceptedToS: + type: boolean + description: Filter for users which accepted or not accepted the terms of services + policies: + type: array + items: + type: string + description: A list of policy ids. Defines the permissions of the user in the organization. + keywords: + type: array + items: + type: string + description: A list of keywords associated with the user + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + + CreateWorkspaceRequest: + in: body + name: createWorkspaceRequest + description: Request to create a new workspace + schema: + title: Create Workspace Request + description: Creates a new workspace + type: object + properties: + name: + type: string + description: The workspace name, must be unique in the organization + UpdateWorkspaceRequest: + in: body + name: updateWorkspaceRequest + description: Request to update an existing workspace + schema: + title: Update Workspace Request + description: Updates an existing workspace + type: object + properties: + name: + type: string + description: The workspace name, must be unique in the organization + enabled: + type: boolean + description: Whether the workspace is enabled or disabled. If a workspace is disabled, requests to create new resources in this workspace will fail but queries still return the resources in this workspace. + + CreateAuthMappingRequest: + in: body + name: createAuthMappingRequest + description: Request to create a new auth mapping + schema: + title: Create Auth Mapping Request + description: Creates a new auth mapping + type: object + properties: + type: + type: string + enum: [user, windows-group, windows-user, ldap-group, ldap-attribute, ldap-user] + description: The Auth Mapping type + policyId: + type: string + description: The policy id this mapping references. + policyTemplateId: + type: string + description: The policy template id this mapping references. + workspace: + type: string + description: The workspace id. + selector: + type: object + description: The selector + properties: + key: + type: string + description: The Auth Mapping selector key + value: + type: string + description: The Auth Mapping selector value + + UpdateAuthMappingRequest: + in: body + name: updateAuthMappingRequest + description: Request to update an existing auth mapping + schema: + title: Update Auth Mapping Request + description: Updates an existing auth mapping + type: object + properties: + type: + type: string + enum: [user, windows-group, windows-user, ldap-group, ldap-attribute, ldap-user] + description: The Auth Mapping type + policyId: + type: string + description: The policy id this mapping references. + policyTemplateId: + type: string + description: The policy template id this mapping references. + selector: + type: object + description: The selector + properties: + key: + type: string + description: The Auth Mapping selector key + value: + type: string + description: The Auth Mapping selector value + +responses: + Unauthorized: + description: API Key is missing or invalid + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + ValidationError: + description: Invalid input data + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + NotFound: + description: The resource was not found. + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + Error: + description: Error Response + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + GetOrgResponse: + description: Auth Response + schema: + $ref: '#/definitions/Org' + + QueryUsersResponse: + description: Query Users Response + schema: + title: Query Users Response + type: object + properties: + continuationToken: + description: The continuation token can be used to paginate through the user list results. Provide this token in the next list users call. + type: string + example: token + users: + description: List of users + type: array + items: + $ref: '#/definitions/User' + CreateUserResponse: + description: Create User Response + schema: + $ref: '#/definitions/User' + GetUserResponse: + description: Get User Response + schema: + $ref: '#/definitions/User' + UpdateUserResponse: + description: Update User Response + schema: + $ref: '#/definitions/User' + + GetWorkspacesResponse: + description: Get Workspaces Response + schema: + title: Get Workspaces Response + type: object + properties: + workspaces: + description: List of workspaces + type: array + items: + $ref: '#/definitions/Workspace' + CreateWorkspaceResponse: + description: Create Workspaces Response + schema: + $ref: '#/definitions/Workspace' + UpdateWorkspaceResponse: + description: Update Workspaces Response + schema: + $ref: '#/definitions/Workspace' + + GetAuthMappingsResponse: + description: Get Auth Mappings Response + schema: + title: Get Auth Mappings Response + type: object + properties: + authMappings: + description: List of auth mappings + type: array + items: + $ref: '#/definitions/AuthMapping' + CreateAuthMappingResponse: + description: Create Auth Mapping Response + schema: + $ref: '#/definitions/AuthMapping' + UpdateAuthMappingResponse: + description: Update Auth Mapping Response + schema: + $ref: '#/definitions/AuthMapping' +definitions: + User: + type: object + title: User + description: The user details + properties: + id: + type: string + description: The unique id + firstName: + type: string + description: The first name + lastName: + type: string + description: The last name + email: + type: string + description: The email + niuaId: + type: string + description: The external id (niuaId, SID, login name) + acceptedToS: + type: boolean + description: Whether the user accepted the terms of service + properties: + type: object + description: A map of key value properties associated with the user + keywords: + type: array + items: + type: string + description: A list of keywords associated with the user + created: + type: string + format: date-time + description: The created timestamp + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp + example: "2019-12-02T15:31:45.379Z" + orgId: + type: string + description: The id of the organization + policies: + type: array + items: + type: string + description: A list of policy ids + status: + type: string + enum: [pending, active] + description: The status of the users' registration + Org: + type: object + title: Org + description: Organization the user belongs to + properties: + id: + type: string + description: The unique id + name: + type: string + description: The name of the organization + owner: + $ref: '#/definitions/User' + workspaces: + description: The list of workspaces in the organization + type: array + items: + $ref: '#/definitions/Workspace' + Workspace: + type: object + title: Workspace + description: Information about the workspace + properties: + id: + type: string + description: The unique id + name: + type: string + description: The workspace name + enabled: + type: boolean + description: Whether the workspace is enabled or not + default: + type: boolean + description: Whether the workspace is the default. The default workspace is used when callers omit a workspace id + AuthMapping: + type: object + title: Auth Mapping + description: Information about the auth mapping + properties: + id: + type: string + description: The unique id + type: + type: string + description: The auth mapping type + policyId: + type: string + description: The policy id this mapping references. + policyTemplateId: + type: string + description: The policy template id this mapping references. + workspace: + type: string + description: The workspace id. + selector: + type: object + description: The selector + properties: + key: + type: string + description: The Auth Mapping selector key + value: + type: string + description: The Auth Mapping selector value + Error: + description: Contains error information + type: object + properties: + name: + description: String error code + type: string + code: + description: Numeric error code + type: integer + format: int32 + resourceType: + description: Type of resource associated with the error + type: string + resourceId: + description: Identifier of the resource associated with the error + type: string + message: + description: Complete error message + type: string + args: + description: Positional argument values for the error code + type: array + items: + type: string + innerErrors: + type: array + items: + $ref: '#/definitions/Error' + example: + name: Auth.ServerError + code: -12345 + message: There has been an error with your request + args: [] + innerErrors: [] + + WebSocketAsyncWorkspacesSubscribeRequest: + title: Web Socket Workspaces Subscribe Request + description: A web socket message sent by the client to subscribe to notifications when workspaces are created + type: object + required: + - action + properties: + action: + description: The action to perform. Must be set to "UserAsyncWorkspacesSubscribeRequest". + type: string + enum: ['UserAsyncWorkspacesSubscribeRequest'] + example: UserAsyncWorkspacesSubscribeRequest + + WebSocketAsyncWorkspacesSubscribeResponse: + title: Web Socket Workspaces Subscribe Response + description: A web socket message sent by the server to confirm a *WebSocketAsyncWorkspacesSubscribeRequest*. + type: object + properties: + action: + description: The action performed. Must be set to "UserAsyncWorkspacesSubscribeResponse". + type: string + enum: ['UserAsyncWorkspacesSubscribeResponse'] + example: UserAsyncWorkspacesSubscribeResponse + + WebSocketWorkspaceCreatedMessage: + title: Web Socket Workspace Created Message + description: A web socket message sent by the server when a new workspace is created. + type: object + properties: + action: + description: The action performed. Must be set to "UserWorkspacesCreatedRoutedMessage". + type: string + enum: ['UserWorkspacesCreatedRoutedMessage'] + example: UserWorkspacesCreatedRoutedMessage + workspace: + $ref: '#/definitions/Workspace' From 763e166a8e5f4f8037e5a4e7792cb68be7bec3cc Mon Sep 17 00:00:00 2001 From: Vlad Baja Date: Wed, 24 Jun 2020 10:05:45 +0000 Subject: [PATCH 106/108] Merged PR 80256: Update HTTP API to include system name and asset name in the query system # Justification We moved the AMQP query utilization APIs to HTTP and for some reason we forgot to add some properties that are used by the asset utilization notebook in the group by asset and group by system cases. # Implementation Added back the properties that are required by the asset utilization notebook, to not change the notebook to obtain those again. # Testing Tested locally. # Checklist - [ ] I tested changes to product code in product - [ ] I considered updates to the wiki Related work items: #1064880 --- asset-managment/niapm.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/asset-managment/niapm.yml b/asset-managment/niapm.yml index 7108112..cfb6859 100644 --- a/asset-managment/niapm.yml +++ b/asset-managment/niapm.yml @@ -2063,6 +2063,10 @@ responses: description: String representing the unique identifier of an asset. type: string example: "29162;01B245D6;4243;0" + assetName: + description: String representing the name of an asset. + type: string + example: PCISlot2 minionId: description: Identifier of the minion where the asset is located. type: string @@ -2111,6 +2115,10 @@ responses: description: String representing the unique identifier of a system. type: string example: NI_PXIe-8135_Embedded_Controller--MAC-00-80-2F-23-52-65 + systemName: + description: String representing the alias of a system. + type: string + example: PXIe Alias category: description: String representing the utilization task category. type: string From dc0f7d6ee2e2d5d4e0c18f60e5a66a440ea757a0 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 26 Jun 2020 09:20:02 +0000 Subject: [PATCH 107/108] Merged PR 80653: Pull in latest openapi changes Pull in latest openapi changes Related work items: #81, #82, #83 --- auth/niauth.yaml | 1117 ++++++++++++++++++++++++++++++++++++++++++++++ user/niuser.yaml | 79 ++-- 2 files changed, 1169 insertions(+), 27 deletions(-) create mode 100644 auth/niauth.yaml diff --git a/auth/niauth.yaml b/auth/niauth.yaml new file mode 100644 index 0000000..a17f4bc --- /dev/null +++ b/auth/niauth.yaml @@ -0,0 +1,1117 @@ +swagger: '2.0' +info: + version: '1.0' + title: SystemLink Auth Service +basePath: /niauth/v1 +consumes: + - application/json +produces: + - application/json +securityDefinitions: + ApiKeyAuth: + type: apiKey + name: x-ni-api-key + in: header +security: + - ApiKeyAuth: [] +schemes: + - https +paths: + /auth: + get: + tags: + - auth + summary: Authenticates API Keys + description: Authenticates the given x-ni-api-key and returns information about the caller + operationId: auth + responses: + 200: + $ref: '#/responses/AuthResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + /session-keys: + post: + tags: + - keys + summary: Creates temporary API Keys + description: Create a temporary session key which is valid for 1 hour. The caller needs a whitelisted API key to issue session keys. + operationId: create-session-key + parameters: + - $ref: '#/parameters/CreateSessionKeyRequest' + responses: + 200: + $ref: '#/responses/CreateSessionKeyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + + /keys: + get: + tags: + - keys + summary: Lists all API Keys + description: Returns the list of permanent api keys + operationId: get-keys + parameters: + - in: query + name: name + description: Filters the keys by name + type: string + - in: query + name: skip + description: How many keys to skip in the result when paging. + type: integer + - in: query + name: take + description: How many keys to return in the result + type: integer + default: 50 + maximum: 100 + - in: query + name: sortby + description: The field name for sorting the results + type: string + enum: [name, created, updated] + - in: query + name: order + description: Sort by ascending or descending order + type: string + enum: [ascending, descending] + responses: + 200: + $ref: '#/responses/GetKeysResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + post: + tags: + - keys + summary: Creates a new API Key + description: Create a permanent API Key + operationId: create-key + parameters: + - $ref: '#/parameters/CreateKeyRequest' + responses: + 200: + $ref: '#/responses/CreateKeyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /keys/{id}: + get: + tags: + - keys + summary: Gets an API Key by the given Id + description: Returns the API Key for the given Id + operationId: get-key + parameters: + - $ref: '#/parameters/KeyId' + responses: + 200: + $ref: '#/responses/GetKeyResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - keys + summary: Updates an API Key + description: Updates the API Key with the given Id + operationId: update-key + parameters: + - $ref: '#/parameters/KeyId' + - $ref: '#/parameters/UpdateKeyRequest' + responses: + 200: + $ref: '#/responses/UpdateKeyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - keys + summary: Deletes an API Key + description: Deletes the API Key with the given Id + operationId: delete-key + parameters: + - $ref: '#/parameters/KeyId' + responses: + 204: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + /policies: + get: + tags: + - policies + summary: Lists all policies + description: Returns the list of policies + operationId: get-policies + parameters: + - in: query + name: name + description: Filters the policies by name + type: string + - in: query + name: type + description: Filters the policies by type. Can be a comma-separated list of types. + type: string + - in: query + name: builtIn + description: Filters the policies by the builtIn flag. + type: boolean + - in: query + name: id + description: Filters the policies by id. Can be a comma-separated list of ids. + type: string + - in: query + name: skip + description: How many policies to skip in the result when paging. + type: integer + - in: query + name: take + description: How many policies to return in the result + type: integer + default: 50 + maximum: 100 + - in: query + name: sortby + description: The field name for sorting the results + type: string + enum: [name, created, updated] + - in: query + name: order + description: Sort by ascending or descending order + type: string + enum: [ascending, descending] + responses: + 200: + $ref: '#/responses/GetPoliciesResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + post: + tags: + - policies + summary: Creates a new policy + description: Creates a new policy + operationId: create-policy + parameters: + - $ref: '#/parameters/CreatePolicyRequest' + responses: + 200: + $ref: '#/responses/CreatePolicyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /policies/{id}: + get: + tags: + - policies + summary: Gets a policy by the given Id + description: Returns the policy for the given Id + operationId: get-policy + parameters: + - $ref: '#/parameters/PolicyId' + responses: + 200: + $ref: '#/responses/GetPolicyResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - policies + summary: Updates a policy + description: Updates the policy with the given Id + operationId: update-policy + parameters: + - $ref: '#/parameters/PolicyId' + - $ref: '#/parameters/UpdatePolicyRequest' + responses: + 200: + $ref: '#/responses/UpdatePolicyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - policies + summary: Deletes a policy + description: Deletes the policy with the given Id + operationId: delete-policy + parameters: + - $ref: '#/parameters/PolicyId' + responses: + 204: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + /policy-templates: + get: + tags: + - policy-templates + summary: Lists all policy-templates + description: Returns the list of policy-templates + operationId: get-policy-templates + parameters: + - in: query + name: name + description: Filters the policy-templates by name + type: string + - in: query + name: type + description: Filters the policy-templates by type. Can be a comma-separated list of types. + type: string + - in: query + name: builtIn + description: Filters the policy-templates by the builtIn flag. + type: boolean + - in: query + name: id + description: Filters the policy-templates by id. Can be a comma-separated list of ids. + type: string + - in: query + name: skip + description: How many policy-templates to skip in the result when paging. + type: integer + - in: query + name: take + description: How many policy-templates to return in the result + type: integer + default: 50 + maximum: 100 + - in: query + name: sortby + description: The field name for sorting the results + type: string + enum: [name, created, updated] + - in: query + name: order + description: Sort by ascending or descending order + type: string + enum: [ascending, descending] + responses: + 200: + $ref: '#/responses/GetPolicyTemplatesResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + post: + tags: + - policy-templates + summary: Creates a new policy-template + description: Creates a new policy-template + operationId: create-policy-template + parameters: + - $ref: '#/parameters/CreatePolicyTemplateRequest' + responses: + 200: + $ref: '#/responses/CreatePolicyTemplateResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + /policy-templates/{id}: + get: + tags: + - policy-templates + summary: Gets a policy-template by the given Id + description: Returns the policy-template for the given Id + operationId: get-policy-template + parameters: + - $ref: '#/parameters/PolicyTemplateId' + responses: + 200: + $ref: '#/responses/GetPolicyTemplateResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - policy-templates + summary: Updates a policy-template + description: Updates the policy-template with the given Id + operationId: update-policy-template + parameters: + - $ref: '#/parameters/PolicyTemplateId' + - $ref: '#/parameters/UpdatePolicyTemplateRequest' + responses: + 200: + $ref: '#/responses/UpdatePolicyTemplateResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - policy-templates + summary: Deletes a policy-template + description: Deletes the policy-template with the given Id + operationId: delete-policy-template + parameters: + - $ref: '#/parameters/PolicyTemplateId' + responses: + 204: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + +definitions: + AuthStatement: + type: object + title: Auth Statement + description: A statement defines what a user or device is allowed to do + properties: + actions: + type: array + items: + type: string + description: A list of actions the user is allowed to perform + resource: + type: array + items: + type: string + description: A list of resources the user is allowed to access + workspace: + type: string + description: The workspace the user is allowed to access + AuthPolicy: + type: object + title: Auth Policy + description: A policy defines what a user or device is allowed to do + properties: + statements: + type: array + items: + $ref: '#/definitions/AuthStatement' + description: A list of statements defining the actions the user can perform on a resource in a workspace + PolicyTemplate: + type: object + title: Policy Template + description: A policy template defines what a user or device is allowed to do but is not bound to a workspace. When the template is referenced by a policy, the connection between the actions and the workspace is created. + properties: + id: + type: string + description: The unique id + name: + type: string + description: The policy template's name + type: + type: string + description: The type of the policy template + builtIn: + type: boolean + description: Whether the policy template is built-in + userId: + type: string + description: The user id + created: + type: string + format: date-time + description: The created timestamp + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp + example: "2019-12-02T15:31:45.379Z" + deleted: + type: boolean + description: Whether the policy is deleted or not + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements defining the actions the user can perform on a resource + Statement: + type: object + title: Statement + description: A statement defines what a user or device is allowed to do + properties: + actions: + type: array + items: + type: string + description: A list of actions the user is allowed to perform + resource: + type: array + items: + type: string + description: A list of resources the user is allowed to access + workspace: + type: string + description: The workspace the user is allowed to access + description: + type: string + description: A description for this statement + Policy: + type: object + title: Policy + description: A policy defines what a user or device is allowed to do + properties: + id: + type: string + description: The unique id + name: + type: string + description: The policies's name + type: + type: string + description: The type of the policy + builtIn: + type: boolean + description: Whether the policy is built-in + userId: + type: string + description: The user id + created: + type: string + format: date-time + description: The created timestamp + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp + example: "2019-12-02T15:31:45.379Z" + deleted: + type: boolean + description: Whether the policy is deleted or not + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements defining the actions the user can perform on a resource in a workspace + templateId: + type: string + description: The id of the policy template. Only set if the policy has been created based on a template and does not contain inline statements. + workspace: + type: string + description: The workspace the policy template applies to. Only set if the policy has been created based on a template and does not contain inline statements. + Key: + type: object + title: API Key + description: The API Key can be used to authenticate a user or device + properties: + id: + type: string + description: The unique id + name: + type: string + description: The key's name + userId: + type: string + description: The user id + created: + type: string + format: date-time + description: The created timestamp + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp + example: "2019-12-02T15:31:45.379Z" + expiry: + type: string + format: date-time + description: The time when the key expires (epoch in milliseconds) + example: "2019-12-02T15:31:45.379Z" + enabled: + type: boolean + description: Whether the key is enabled or not + deleted: + type: boolean + description: Whether the key is deleted or not + defaultWorkspace: + type: string + description: This field overrides the default workspace when authenticating. + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + policies: + type: array + items: + $ref: '#/definitions/Policy' + description: A list of policy definitions including statements and permissions + User: + type: object + title: User + description: The user details + properties: + id: + type: string + description: The unique id + firstName: + type: string + description: The first name + lastName: + type: string + description: The last name + email: + type: string + description: The email + niuaId: + type: string + description: The external id (niuaId, SID, login name) + acceptedToS: + type: boolean + description: Whether the user accepted the terms of service + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + keywords: + type: array + items: + type: string + description: A list of keywords associated with the user + created: + type: string + format: date-time + description: The created timestamp + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp + example: "2019-12-02T15:31:45.379Z" + orgId: + type: string + description: The id of the organization + policies: + type: array + items: + type: string + description: A list of policy ids to reference existing policies + status: + type: string + enum: [pending, active] + description: The status of the users' registration + Org: + type: object + title: Org + description: Organization the user belongs to + properties: + id: + type: string + description: The unique id + name: + type: string + description: The name of the organization + ownerId: + type: string + description: The userId of the organization owner + Workspace: + type: object + title: Workspace + description: Information about the workspace + properties: + id: + type: string + description: The unique id + name: + type: string + description: The workspace name + enabled: + type: boolean + description: Whether the workspace is enabled or not + default: + type: boolean + description: Whether the workspace is the default. The default workspace is used when callers omit a workspace id + Error: + description: Contains error information + type: object + properties: + name: + description: String error code + type: string + code: + description: Numeric error code + type: integer + format: int32 + resourceType: + description: Type of resource associated with the error + type: string + resourceId: + description: Identifier of the resource associated with the error + type: string + message: + description: Complete error message + type: string + args: + description: Positional argument values for the error code + type: array + items: + type: string + innerErrors: + type: array + items: + $ref: '#/definitions/Error' + example: + name: Auth.ServerError + code: -12345 + message: There has been an error with your request + args: [] + innerErrors: [] + +parameters: + KeyId: + in: path + name: id + description: The identifier of an API Key. + type: string + required: true + PolicyId: + in: path + name: id + description: The identifier of a policy. + type: string + required: true + PolicyTemplateId: + in: path + name: id + description: The identifier of a policy template. + type: string + required: true + CreateSessionKeyRequest: + in: body + name: createSessionKey + description: The request to create session keys + schema: + title: Create Session Key Request + description: Parameters for creating temporary session keys + type: object + properties: + orgId: + type: string + description: The org id + userId: + type: string + description: The user id + policies: + type: array + items: + $ref: '#/definitions/Policy' + description: A list of policy definitions including statements and permissions + policyIds: + type: array + items: + type: string + description: A list of policy ids to reference existing policies + defaultWorkspace: + type: string + description: This field overrides the default workspace when authenticating. + durationSeconds: + type: integer + minimum: 1 + maximum: 86400 + description: The time in seconds how long the temporary key is valid + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + + CreateKeyRequest: + in: body + name: createKey + description: The request to create an API Key + schema: + title: Create Key Request + description: Parameters for creating API Keys + type: object + properties: + name: + type: string + description: The name + policyIds: + type: array + items: + type: string + description: A list of policy ids to reference existing policies + defaultWorkspace: + type: string + description: This field overrides the default workspace when authenticating. + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + UpdateKeyRequest: + in: body + name: updateKey + description: The request to update an existing API Key + schema: + title: Update Key Request + description: Parameters for updating API Keys + type: object + properties: + name: + type: string + description: The name + policyIds: + type: array + items: + type: string + description: A list of policy ids to reference existing policies + defaultWorkspace: + type: string + description: This field overrides the default workspace when authenticating. + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + enabled: + type: boolean + description: Whether the key is enabled or not + + CreatePolicyRequest: + in: body + name: createPolicy + description: The request to create a policy + schema: + title: Create Policy Request + description: Parameters for creating policies + type: object + properties: + name: + type: string + description: The name + type: + type: string + enum: [default, internal, custom, role] + description: The policy type + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements which define the actions a user or device is allowed to perform + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + UpdatePolicyRequest: + in: body + name: updatePolicy + description: The request to update an existing policy + schema: + title: Update Policy Request + description: Parameters for updating policies + type: object + properties: + name: + type: string + description: The name + type: + type: string + enum: [default, internal, custom, role] + description: The policy type + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements which define the actions a user or device is allowed to perform + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + + CreatePolicyTemplateRequest: + in: body + name: createPolicyTemplate + description: The request to create a policy template + schema: + title: Create Policy Template Request + description: Parameters for creating policies + type: object + properties: + name: + type: string + description: The name + type: + type: string + enum: [user, service] + description: The policy template type + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements which define the actions a user or device is allowed to perform + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + UpdatePolicyTemplateRequest: + in: body + name: updatePolicyTemplate + description: The request to update an existing policy + schema: + title: Update Policy Template Request + description: Parameters for updating policy templates + type: object + properties: + name: + type: string + description: The name + type: + type: string + enum: [user, service] + description: The policy template type + statements: + type: array + items: + $ref: '#/definitions/Statement' + description: A list of statements which define the actions a user or device is allowed to perform + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + +responses: + Unauthorized: + description: API Key is missing or invalid + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + ValidationError: + description: Invalid input data + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + NotFound: + description: The resource was not found. + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + Error: + description: Error Response + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + + AuthResponse: + description: Auth Response + schema: + type: object + title: Auth Response + properties: + user: + $ref: '#/definitions/User' + org: + $ref: '#/definitions/Org' + workspaces: + type: array + items: + $ref: '#/definitions/Workspace' + policies: + type: array + items: + $ref: '#/definitions/AuthPolicy' + properties: + type: object + description: A map of key value properties + additionalProperties: + type: string + example: + key1: value1 + + CreateSessionKeyResponse: + description: Create Session Key Response + schema: + $ref: '#/definitions/Key' + + GetKeysResponse: + description: Get Keys Response + schema: + title: Get Keys Response + type: object + properties: + totalCount: + description: Total number of keys which match a given query + type: integer + keys: + description: List of keys + type: array + items: + $ref: '#/definitions/Key' + CreateKeyResponse: + description: Create Key Response + schema: + $ref: '#/definitions/Key' + GetKeyResponse: + description: Get Key Response + schema: + $ref: '#/definitions/Key' + UpdateKeyResponse: + description: Update Key Response + schema: + $ref: '#/definitions/Key' + + GetPoliciesResponse: + description: Get Policies Response + schema: + title: Get Policies Response + type: object + properties: + totalCount: + description: Total number of policies which match a given query + type: integer + policies: + description: List of policies + type: array + items: + $ref: '#/definitions/Policy' + CreatePolicyResponse: + description: Create Policy Response + schema: + $ref: '#/definitions/Policy' + GetPolicyResponse: + description: Get Policy Response + schema: + $ref: '#/definitions/Policy' + UpdatePolicyResponse: + description: Update Policy Response + schema: + $ref: '#/definitions/Policy' + + GetPolicyTemplatesResponse: + description: Get Policy Templates Response + schema: + title: Get Policy Templates Response + type: object + properties: + totalCount: + description: Total number of policy templates which match a given query + type: integer + policyTemplates: + description: List of policy templates + type: array + items: + $ref: '#/definitions/PolicyTemplate' + CreatePolicyTemplateResponse: + description: Create Policy Template Response + schema: + $ref: '#/definitions/PolicyTemplate' + GetPolicyTemplateResponse: + description: Get Policy Template Response + schema: + $ref: '#/definitions/PolicyTemplate' + UpdatePolicyTemplateResponse: + description: Update Policy Template Response + schema: + $ref: '#/definitions/PolicyTemplate' diff --git a/user/niuser.yaml b/user/niuser.yaml index ba33b8e..6084068 100644 --- a/user/niuser.yaml +++ b/user/niuser.yaml @@ -149,6 +149,31 @@ paths: summary: List workspaces description: List the workspaces of an organization operationId: get-workspaces + parameters: + - in: query + name: name + description: Filters the workspaces by name + type: string + - in: query + name: skip + description: How many workspaces to skip in the result when paging. + type: integer + - in: query + name: take + description: How many workspaces to return in the result. + type: integer + default: 50 + maximum: 100 + - in: query + name: sortby + description: The field name for sorting the results + type: string + enum: [name] + - in: query + name: order + description: Sort by ascending or descending order + type: string + enum: [ascending, descending] responses: 200: $ref: '#/responses/GetWorkspacesResponse' @@ -362,61 +387,61 @@ parameters: The filter criteria for users, consisting of a string of queries composed using AND/OR operators. String values need to be enclosed in double quotes. Parenthesis can be used within the filter to better define the order of operations. - - + + Filter syntax: '[property name][operator][operand] and [property name][operator][operand]' - - + + Operators: - + - Equals operator '='. Example: 'x = y' - + - Not equal operator '!='. Example: 'x != y' - + - Greater than operator '>'. Example: 'x > y' - + - Greater than or equal operator '>='. Example: 'x >= y' - + - Less than operator '<'. Example: 'x < y' - + - Less than or equal operator '<='. Example: 'x <= y' - + - Logical AND operator 'and'. Example: 'x and y' - + - Logical OR operator 'or'. Example: 'x or y' - + - Contains operator '.Contains()', used to check whether a string contains another string. Example: 'x.Contains(y)' - + - Does not contain operator '!.Contains()', used to check whether a string does not contain another string. Example: '!x.Contains(y)' - + - String null or empty 'string.IsNullOrEmpty()', used to check whether a string is null or empty. Example: 'string.IsNullOrEmpty(x)' - + - String is not null or empty '!string.IsNullOrEmpty()', used to check whether a string is not null or empty. Example: '!string.IsNullOrEmpty(x)' - - + + Valid user properties that can be used in the filter: - + - id - + - firstName - + - lastName - + - email - + - niuaId - + - login - + - status type: string example: firstName.Contains("John") && status == "active" take: description: The maximum number of users to return type: integer - default: 100 + default: 50 minimum: 0 - maximum: 1000 + maximum: 100 example: 10 sortby: description: The field name for sorting the results From 366e6f39b7c5c968421a7e86d35fc196bff95414 Mon Sep 17 00:00:00 2001 From: Paul Spangler Date: Tue, 4 Aug 2020 12:48:45 -0500 Subject: [PATCH 108/108] Merge changes from subtree --- auth/niauth.yaml | 40 ++- message/nimessage.yml | 46 ++- tdm-reader/nitdmreader.yml | 2 +- user/niuser.yaml | 44 ++- webapp/niapp.yaml | 682 +++++++++++++++++++++++++++++++++++++ 5 files changed, 767 insertions(+), 47 deletions(-) create mode 100644 webapp/niapp.yaml diff --git a/auth/niauth.yaml b/auth/niauth.yaml index a17f4bc..74a1e87 100644 --- a/auth/niauth.yaml +++ b/auth/niauth.yaml @@ -14,8 +14,6 @@ securityDefinitions: in: header security: - ApiKeyAuth: [] -schemes: - - https paths: /auth: get: @@ -32,25 +30,6 @@ paths: default: $ref: '#/responses/Error' - /session-keys: - post: - tags: - - keys - summary: Creates temporary API Keys - description: Create a temporary session key which is valid for 1 hour. The caller needs a whitelisted API key to issue session keys. - operationId: create-session-key - parameters: - - $ref: '#/parameters/CreateSessionKeyRequest' - responses: - 200: - $ref: '#/responses/CreateSessionKeyResponse' - 400: - $ref: '#/responses/ValidationError' - 401: - $ref: '#/responses/Unauthorized' - default: - $ref: '#/responses/Error' - /keys: get: tags: @@ -411,6 +390,25 @@ paths: default: $ref: '#/responses/Error' + /session-keys: + post: + tags: + - whitelisted operations + summary: Creates temporary API Keys + description: Create a temporary session key which is valid for 1 hour. The caller needs a whitelisted API key to issue session keys. + operationId: create-session-key + parameters: + - $ref: '#/parameters/CreateSessionKeyRequest' + responses: + 200: + $ref: '#/responses/CreateSessionKeyResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + definitions: AuthStatement: type: object diff --git a/message/nimessage.yml b/message/nimessage.yml index 1f6eba9..a6777a7 100644 --- a/message/nimessage.yml +++ b/message/nimessage.yml @@ -30,6 +30,17 @@ responses: WWW_Authenticate: description: Information for how to authenticate (sent only from SystemLink Server). type: string + + ValidationError: + description: Invalid input data + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + Error: description: Error schema: @@ -47,6 +58,21 @@ parameters: description: Unique session ID type: string required: true + CreateSessionRequest: + in: body + name: createSessionRequest + description: Request to create a new session + schema: + title: Create Session Request + description: Creates a message session with the server to send and receive messages. + type: object + properties: + workspace: + type: string + description: The ID of the workspace used by this session. + example: 8472777d-8e2f-4c42-bceb-7901ede23085 + example: + workspace: 8472777d-8e2f-4c42-bceb-7901ede23085 paths: /v1/sessions: @@ -56,11 +82,15 @@ paths: summary: Create a session description: Creates a message session with the server to send and receive messages. operationId: CreateSession + parameters: + - $ref: '#/parameters/CreateSessionRequest' responses: 200: schema: $ref: '#/definitions/SessionToken' description: Success + 400: + $ref: '#/responses/ValidationError' 401: $ref: '#/responses/Unauthorized' 403: @@ -228,13 +258,19 @@ paths: /v1/websocket: get: tags: - - webSocket (SystemLink Server only) + - webSocket summary: Open a WebSocket session description: Opens a persistent connection to the web server that allows two-way communication using a JSON protocol. After you open a connection, you can publish messages and subscribe or unsubscribe to topics. - Refer to the *Models* section to access the schema for these actions. SystemLink Cloud does not support WebSocket connections. + Refer to the *Models* section to access the schema for these actions. operationId: OpenWebSocketSession parameters: + - in: query + name: workspace + description: The ID of the workspace used by this session. + type: string + required: false + x-example: c04c612b-0ba8-4c8e-a8af-a7f314c44715 - in: header name: Upgrade type: string @@ -264,6 +300,12 @@ paths: Sec-WebSocket-Accept: description: Used in the WebSocket opening handshake. Set to a value derived from the Sec-WebSocket-Key header. type: string + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 403: + description: Reached the maximum number of sessions 426: description: Upgrade Required diff --git a/tdm-reader/nitdmreader.yml b/tdm-reader/nitdmreader.yml index 88b0cca..41a78cc 100644 --- a/tdm-reader/nitdmreader.yml +++ b/tdm-reader/nitdmreader.yml @@ -359,7 +359,7 @@ definitions: properties: x: $ref: '#/definitions/OneChannelData' - y: + 'y': type: array description: Array of y channels items: diff --git a/user/niuser.yaml b/user/niuser.yaml index 6084068..a13c29e 100644 --- a/user/niuser.yaml +++ b/user/niuser.yaml @@ -14,30 +14,7 @@ securityDefinitions: in: header security: - ApiKeyAuth: [] -schemes: - - https paths: - '/orgs/{name}': - get: - tags: - - orgs - summary: 'Get organization' - operationId: get-org - description: Returns the organization with the given name - parameters: - - in: path - required: true - name: name - description: The org name, e.g. 'SystemLink Server' - type: string - responses: - 200: - $ref: '#/responses/GetOrgResponse' - 404: - $ref: '#/responses/NotFound' - default: - $ref: '#/responses/Error' - '/users/query': post: tags: @@ -305,6 +282,27 @@ paths: default: $ref: '#/responses/Error' + '/orgs/{name}': + get: + tags: + - whitelisted operations + summary: 'Get organization' + operationId: get-org + description: Returns the organization with the given name. The caller needs a whitelisted API key to read organizations. + parameters: + - in: path + required: true + name: name + description: The org name, e.g. 'SystemLink Server' + type: string + responses: + 200: + $ref: '#/responses/GetOrgResponse' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + '/websocket': get: tags: diff --git a/webapp/niapp.yaml b/webapp/niapp.yaml new file mode 100644 index 0000000..36a7768 --- /dev/null +++ b/webapp/niapp.yaml @@ -0,0 +1,682 @@ +swagger: '2.0' +info: + version: '1.0' + title: SystemLink WebApp Service +basePath: /niapp/v1 +consumes: + - application/json +produces: + - application/json +securityDefinitions: + ApiKeyAuth: + type: apiKey + name: x-ni-api-key + in: header +security: + - ApiKeyAuth: [] +paths: + '/webapps/{id}': + get: + tags: + - metadata + summary: Get webapp metadata by Id + description: Get webapp metadata by Id + operationId: get-webapp + parameters: + - $ref: '#/parameters/WebAppId' + responses: + 200: + $ref: '#/responses/GetWebAppResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - metadata + summary: Update webapp metadata by Id + description: Update existing webapp metadata + operationId: update-webapp + parameters: + - $ref: '#/parameters/WebAppId' + - $ref: '#/parameters/UpdateWebAppRequest' + responses: + 200: + $ref: '#/responses/UpdateWebAppResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + delete: + tags: + - metadata + summary: Delete webapp by Id + description: Delete existing webapp metadata and content + operationId: delete-webapp + parameters: + - $ref: '#/parameters/WebAppId' + responses: + 200: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + '/webapps': + get: + tags: + - metadata + summary: List the webapps + description: List the webapps + operationId: list-webapps + parameters: + - in: query + name: name + description: Filters the webapps by name + type: string + - in: query + name: type + description: Filters the webapps by type + type: string + enum: + - Dashboard + - DashboardTemplate + - WebVI + - in: query + name: userId + description: Filters the webapps by the user Id of the owner + type: string + - in: query + name: workspace + description: Filters the webapps by workspace Id + type: string + - in: query + name: continuationToken + description: The continuation token can be used to paginate through the webapp list results. Provide a token to continue a previous listing. + type: string + - in: query + name: take + description: The maximum number of webapps to return + type: integer + default: 100 + minimum: 0 + maximum: 1000 + responses: + 200: + $ref: '#/responses/ListWebAppsResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + post: + tags: + - metadata + summary: Create a new webapp + description: Create a new webapp + operationId: create-webapp + parameters: + - $ref: '#/parameters/CreateWebAppRequest' + responses: + 200: + $ref: '#/responses/CreateWebAppResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + '/webapps/query': + post: + tags: + - metadata + summary: Query the webapps + description: >- + Use the Dynamic Linq query language to specify filters for webapps. + An empty request body queries all webapps. + operationId: query + parameters: + - in: body + name: postBody + description: Query filter + required: false + schema: + $ref: '#/definitions/WebAppsAdvancedQuery' + responses: + 200: + $ref: '#/responses/ListWebAppsResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + '/webapps/{id}/sharing': + put: + tags: + - metadata + summary: Update sharing settings of the webapp + description: Update sharing settings of the webapp + operationId: update-webapp-sharing + parameters: + - $ref: '#/parameters/WebAppId' + - $ref: '#/parameters/UpdateWebAppSharingRequest' + responses: + 200: + $ref: '#/responses/UpdateWebAppSharingResponse' + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + '/webapps/shared-emails': + get: + tags: + - metadata + summary: List the emails with which the user has shared webapps + description: List the emails with which the user has shared webapps + operationId: list-shared-emails + responses: + 200: + $ref: '#/responses/SharedEmailsResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + '/webapps/import': + post: + tags: + - metadata + summary: Import webapp metadata + description: >- + Import a list of webapp metadata. + + The webapp Id, created timestamp, and updated timestamp are optional. These fields will be generated by the service if they are not provided in the request. + operationId: import-webapps + parameters: + - $ref: '#/parameters/ImportWebAppsRequest' + responses: + 200: + $ref: '#/responses/ImportWebAppsResponse' + 401: + $ref: '#/responses/Unauthorized' + default: + $ref: '#/responses/Error' + '/webapps/{id}/content': + get: + tags: + - content + summary: Get webapp content + description: Get the content of a webapp. ContentType varies from JSON for dashboards and templates or redirect to main HTML for WebVIs + operationId: get-content-index + parameters: + - $ref: '#/parameters/WebAppId' + responses: + 200: + description: The webapp's content. JSON for Dashboards, HTML for WebVIs + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + put: + tags: + - content + summary: Upload content for an existing webapp + description: Upload content for an existing webapp + operationId: update-content + parameters: + - $ref: '#/parameters/WebAppId' + - in: body + required: true + name: content + description: The webapp content to upload + schema: + $ref: '#/definitions/WebAppContent' + responses: + 200: + description: Success + 400: + $ref: '#/responses/ValidationError' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + '/webapps/{id}/content/{path}': + get: + tags: + - content + summary: Get webapp content by path + description: Get the webapp content at a path. This applies to webapps with multiple files, such as WebVIs. + operationId: get-content + parameters: + - $ref: '#/parameters/WebAppId' + - $ref: '#/parameters/WebAppContentPath' + responses: + 200: + $ref: '#/definitions/WebAppContent' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + + '/webapps/{sourceId}/duplicate': + post: + tags: + - content + summary: Duplicate webapp + description: Duplicate a webapp by creating new webapp metadata with the specified name and duplicating existing content into the new webapp. + operationId: duplicate-webapp + parameters: + - in: path + type: string + required: true + name: sourceId + description: The Id of the source webapp to copy content from + - $ref: '#/parameters/DuplicateWebAppRequest' + responses: + 200: + $ref: '#/responses/CreateWebAppResponse' + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + '/webapps/{id}/duplicate/{sourceId}': + post: + tags: + - content + summary: Duplicate webapp content + description: Duplicate webapp content + operationId: duplicate-content + parameters: + - $ref: '#/parameters/WebAppId' + - in: path + type: string + required: true + name: sourceId + description: The Id of the source webapp to copy content from + responses: + 200: + description: Success + 401: + $ref: '#/responses/Unauthorized' + 404: + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/Error' + +parameters: + WebAppId: + in: path + name: id + description: The webapp identifier + type: string + required: true + WebAppContentPath: + in: path + name: path + description: Path to webapp content + type: string + required: true + CreateWebAppRequest: + in: body + name: CreateWebAppRequest + description: Create WebApp Request + schema: + type: object + title: Create WebApp Request + properties: + name: + type: string + description: The webapp's name + example: My webapp + workspace: + type: string + description: The workspace Id for the webapp. If this is not specified, the webapp will be created in the default workspace. + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 + policyIds: + type: array + items: + type: string + example: "asdsad-17a6-45323-b64b-65325287372d" + description: List of policy Ids associated with the webapp, which give it access to the user's resources" + properties: + type: object + description: A map of key value properties associated with the webapp + additionalProperties: + type: string + example: + key1: value1 + UpdateWebAppRequest: + in: body + name: UpdateWebAppRequest + description: Update WebApp Request + schema: + type: object + title: Update WebApp Request + properties: + name: + type: string + description: The webapp's name + example: My webapp + workspace: + type: string + description: The workspace Id for the webapp. If this is not specified, the webapp will remain in its existing workspace. + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 + policyIds: + type: array + items: + type: string + example: "asdsad-17a6-45323-b64b-65325287372d" + description: List of policy Ids associated with the webapp, which give it access to the user's resources" + properties: + type: object + description: A map of key value properties associated with the webapp + additionalProperties: + type: string + example: + key1: value1 + UpdateWebAppSharingRequest: + in: body + name: UpdateWebAppSharingRequest + description: Update WebApp Sharing Request + schema: + type: object + title: Update WebApp Sharing Request + properties: + shared: + type: string + enum: + - private + - direct + - public + example: direct + description: The webapp's sharing option + sharedEmails: + type: array + items: + type: string + example: john.doe@email.com + description: List of emails of users to share the webapp with. Applies when "shared" option is "direct" + ImportWebAppsRequest: + in: body + name: ImportWebAppsRequest + description: Import WebApp Metadata Request + schema: + type: object + title: Import WebApp Metadata Request + properties: + webapps: + description: List of webapps to import + type: array + items: + $ref: '#/definitions/WebApp' + DuplicateWebAppRequest: + in: body + name: DuplicateWebAppRequest + description: Duplicate WebApp Request + schema: + type: object + title: Duplicate WebApp Request + properties: + name: + type: string + description: The name of the new webapp created during the duplication + example: My webapp name + workspace: + type: string + description: The Id of the workspace in which to create the new webapp. If no workspace is specified, the new webapp will be put in the default workspace. + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 + +responses: + Error: + description: Error + schema: + description: Error response + title: ErrorResponse + type: object + properties: + error: + $ref: '#/definitions/Error' + Unauthorized: + description: API Key is missing or invalid + NotFound: + description: The resource was not found. + ValidationError: + description: Invalid input data + GetWebAppResponse: + description: Get WebApp Response + schema: + $ref: '#/definitions/WebApp' + CreateWebAppResponse: + description: Create WebApp Response + schema: + $ref: '#/definitions/WebApp' + ImportWebAppsResponse: + description: Import WebApps Response + schema: + title: Import WebApps Response + type: object + properties: + webapps: + description: List of webapps that were imported + type: array + items: + $ref: '#/definitions/WebApp' + UpdateWebAppResponse: + description: Update WebApp Response + schema: + $ref: '#/definitions/WebApp' + UpdateWebAppSharingResponse: + description: Update WebApp Sharing Response + schema: + $ref: '#/definitions/WebApp' + ListWebAppsResponse: + description: List WebApps Response + schema: + title: List WebApps Response + type: object + properties: + webapps: + description: List of webapps + type: array + items: + $ref: '#/definitions/WebApp' + continuationToken: + description: The continuation token can be used to paginate through the webapp list results. Provide this token in the next list webapps call. + type: string + example: token + SharedEmailsResponse: + description: Shared Emails Response + schema: + title: Shared Emails Response + type: array + items: + type: string + example: john.doe@email.com + +definitions: + WebApp: + type: object + title: WebApp Metadata + properties: + id : + type: string + description: The webapp Id + example: "asdsad-17a6-45323-b64b-65325287372d" + type: + type: string + enum: + - Dashboard + - TileDashboard + - DashboardTemplate + - WebVI + - Visualization + - VisualizationTemplate + description: The webapp type + name: + type: string + description: The webapp name + example: My webapp + workspace: + type: string + description: The Id of the workspace containing the webapp + example: 0c80cf49-54e9-4e92-b117-3bfa574caa84 + userId: + type: string + description: The Id of the user that created the webapp + example: d4f6b766-da45-4fe5-85c5-bd745c402cf9 + shared: + type: string + enum: + - private + - direct + - public + description: The webapp's sharing option + sharedEmails: + type: array + items: + type: string + example: john.doe@ni.com + description: List of emails of users to share the webapp with. Applies when "shared" option is "direct" + policyIds: + type: array + items: + type: string + example: asdsad-17a6-45323-b64b-65325287372d + description: List of policy Ids associated with the webapp, which give it access to the user's resources" + created: + type: string + format: date-time + description: The created timestamp (iso8601 format) + example: "2019-12-02T15:31:45.379Z" + updated: + type: string + format: date-time + description: The last updated timestamp (iso8601 format) + example: "2019-12-02T15:31:45.379Z" + properties: + type: object + description: A map of key value properties associated with the webapp + WebAppContent: + type: string + format: binary + title: WebApp Content + description: The webapp binary content. Depending on the webapp's type it can be a dashboard, template or *.nipkg file exported from LabVIEW NXG + WebAppsAdvancedQuery: + type: object + title: Advanced Query Object for WebApps + properties: + filter: + description: >- + The filter criteria for webapps, consisting of a string of queries composed using AND/OR operators. + String values need to be enclosed in double quotes. + Parenthesis can be used within the filter to better define the order of operations. + + + Filter syntax: '[property name][operator][operand] and [property name][operator][operand]' + + Operators: + + - Equals operator '='. Example: 'x = y' + + - Not equal operator '!='. Example: 'x != y' + + - Greater than operator '>'. Example: 'x > y' + + - Greater than or equal operator '>='. Example: 'x >= y' + + - Less than operator '<'. Example: 'x < y' + + - Less than or equal operator '<='. Example: 'x <= y' + + - Logical AND operator 'and'. Example: 'x and y' + + - Logical OR operator 'or'. Example: 'x or y' + + - Starts with operator '.StartsWith()', used to check whether a string starts with another string. Example: 'x.StartsWith(y)' + + - Does not start with operator '!.StartsWith()', used to check whether a string does not start with another string. Example: '!x.StartsWith(y)' + + - String null or empty 'string.IsNullOrEmpty()', used to check whether a string is null or empty. Example: 'string.IsNullOrEmpty(x)' + + - String is not null or empty '!string.IsNullOrEmpty()', used to check whether a string is not null or empty. Example: '!string.IsNullOrEmpty(x)' + + + Valid webapp properties that can be used in the filter: + + - id + + - name + + - properties.embedLocation + + - shared + + - type + + - workspace + type: string + example: name.StartsWith("myWebApp") || type == "WebVI" + take: + description: The maximum number of webapps to return + type: integer + default: 100 + minimum: 0 + maximum: 1000 + example: 10 + continuationToken: + description: The continuation token can be used to paginate through the webapp query results. Provide this token in the next query webapps call. + type: string + example: token + Error: + description: Contains error information + type: object + properties: + name: + description: String error code + type: string + code: + description: Numeric error code + type: integer + message: + description: Complete error message + type: string + args: + description: Positional argument values for the error code + type: array + items: + type: string + innerErrors: + type: array + items: + $ref: '#/definitions/Error' + example: + name: Skyline.OneOrMoreErrorsOccurred + code: -251041 + message: >- + One or more errors occurred. See the contained list for details of each + error. + args: [] + innerErrors: + - name: DocumentManager.NotFound + code: -252520 + message: The specified document was not found. + args: [] \ No newline at end of file