You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/golang/implementation.md
+2-22Lines changed: 2 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,14 @@ sidebar: general_sidebar
8
8
9
9
## API Implementation
10
10
11
-
TODO
11
+
This section describes guidelines for implementing Azure SDK client libraries. Please note that some of these guidelines are automatically enforced by code generation tools.
12
12
13
13
### The Service Client
14
14
15
-
TODO
15
+
Service clients are the main starting points for developers calling Azure services with the Azure SDK. Each client library should have at least one client, so it’s easy to discover. The guidelines in this section describe patterns for the design of a service client.
16
16
17
17
#### Service Methods
18
18
19
-
TODO
20
-
21
19
##### Using azcore.Pipeline
22
20
23
21
Each supported language has an Azure Core library that contains common mechanisms for cross cutting concerns such as configuration and doing HTTP requests.
@@ -40,28 +38,16 @@ The HTTP pipeline consists of a HTTP transport that is wrapped by multiple polic
40
38
41
39
##### Using azcore.Policy
42
40
43
-
TODO
44
-
45
41
#### Service Method Parameters
46
42
47
-
TODO
48
-
49
43
##### Parameter validation
50
44
51
-
TODO
52
-
53
45
### Supporting Types
54
46
55
-
TODO
56
-
57
47
#### Model Types
58
48
59
-
TODO
60
-
61
49
##### Serialization
62
50
63
-
TODO
64
-
65
51
#### Constants as Enumerations
66
52
67
53
{% include requirement/MUST id="golang-enum-type" %} define the enumeration's type to match the type sent/received over-the-wire (string is the most common example).
{% include requirement/MUST id="golang-config-global" %} use relevant global configuration settings either by default or when explicitly requested to by the user, for example by passing in a configuration object to a client constructor.
@@ -160,8 +144,4 @@ Client libraries must support robust logging mechanisms so that the consumer can
{% include requirement/MUST id="golang-api-service-client-versioning-highest-api" %} call the highest supported service API version by default.
117
+
118
+
{% include requirement/MUST id="golang-api-service-client-versioning-select-api-version" %} allow the consumer to explicitly select a supported service API version when instantiating the service client.
121
119
122
120
##### Client Immutability
123
121
@@ -409,36 +407,24 @@ process(w)
409
407
410
408
##### Conditional Request Methods
411
409
412
-
TODO
413
-
414
410
##### Hierarchical Clients
415
411
416
-
TODO
417
-
418
412
### Supporting Types
419
413
420
414
In addition to service client types, Azure SDK APIs provide and use other supporting types as well.
421
415
422
416
#### Model Types
423
417
424
-
TODO
425
-
426
418
##### Model Type Naming
427
419
428
-
TODO
429
-
430
420
#### Constants as Enumerations
431
421
432
422
{% include requirement/MUST id="golang-const" %} use a `const` for parameters, fields, and return types when values are known.
433
423
434
424
#### Azure Core Types
435
425
436
-
TODO
437
-
438
426
#### Primitive Types
439
427
440
-
TODO
441
-
442
428
### Error Handling
443
429
444
430
{% include requirement/MUST id="golang-errors" %} return an error if a method fails to perform its intended functionality. For methods that return multiple items, the error object is always the last item in the return signature.
@@ -491,8 +477,6 @@ When implementing authentication, don't open up the consumer to security holes l
491
477
492
478
### Package Naming
493
479
494
-
TODO (namespaces in other languages)
495
-
496
480
### Support for Mocking
497
481
498
482
One of the key things we want to support is to allow consumers of the package to easily write repeatable unit-tests for their applications without activating a service. This allows them to reliably and quickly test their code without worrying about the vagaries of the underlying service implementation (including, for example, network conditions or service outages). Mocking is also helpful to simulate failures, edge cases, and hard to reproduce situations (for example: does code work on February 29th).
@@ -597,7 +581,9 @@ Packages should strive to avoid taking dependencies on packages outside of the s
597
581
598
582
### Native Code
599
583
600
-
TODO
584
+
Native dependencies introduce lots of complexities and should be avoided.
585
+
586
+
{% include requirement/SHOULDNOT id="golang-problems-native-dependencies" %} use native dependencies.
601
587
602
588
### Doc Comments
603
589
@@ -617,7 +603,13 @@ As you write your code, *doc it so you never hear about it again.* The less ques
617
603
618
604
### README
619
605
620
-
TODO
606
+
{% include requirement/MUST id="golang-docs-readme" %} have a README.md file in the package root folder.
607
+
608
+
An example of a good `README.md` file can be found [here](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/security/keyvault/azkeys/README.md).
609
+
610
+
{% include requirement/MUST id="golang-docs-readme-consumer" %} optimize the `README.md` for the consumer of the client library.
611
+
612
+
The contributor guide (`CONTRIBUTING.md`) should be a separate file linked to from the main component `README.md`.
0 commit comments