213a48c8d6
Co-authored-by: Hoppe Wang <hoppewang@microsoft.com> |
||
---|---|---|
.. | ||
config | ||
i18n | ||
src | ||
swagger | ||
generate-client.ps1 | ||
jest.config.js | ||
package-lock.json | ||
package.json | ||
readme.md | ||
tsconfig.json |
readme.md
Batch Service Libaray
This package intended to act as a decoupled data access & business logic layer for the Batch service, which also including two Rest Level Client (RLC) for the Batch Data plane and Batch Management plane.
RLC (Rest Level Client) is an Azure specific SDK flavor that emphasizes seamless developer experience by acting as a layer above raw HTTP calls. One of the major benefits of this SDK type is that they provide a compact, browser friendly bundle size footprint by relying on an abstract REST client and contains Batch specific Typescript type definitions as oppose to exportable classes. More information about RLCs can be found here.
Development Prerequisites
Before developing against this library, please consult the Developer Prerequisites section of <ROOT_DIR>/packages/README.md
.
Package Layout
-
src/internal/batch-rest
contains the Batch Data plane RLC -
src/internal/arm-batch-rest
contains the Batch Management plane RLC -
src/internal/client-http
contains the HTTP client code that is shared between the Batch Data plane and Batch Management plane RLCs -
swagger
- This subdirectory contains the swagger configuration file containing documented autorest command options to make the Batch Management RLC code regeneration process easier to invoke in case there is a need to refresh the rest api input file or other changes. The associated README.md configuration file contains autorest command options such as: package name and version, swagger input file, source code folder path, client authentication customization, etc. One of the command options within the file is the input-file option which is a link to the openAPI Batch swagger file under the public Azure Rest API Spec repo. In order to regenerate the SDK to pick up the latest API swagger definitions, you will need to change the input-file path to point to the file denoted under the latest API version. -
<ROOT_DIR>/eng/emitter-package.json
- This file is used bytsp-client
to install the required dependencies to setup the local TypeSpec project for generating the Batch Data plane RLC, see more details in Azure JS SDK RLC quickstart and tsp-client npm readme
Generating the Batch Data Plane RLC
Batch Data Plane RLC is generated based on our TypeSpec files. First make sure src\internal\batch-rest\generated\tsp-location.yaml
is updated with the github repo and the commit hash which has the targeted tspconfig.yml
and *.tsp
files. Then then run the following from the root of the service
package:
npm run generate:client
This will execute generate-client.ps1
which runs tsp-client
command to fetch the remote tspconfig.yml
and *.tsp
files and install the required dependencies for a local TypeSpec project in src/internal/arm-batch-rest/generated/TempTypeSpecFiles
, which shouldn't be checked in as it's a temporaty project. Then, the tsp-client
will generate the Batch Data plane RLC code based on this local TypeSpec project, see more details in the tsp-client npm readme
src/internal/batch-rest/generated/src
- This holds the autogenerated code such as obtaining the client and Batch specific modeless interfaces. These files should generally not be modified manually.
Generating the Batch Management RLC
Batch Management RLC is generated based on swagger files by autorest. First make sure input-file
in swagger/README.md
is pointing to the latest API version. Then then run the following from the root of the service
package:
npm run generate:arm-client
This will parse the command options from the README and regenerate the SDK code
src/internal/arm-batch-rest/generated
- This holds the swagger autogenerated code such as obtaining the client and Batch specific modeless interfaces. These files should generally not be modified manually.