Skip to content

Commit

Permalink
[FAB-3622] Update API with JSON tag for 'CAName'
Browse files Browse the repository at this point in the history
See [FAB-3622]

A new field had been introduced to the Fabric-CA APIs called
'CAName' to support multiple CAs running in a single Fabric-CA
server. A JSON tag has now been added for this field, and all
SDKs must take this into account in their REST calls.

Swagger doc also update to reflect the new field

Change-Id: If2e45b1a03bf0304c673d90c9b58cceb73f87199
Signed-off-by: Saad Karim <[email protected]>
  • Loading branch information
Saad Karim committed May 5, 2017
1 parent 4f86663 commit 2fa6143
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 9 deletions.
12 changes: 6 additions & 6 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type RegistrationRequest struct {
// Attributes associated with this identity
Attributes []Attribute `json:"attrs,omitempty"`
// CAName is the name of the CA to connect to
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// RegistrationResponse is a registration response
Expand All @@ -69,7 +69,7 @@ type EnrollmentRequest struct {
// CSR is Certificate Signing Request info
CSR *CSRInfo `json:"csr,omitempty" help:"Certificate Signing Request info"`
// CAName is the name of the CA to connect to
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// ReenrollmentRequest is a request to reenroll an identity.
Expand All @@ -84,7 +84,7 @@ type ReenrollmentRequest struct {
// CSR is Certificate Signing Request info
CSR *CSRInfo `json:"csr,omitempty"`
// CAName is the name of the CA to connect to
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// RevocationRequest is a revocation request for a single certificate or all certificates
Expand All @@ -106,7 +106,7 @@ type RevocationRequest struct {
// valid values. The default value is 0 (ocsp.Unspecified).
Reason string `json:"reason,omitempty" help:"Reason for revocation"`
// CAName is the name of the CA to connect to
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// GetTCertBatchRequest is input provided to identity.GetTCertBatch
Expand All @@ -129,7 +129,7 @@ type GetTCertBatchRequest struct {
// HSM which does not support the TCert's key derivation function.
DisableKeyDerivation bool `json:"disable_kdf,omitempty"`
// CAName is the name of the CA to connect to
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// GetTCertBatchResponse is the return value of identity.GetTCertBatch
Expand All @@ -139,7 +139,7 @@ type GetTCertBatchResponse struct {

// GetCAInfoRequest is request to get generic CA information
type GetCAInfoRequest struct {
CAName string `skip:"true"`
CAName string `json:"caname,omitempty" skip:"true"`
}

// CSRInfo is Certificate Signing Request information
Expand Down
61 changes: 58 additions & 3 deletions swagger/swagger-fabric-ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,32 @@
}
],
"paths": {
"/info": {
"/cainfo": {
"get": {
"tags": [
"fabric-ca-server"
],
"description": "Get server information.",
"description": "Get CA information.",
"parameters": [
{
"name": "body",
"in": "body",
"description": "The request body",
"required": true,
"schema": {
"type": "object",
"properties": {
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
},
},
}
}
],
"responses": {
"200": {
"description": "Successfully retrieved server information",
Expand Down Expand Up @@ -151,6 +171,13 @@
"null"
],
"description": "The label used in HSM operations"
},
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
}
},
"required": [
Expand Down Expand Up @@ -273,6 +300,13 @@
"null"
],
"description": "The label used in HSM operations"
},
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
}
},
"required": [
Expand Down Expand Up @@ -417,6 +451,13 @@
"value"
]
}
},
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
}
},
"required": [
Expand Down Expand Up @@ -553,8 +594,15 @@
"null"
],
"description": "The reason for revocation. \nSee https://godoc.org/golang.org/x/crypto/ocsp for valid values. \nThe default value is 0 (ocsp.Unspecified)."
},
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
}
}
},
}
}
],
Expand Down Expand Up @@ -667,6 +715,13 @@
"validity_period": {
"type": "integer",
"description": "The number of nanoseconds each transaction certificate will be valid before expiration."
},
"caname": {
"type": [
"string",
"null"
],
"description": "Name of the CA to direct traffic to within server."
}
},
"required": [
Expand Down

0 comments on commit 2fa6143

Please sign in to comment.