diff --git a/packages/cactus-plugin-ledger-connector-fabric/package.json b/packages/cactus-plugin-ledger-connector-fabric/package.json index 43e967f201..2f764ae6a5 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/package.json +++ b/packages/cactus-plugin-ledger-connector-fabric/package.json @@ -71,6 +71,7 @@ "fabric-protos": "2.5.0-snapshot.23", "fast-safe-stringify": "2.1.1", "form-data": "4.0.0", + "http-errors": "2.0.0", "http-status-codes": "2.1.4", "jsrsasign": "11.0.0", "long": "5.2.3", @@ -99,6 +100,7 @@ "@types/elliptic": "6.4.16", "@types/express": "5.0.0", "@types/fs-extra": "11.0.4", + "@types/http-errors": "2.0.4", "@types/jsrsasign": "8.0.13", "@types/multer": "1.4.7", "@types/node-vault": "0.9.13", diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES index 8712738f9e..9704074091 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES @@ -47,6 +47,14 @@ model_get_block_response_type_v1.go model_get_block_response_v1.go model_get_chain_info_request_v1.go model_get_chain_info_response_v1.go +model_get_discovery_results_request_v1.go +model_get_discovery_results_response_v1.go +model_get_discovery_results_response_v1_msps_value.go +model_get_discovery_results_response_v1_orderers_value.go +model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go +model_get_discovery_results_response_v1_peers_by_msp_value.go +model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go +model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go model_get_transaction_receipt_response.go model_run_delegated_sign_transaction_request.go model_run_transaction_request.go diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md index 9eab528d23..9441d48853 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md @@ -81,6 +81,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**DeployContractV1**](docs/DefaultApi.md#deploycontractv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract | Deploys a chaincode contract from a set of source files. Note: This endpoint only supports Fabric 2.x. The 'v1' suffix in the method name refers to the Cactus API version, not the supported Fabric ledger version. *DefaultApi* | [**GetBlockV1**](docs/DefaultApi.md#getblockv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**GetChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info. +*DefaultApi* | [**GetDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service). *DefaultApi* | [**GetPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics *DefaultApi* | [**GetTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger. *DefaultApi* | [**RunDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback. @@ -130,6 +131,14 @@ Class | Method | HTTP request | Description - [GetBlockResponseV1](docs/GetBlockResponseV1.md) - [GetChainInfoRequestV1](docs/GetChainInfoRequestV1.md) - [GetChainInfoResponseV1](docs/GetChainInfoResponseV1.md) + - [GetDiscoveryResultsRequestV1](docs/GetDiscoveryResultsRequestV1.md) + - [GetDiscoveryResultsResponseV1](docs/GetDiscoveryResultsResponseV1.md) + - [GetDiscoveryResultsResponseV1MspsValue](docs/GetDiscoveryResultsResponseV1MspsValue.md) + - [GetDiscoveryResultsResponseV1OrderersValue](docs/GetDiscoveryResultsResponseV1OrderersValue.md) + - [GetDiscoveryResultsResponseV1OrderersValueEndpointsInner](docs/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.md) + - [GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md) + - [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md) + - [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md) - [GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md) - [RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md) - [RunTransactionRequest](docs/RunTransactionRequest.md) diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml index 78ca097f17..ee10c01580 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml @@ -203,6 +203,33 @@ paths: http: verbLowerCase: post path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results: + post: + operationId: getDiscoveryResultsV1 + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetDiscoveryResultsRequestV1' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorExceptionResponseV1' + description: Internal Server Error + summary: Get fabric ledger node structure (from the discovery service). + x-hyperledger-cacti: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics: get: operationId: getPrometheusMetricsV1 @@ -1583,6 +1610,61 @@ components: - channelName - gatewayOptions type: object + GetDiscoveryResultsRequestV1: + description: Request for GetDiscoveryResults endpoint. + example: + gatewayOptions: + wallet: + keychain: + vaultTransitKey: + keyName: keyName + token: token + keychainId: keychainId + keychainRef: keychainRef + webSocketKey: + signature: signature + sessionId: sessionId + type: null + json: json + connectionProfile: + channels: + key: "" + certificateAuthorities: + key: "" + name: basic-network + organizations: + key: "" + peers: + key: "" + x-type: hlfv1 + description: The basic network + client: + organization: Org1 + orderers: + key: "" + version: "1.0" + discovery: + asLocalhost: true + enabled: true + identity: identity + eventHandlerOptions: + commitTimeout: 0.8008281904610115 + strategy: null + endorseTimeout: 6.027456183070403 + channelName: channelName + properties: + channelName: + description: Fabric channel which we want to query. + maxLength: 100 + minLength: 1 + nullable: false + type: string + gatewayOptions: + $ref: '#/components/schemas/GatewayOptions' + required: + - channelName + - gatewayOptions + type: object FabricFullBlockDataV1: description: Full hyperledger fabric block data. GetBlockResponseDecodedV1: @@ -1633,6 +1715,81 @@ components: - height - previousBlockHash type: object + GetDiscoveryResultsResponseV1: + description: Response for GetDiscoveryResults endpoint. + example: + peersByMSP: + key: + peers: + - mspid: Org1MSP + endpoint: peer0.org1.example.com:7051 + chaincodes: + - name: _lifecycle + version: "1" + - name: _lifecycle + version: "1" + name: peer0.org1.example.com:7051 + ledgerHeight: 123 + - mspid: Org1MSP + endpoint: peer0.org1.example.com:7051 + chaincodes: + - name: _lifecycle + version: "1" + - name: _lifecycle + version: "1" + name: peer0.org1.example.com:7051 + ledgerHeight: 123 + msps: + key: + tlsIntermediateCerts: tlsIntermediateCerts + name: OrdererMSP + tlsRootCerts: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + intermediateCerts: intermediateCerts + id: OrdererMSP + organizationalUnitIdentifiers: + - organizationalUnitIdentifiers + - organizationalUnitIdentifiers + rootCerts: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + admins: admins + orderers: + key: + endpoints: + - port: 7050 + host: orderer.example.com + name: orderer.example.com:7050 + - port: 7050 + host: orderer.example.com + name: orderer.example.com:7050 + timestamp: 1737125074324 + properties: + msps: + additionalProperties: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_msps_value' + description: Definitions of all MSP defined on the channel + nullable: false + type: object + orderers: + additionalProperties: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_orderers_value' + description: List of orderers defined on the channel + nullable: false + type: object + peersByMSP: + additionalProperties: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_peersByMSP_value' + description: List of peers organized by owner MSP. + nullable: false + type: object + timestamp: + example: 1737125074324 + nullable: false + type: number + required: + - msps + - orderers + - peersByMSP + - timestamp + type: object ErrorExceptionResponseV1: properties: message: @@ -2088,3 +2245,175 @@ components: nullable: false type: string type: object + GetDiscoveryResultsResponseV1_msps_value: + example: + tlsIntermediateCerts: tlsIntermediateCerts + name: OrdererMSP + tlsRootCerts: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + intermediateCerts: intermediateCerts + id: OrdererMSP + organizationalUnitIdentifiers: + - organizationalUnitIdentifiers + - organizationalUnitIdentifiers + rootCerts: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + admins: admins + properties: + id: + example: OrdererMSP + nullable: false + type: string + name: + example: OrdererMSP + nullable: false + type: string + organizationalUnitIdentifiers: + items: + type: string + nullable: false + type: array + rootCerts: + example: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + nullable: false + type: string + intermediateCerts: + nullable: false + type: string + admins: + nullable: false + type: string + tlsRootCerts: + example: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----' + nullable: false + type: string + tlsIntermediateCerts: + nullable: false + type: string + required: + - admins + - id + - intermediateCerts + - name + - organizationalUnitIdentifiers + - rootCerts + - tlsIntermediateCerts + - tlsRootCerts + type: object + GetDiscoveryResultsResponseV1_orderers_value_endpoints_inner: + example: + port: 7050 + host: orderer.example.com + name: orderer.example.com:7050 + nullable: false + properties: + host: + example: orderer.example.com + type: string + port: + example: 7050 + type: integer + name: + example: orderer.example.com:7050 + type: string + required: + - host + - name + - port + type: object + GetDiscoveryResultsResponseV1_orderers_value: + example: + endpoints: + - port: 7050 + host: orderer.example.com + name: orderer.example.com:7050 + - port: 7050 + host: orderer.example.com + name: orderer.example.com:7050 + properties: + endpoints: + items: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_orderers_value_endpoints_inner' + type: array + required: + - endpoints + type: object + GetDiscoveryResultsResponseV1_peersByMSP_value_peers_inner_chaincodes_inner: + example: + name: _lifecycle + version: "1" + nullable: false + properties: + name: + example: _lifecycle + type: string + version: + example: "1" + type: string + required: + - name + - version + type: object + GetDiscoveryResultsResponseV1_peersByMSP_value_peers_inner: + example: + mspid: Org1MSP + endpoint: peer0.org1.example.com:7051 + chaincodes: + - name: _lifecycle + version: "1" + - name: _lifecycle + version: "1" + name: peer0.org1.example.com:7051 + ledgerHeight: 123 + nullable: false + properties: + mspid: + example: Org1MSP + type: string + endpoint: + example: peer0.org1.example.com:7051 + type: string + name: + example: peer0.org1.example.com:7051 + type: string + ledgerHeight: + example: 123 + type: number + chaincodes: + items: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_peersByMSP_value_peers_inner_chaincodes_inner' + type: array + required: + - chaincodes + - endpoint + - ledgerHeight + - mspid + - name + type: object + GetDiscoveryResultsResponseV1_peersByMSP_value: + example: + peers: + - mspid: Org1MSP + endpoint: peer0.org1.example.com:7051 + chaincodes: + - name: _lifecycle + version: "1" + - name: _lifecycle + version: "1" + name: peer0.org1.example.com:7051 + ledgerHeight: 123 + - mspid: Org1MSP + endpoint: peer0.org1.example.com:7051 + chaincodes: + - name: _lifecycle + version: "1" + - name: _lifecycle + version: "1" + name: peer0.org1.example.com:7051 + ledgerHeight: 123 + properties: + peers: + items: + $ref: '#/components/schemas/GetDiscoveryResultsResponseV1_peersByMSP_value_peers_inner' + type: array + required: + - peers + type: object diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go index b972d9cec4..cccf3eebec 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go @@ -482,6 +482,121 @@ func (a *DefaultApiService) GetChainInfoV1Execute(r ApiGetChainInfoV1Request) (* return localVarReturnValue, localVarHTTPResponse, nil } +type ApiGetDiscoveryResultsV1Request struct { + ctx context.Context + ApiService *DefaultApiService + getDiscoveryResultsRequestV1 *GetDiscoveryResultsRequestV1 +} + +func (r ApiGetDiscoveryResultsV1Request) GetDiscoveryResultsRequestV1(getDiscoveryResultsRequestV1 GetDiscoveryResultsRequestV1) ApiGetDiscoveryResultsV1Request { + r.getDiscoveryResultsRequestV1 = &getDiscoveryResultsRequestV1 + return r +} + +func (r ApiGetDiscoveryResultsV1Request) Execute() (*GetDiscoveryResultsResponseV1, *http.Response, error) { + return r.ApiService.GetDiscoveryResultsV1Execute(r) +} + +/* +GetDiscoveryResultsV1 Get fabric ledger node structure (from the discovery service). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetDiscoveryResultsV1Request +*/ +func (a *DefaultApiService) GetDiscoveryResultsV1(ctx context.Context) ApiGetDiscoveryResultsV1Request { + return ApiGetDiscoveryResultsV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return GetDiscoveryResultsResponseV1 +func (a *DefaultApiService) GetDiscoveryResultsV1Execute(r ApiGetDiscoveryResultsV1Request) (*GetDiscoveryResultsResponseV1, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetDiscoveryResultsResponseV1 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetDiscoveryResultsV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.getDiscoveryResultsRequestV1 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorExceptionResponseV1 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiGetPrometheusMetricsV1Request struct { ctx context.Context ApiService *DefaultApiService diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_request_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_request_v1.go new file mode 100644 index 0000000000..8164f4fa80 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_request_v1.go @@ -0,0 +1,145 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsRequestV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsRequestV1{} + +// GetDiscoveryResultsRequestV1 Request for GetDiscoveryResults endpoint. +type GetDiscoveryResultsRequestV1 struct { + // Fabric channel which we want to query. + ChannelName string `json:"channelName"` + GatewayOptions GatewayOptions `json:"gatewayOptions"` +} + +// NewGetDiscoveryResultsRequestV1 instantiates a new GetDiscoveryResultsRequestV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsRequestV1(channelName string, gatewayOptions GatewayOptions) *GetDiscoveryResultsRequestV1 { + this := GetDiscoveryResultsRequestV1{} + this.ChannelName = channelName + this.GatewayOptions = gatewayOptions + return &this +} + +// NewGetDiscoveryResultsRequestV1WithDefaults instantiates a new GetDiscoveryResultsRequestV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsRequestV1WithDefaults() *GetDiscoveryResultsRequestV1 { + this := GetDiscoveryResultsRequestV1{} + return &this +} + +// GetChannelName returns the ChannelName field value +func (o *GetDiscoveryResultsRequestV1) GetChannelName() string { + if o == nil { + var ret string + return ret + } + + return o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsRequestV1) GetChannelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChannelName, true +} + +// SetChannelName sets field value +func (o *GetDiscoveryResultsRequestV1) SetChannelName(v string) { + o.ChannelName = v +} + +// GetGatewayOptions returns the GatewayOptions field value +func (o *GetDiscoveryResultsRequestV1) GetGatewayOptions() GatewayOptions { + if o == nil { + var ret GatewayOptions + return ret + } + + return o.GatewayOptions +} + +// GetGatewayOptionsOk returns a tuple with the GatewayOptions field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsRequestV1) GetGatewayOptionsOk() (*GatewayOptions, bool) { + if o == nil { + return nil, false + } + return &o.GatewayOptions, true +} + +// SetGatewayOptions sets field value +func (o *GetDiscoveryResultsRequestV1) SetGatewayOptions(v GatewayOptions) { + o.GatewayOptions = v +} + +func (o GetDiscoveryResultsRequestV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsRequestV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["channelName"] = o.ChannelName + toSerialize["gatewayOptions"] = o.GatewayOptions + return toSerialize, nil +} + +type NullableGetDiscoveryResultsRequestV1 struct { + value *GetDiscoveryResultsRequestV1 + isSet bool +} + +func (v NullableGetDiscoveryResultsRequestV1) Get() *GetDiscoveryResultsRequestV1 { + return v.value +} + +func (v *NullableGetDiscoveryResultsRequestV1) Set(val *GetDiscoveryResultsRequestV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsRequestV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsRequestV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsRequestV1(val *GetDiscoveryResultsRequestV1) *NullableGetDiscoveryResultsRequestV1 { + return &NullableGetDiscoveryResultsRequestV1{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsRequestV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsRequestV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1.go new file mode 100644 index 0000000000..a6c9834cfc --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1.go @@ -0,0 +1,201 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1{} + +// GetDiscoveryResultsResponseV1 Response for GetDiscoveryResults endpoint. +type GetDiscoveryResultsResponseV1 struct { + // Definitions of all MSP defined on the channel + Msps map[string]GetDiscoveryResultsResponseV1MspsValue `json:"msps"` + // List of orderers defined on the channel + Orderers map[string]GetDiscoveryResultsResponseV1OrderersValue `json:"orderers"` + // List of peers organized by owner MSP. + PeersByMSP map[string]GetDiscoveryResultsResponseV1PeersByMSPValue `json:"peersByMSP"` + Timestamp float32 `json:"timestamp"` +} + +// NewGetDiscoveryResultsResponseV1 instantiates a new GetDiscoveryResultsResponseV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1(msps map[string]GetDiscoveryResultsResponseV1MspsValue, orderers map[string]GetDiscoveryResultsResponseV1OrderersValue, peersByMSP map[string]GetDiscoveryResultsResponseV1PeersByMSPValue, timestamp float32) *GetDiscoveryResultsResponseV1 { + this := GetDiscoveryResultsResponseV1{} + this.Msps = msps + this.Orderers = orderers + this.PeersByMSP = peersByMSP + this.Timestamp = timestamp + return &this +} + +// NewGetDiscoveryResultsResponseV1WithDefaults instantiates a new GetDiscoveryResultsResponseV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1WithDefaults() *GetDiscoveryResultsResponseV1 { + this := GetDiscoveryResultsResponseV1{} + return &this +} + +// GetMsps returns the Msps field value +func (o *GetDiscoveryResultsResponseV1) GetMsps() map[string]GetDiscoveryResultsResponseV1MspsValue { + if o == nil { + var ret map[string]GetDiscoveryResultsResponseV1MspsValue + return ret + } + + return o.Msps +} + +// GetMspsOk returns a tuple with the Msps field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1) GetMspsOk() (*map[string]GetDiscoveryResultsResponseV1MspsValue, bool) { + if o == nil { + return nil, false + } + return &o.Msps, true +} + +// SetMsps sets field value +func (o *GetDiscoveryResultsResponseV1) SetMsps(v map[string]GetDiscoveryResultsResponseV1MspsValue) { + o.Msps = v +} + +// GetOrderers returns the Orderers field value +func (o *GetDiscoveryResultsResponseV1) GetOrderers() map[string]GetDiscoveryResultsResponseV1OrderersValue { + if o == nil { + var ret map[string]GetDiscoveryResultsResponseV1OrderersValue + return ret + } + + return o.Orderers +} + +// GetOrderersOk returns a tuple with the Orderers field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1) GetOrderersOk() (*map[string]GetDiscoveryResultsResponseV1OrderersValue, bool) { + if o == nil { + return nil, false + } + return &o.Orderers, true +} + +// SetOrderers sets field value +func (o *GetDiscoveryResultsResponseV1) SetOrderers(v map[string]GetDiscoveryResultsResponseV1OrderersValue) { + o.Orderers = v +} + +// GetPeersByMSP returns the PeersByMSP field value +func (o *GetDiscoveryResultsResponseV1) GetPeersByMSP() map[string]GetDiscoveryResultsResponseV1PeersByMSPValue { + if o == nil { + var ret map[string]GetDiscoveryResultsResponseV1PeersByMSPValue + return ret + } + + return o.PeersByMSP +} + +// GetPeersByMSPOk returns a tuple with the PeersByMSP field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1) GetPeersByMSPOk() (*map[string]GetDiscoveryResultsResponseV1PeersByMSPValue, bool) { + if o == nil { + return nil, false + } + return &o.PeersByMSP, true +} + +// SetPeersByMSP sets field value +func (o *GetDiscoveryResultsResponseV1) SetPeersByMSP(v map[string]GetDiscoveryResultsResponseV1PeersByMSPValue) { + o.PeersByMSP = v +} + +// GetTimestamp returns the Timestamp field value +func (o *GetDiscoveryResultsResponseV1) GetTimestamp() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1) GetTimestampOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *GetDiscoveryResultsResponseV1) SetTimestamp(v float32) { + o.Timestamp = v +} + +func (o GetDiscoveryResultsResponseV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["msps"] = o.Msps + toSerialize["orderers"] = o.Orderers + toSerialize["peersByMSP"] = o.PeersByMSP + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1 struct { + value *GetDiscoveryResultsResponseV1 + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1) Get() *GetDiscoveryResultsResponseV1 { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1) Set(val *GetDiscoveryResultsResponseV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1(val *GetDiscoveryResultsResponseV1) *NullableGetDiscoveryResultsResponseV1 { + return &NullableGetDiscoveryResultsResponseV1{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_msps_value.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_msps_value.go new file mode 100644 index 0000000000..96252c81af --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_msps_value.go @@ -0,0 +1,306 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1MspsValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1MspsValue{} + +// GetDiscoveryResultsResponseV1MspsValue struct for GetDiscoveryResultsResponseV1MspsValue +type GetDiscoveryResultsResponseV1MspsValue struct { + Id string `json:"id"` + Name string `json:"name"` + OrganizationalUnitIdentifiers []string `json:"organizationalUnitIdentifiers"` + RootCerts string `json:"rootCerts"` + IntermediateCerts string `json:"intermediateCerts"` + Admins string `json:"admins"` + TlsRootCerts string `json:"tlsRootCerts"` + TlsIntermediateCerts string `json:"tlsIntermediateCerts"` +} + +// NewGetDiscoveryResultsResponseV1MspsValue instantiates a new GetDiscoveryResultsResponseV1MspsValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1MspsValue(id string, name string, organizationalUnitIdentifiers []string, rootCerts string, intermediateCerts string, admins string, tlsRootCerts string, tlsIntermediateCerts string) *GetDiscoveryResultsResponseV1MspsValue { + this := GetDiscoveryResultsResponseV1MspsValue{} + this.Id = id + this.Name = name + this.OrganizationalUnitIdentifiers = organizationalUnitIdentifiers + this.RootCerts = rootCerts + this.IntermediateCerts = intermediateCerts + this.Admins = admins + this.TlsRootCerts = tlsRootCerts + this.TlsIntermediateCerts = tlsIntermediateCerts + return &this +} + +// NewGetDiscoveryResultsResponseV1MspsValueWithDefaults instantiates a new GetDiscoveryResultsResponseV1MspsValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1MspsValueWithDefaults() *GetDiscoveryResultsResponseV1MspsValue { + this := GetDiscoveryResultsResponseV1MspsValue{} + return &this +} + +// GetId returns the Id field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetName(v string) { + o.Name = v +} + +// GetOrganizationalUnitIdentifiers returns the OrganizationalUnitIdentifiers field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetOrganizationalUnitIdentifiers() []string { + if o == nil { + var ret []string + return ret + } + + return o.OrganizationalUnitIdentifiers +} + +// GetOrganizationalUnitIdentifiersOk returns a tuple with the OrganizationalUnitIdentifiers field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetOrganizationalUnitIdentifiersOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.OrganizationalUnitIdentifiers, true +} + +// SetOrganizationalUnitIdentifiers sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetOrganizationalUnitIdentifiers(v []string) { + o.OrganizationalUnitIdentifiers = v +} + +// GetRootCerts returns the RootCerts field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetRootCerts() string { + if o == nil { + var ret string + return ret + } + + return o.RootCerts +} + +// GetRootCertsOk returns a tuple with the RootCerts field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetRootCertsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RootCerts, true +} + +// SetRootCerts sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetRootCerts(v string) { + o.RootCerts = v +} + +// GetIntermediateCerts returns the IntermediateCerts field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetIntermediateCerts() string { + if o == nil { + var ret string + return ret + } + + return o.IntermediateCerts +} + +// GetIntermediateCertsOk returns a tuple with the IntermediateCerts field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetIntermediateCertsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.IntermediateCerts, true +} + +// SetIntermediateCerts sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetIntermediateCerts(v string) { + o.IntermediateCerts = v +} + +// GetAdmins returns the Admins field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetAdmins() string { + if o == nil { + var ret string + return ret + } + + return o.Admins +} + +// GetAdminsOk returns a tuple with the Admins field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetAdminsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Admins, true +} + +// SetAdmins sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetAdmins(v string) { + o.Admins = v +} + +// GetTlsRootCerts returns the TlsRootCerts field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetTlsRootCerts() string { + if o == nil { + var ret string + return ret + } + + return o.TlsRootCerts +} + +// GetTlsRootCertsOk returns a tuple with the TlsRootCerts field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetTlsRootCertsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TlsRootCerts, true +} + +// SetTlsRootCerts sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetTlsRootCerts(v string) { + o.TlsRootCerts = v +} + +// GetTlsIntermediateCerts returns the TlsIntermediateCerts field value +func (o *GetDiscoveryResultsResponseV1MspsValue) GetTlsIntermediateCerts() string { + if o == nil { + var ret string + return ret + } + + return o.TlsIntermediateCerts +} + +// GetTlsIntermediateCertsOk returns a tuple with the TlsIntermediateCerts field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1MspsValue) GetTlsIntermediateCertsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TlsIntermediateCerts, true +} + +// SetTlsIntermediateCerts sets field value +func (o *GetDiscoveryResultsResponseV1MspsValue) SetTlsIntermediateCerts(v string) { + o.TlsIntermediateCerts = v +} + +func (o GetDiscoveryResultsResponseV1MspsValue) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1MspsValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["organizationalUnitIdentifiers"] = o.OrganizationalUnitIdentifiers + toSerialize["rootCerts"] = o.RootCerts + toSerialize["intermediateCerts"] = o.IntermediateCerts + toSerialize["admins"] = o.Admins + toSerialize["tlsRootCerts"] = o.TlsRootCerts + toSerialize["tlsIntermediateCerts"] = o.TlsIntermediateCerts + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1MspsValue struct { + value *GetDiscoveryResultsResponseV1MspsValue + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1MspsValue) Get() *GetDiscoveryResultsResponseV1MspsValue { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1MspsValue) Set(val *GetDiscoveryResultsResponseV1MspsValue) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1MspsValue) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1MspsValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1MspsValue(val *GetDiscoveryResultsResponseV1MspsValue) *NullableGetDiscoveryResultsResponseV1MspsValue { + return &NullableGetDiscoveryResultsResponseV1MspsValue{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1MspsValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1MspsValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value.go new file mode 100644 index 0000000000..91a18760fe --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1OrderersValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1OrderersValue{} + +// GetDiscoveryResultsResponseV1OrderersValue struct for GetDiscoveryResultsResponseV1OrderersValue +type GetDiscoveryResultsResponseV1OrderersValue struct { + Endpoints []GetDiscoveryResultsResponseV1OrderersValueEndpointsInner `json:"endpoints"` +} + +// NewGetDiscoveryResultsResponseV1OrderersValue instantiates a new GetDiscoveryResultsResponseV1OrderersValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1OrderersValue(endpoints []GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) *GetDiscoveryResultsResponseV1OrderersValue { + this := GetDiscoveryResultsResponseV1OrderersValue{} + this.Endpoints = endpoints + return &this +} + +// NewGetDiscoveryResultsResponseV1OrderersValueWithDefaults instantiates a new GetDiscoveryResultsResponseV1OrderersValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1OrderersValueWithDefaults() *GetDiscoveryResultsResponseV1OrderersValue { + this := GetDiscoveryResultsResponseV1OrderersValue{} + return &this +} + +// GetEndpoints returns the Endpoints field value +func (o *GetDiscoveryResultsResponseV1OrderersValue) GetEndpoints() []GetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + if o == nil { + var ret []GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + return ret + } + + return o.Endpoints +} + +// GetEndpointsOk returns a tuple with the Endpoints field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1OrderersValue) GetEndpointsOk() ([]GetDiscoveryResultsResponseV1OrderersValueEndpointsInner, bool) { + if o == nil { + return nil, false + } + return o.Endpoints, true +} + +// SetEndpoints sets field value +func (o *GetDiscoveryResultsResponseV1OrderersValue) SetEndpoints(v []GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) { + o.Endpoints = v +} + +func (o GetDiscoveryResultsResponseV1OrderersValue) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1OrderersValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["endpoints"] = o.Endpoints + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1OrderersValue struct { + value *GetDiscoveryResultsResponseV1OrderersValue + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValue) Get() *GetDiscoveryResultsResponseV1OrderersValue { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValue) Set(val *GetDiscoveryResultsResponseV1OrderersValue) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValue) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1OrderersValue(val *GetDiscoveryResultsResponseV1OrderersValue) *NullableGetDiscoveryResultsResponseV1OrderersValue { + return &NullableGetDiscoveryResultsResponseV1OrderersValue{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go new file mode 100644 index 0000000000..2db2d7053f --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go @@ -0,0 +1,171 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1OrderersValueEndpointsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1OrderersValueEndpointsInner{} + +// GetDiscoveryResultsResponseV1OrderersValueEndpointsInner struct for GetDiscoveryResultsResponseV1OrderersValueEndpointsInner +type GetDiscoveryResultsResponseV1OrderersValueEndpointsInner struct { + Host string `json:"host"` + Port int32 `json:"port"` + Name string `json:"name"` +} + +// NewGetDiscoveryResultsResponseV1OrderersValueEndpointsInner instantiates a new GetDiscoveryResultsResponseV1OrderersValueEndpointsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1OrderersValueEndpointsInner(host string, port int32, name string) *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + this := GetDiscoveryResultsResponseV1OrderersValueEndpointsInner{} + this.Host = host + this.Port = port + this.Name = name + return &this +} + +// NewGetDiscoveryResultsResponseV1OrderersValueEndpointsInnerWithDefaults instantiates a new GetDiscoveryResultsResponseV1OrderersValueEndpointsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1OrderersValueEndpointsInnerWithDefaults() *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + this := GetDiscoveryResultsResponseV1OrderersValueEndpointsInner{} + return &this +} + +// GetHost returns the Host field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetHost() string { + if o == nil { + var ret string + return ret + } + + return o.Host +} + +// GetHostOk returns a tuple with the Host field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetHostOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Host, true +} + +// SetHost sets field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) SetHost(v string) { + o.Host = v +} + +// GetPort returns the Port field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Port +} + +// GetPortOk returns a tuple with the Port field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Port, true +} + +// SetPort sets field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) SetPort(v int32) { + o.Port = v +} + +// GetName returns the Name field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) SetName(v string) { + o.Name = v +} + +func (o GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["host"] = o.Host + toSerialize["port"] = o.Port + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner struct { + value *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) Get() *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) Set(val *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner(val *GetDiscoveryResultsResponseV1OrderersValueEndpointsInner) *NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + return &NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1OrderersValueEndpointsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value.go new file mode 100644 index 0000000000..6d926237ed --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1PeersByMSPValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1PeersByMSPValue{} + +// GetDiscoveryResultsResponseV1PeersByMSPValue struct for GetDiscoveryResultsResponseV1PeersByMSPValue +type GetDiscoveryResultsResponseV1PeersByMSPValue struct { + Peers []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner `json:"peers"` +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValue instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1PeersByMSPValue(peers []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) *GetDiscoveryResultsResponseV1PeersByMSPValue { + this := GetDiscoveryResultsResponseV1PeersByMSPValue{} + this.Peers = peers + return &this +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValueWithDefaults instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1PeersByMSPValueWithDefaults() *GetDiscoveryResultsResponseV1PeersByMSPValue { + this := GetDiscoveryResultsResponseV1PeersByMSPValue{} + return &this +} + +// GetPeers returns the Peers field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValue) GetPeers() []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + if o == nil { + var ret []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + return ret + } + + return o.Peers +} + +// GetPeersOk returns a tuple with the Peers field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValue) GetPeersOk() ([]GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner, bool) { + if o == nil { + return nil, false + } + return o.Peers, true +} + +// SetPeers sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValue) SetPeers(v []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) { + o.Peers = v +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValue) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["peers"] = o.Peers + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1PeersByMSPValue struct { + value *GetDiscoveryResultsResponseV1PeersByMSPValue + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValue) Get() *GetDiscoveryResultsResponseV1PeersByMSPValue { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValue) Set(val *GetDiscoveryResultsResponseV1PeersByMSPValue) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValue) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1PeersByMSPValue(val *GetDiscoveryResultsResponseV1PeersByMSPValue) *NullableGetDiscoveryResultsResponseV1PeersByMSPValue { + return &NullableGetDiscoveryResultsResponseV1PeersByMSPValue{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go new file mode 100644 index 0000000000..afc1da6247 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go @@ -0,0 +1,225 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner{} + +// GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner struct for GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner +type GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner struct { + Mspid string `json:"mspid"` + Endpoint string `json:"endpoint"` + Name string `json:"name"` + LedgerHeight float32 `json:"ledgerHeight"` + Chaincodes []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner `json:"chaincodes"` +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner(mspid string, endpoint string, name string, ledgerHeight float32, chaincodes []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + this := GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner{} + this.Mspid = mspid + this.Endpoint = endpoint + this.Name = name + this.LedgerHeight = ledgerHeight + this.Chaincodes = chaincodes + return &this +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerWithDefaults instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerWithDefaults() *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + this := GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner{} + return &this +} + +// GetMspid returns the Mspid field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetMspid() string { + if o == nil { + var ret string + return ret + } + + return o.Mspid +} + +// GetMspidOk returns a tuple with the Mspid field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetMspidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Mspid, true +} + +// SetMspid sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) SetMspid(v string) { + o.Mspid = v +} + +// GetEndpoint returns the Endpoint field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetEndpoint() string { + if o == nil { + var ret string + return ret + } + + return o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetEndpointOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Endpoint, true +} + +// SetEndpoint sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) SetEndpoint(v string) { + o.Endpoint = v +} + +// GetName returns the Name field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) SetName(v string) { + o.Name = v +} + +// GetLedgerHeight returns the LedgerHeight field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetLedgerHeight() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.LedgerHeight +} + +// GetLedgerHeightOk returns a tuple with the LedgerHeight field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetLedgerHeightOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.LedgerHeight, true +} + +// SetLedgerHeight sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) SetLedgerHeight(v float32) { + o.LedgerHeight = v +} + +// GetChaincodes returns the Chaincodes field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetChaincodes() []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + if o == nil { + var ret []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + return ret + } + + return o.Chaincodes +} + +// GetChaincodesOk returns a tuple with the Chaincodes field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) GetChaincodesOk() ([]GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner, bool) { + if o == nil { + return nil, false + } + return o.Chaincodes, true +} + +// SetChaincodes sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) SetChaincodes(v []GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) { + o.Chaincodes = v +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["mspid"] = o.Mspid + toSerialize["endpoint"] = o.Endpoint + toSerialize["name"] = o.Name + toSerialize["ledgerHeight"] = o.LedgerHeight + toSerialize["chaincodes"] = o.Chaincodes + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner struct { + value *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) Get() *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) Set(val *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner(val *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + return &NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go new file mode 100644 index 0000000000..5eaf89b5ae --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go @@ -0,0 +1,144 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner{} + +// GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner struct for GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner +type GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner struct { + Name string `json:"name"` + Version string `json:"version"` +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner(name string, version string) *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + this := GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner{} + this.Name = name + this.Version = version + return &this +} + +// NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInnerWithDefaults instantiates a new GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInnerWithDefaults() *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + this := GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner{} + return &this +} + +// GetName returns the Name field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) SetName(v string) { + o.Name = v +} + +// GetVersion returns the Version field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) SetVersion(v string) { + o.Version = v +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["version"] = o.Version + return toSerialize, nil +} + +type NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner struct { + value *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + isSet bool +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) Get() *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + return v.value +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) Set(val *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) { + v.value = val + v.isSet = true +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner(val *GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + return &NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner{value: val, isSet: true} +} + +func (v NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json index b27326c92b..1195b9b5c1 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json @@ -1089,6 +1089,25 @@ } } }, + "GetDiscoveryResultsRequestV1": { + "description": "Request for GetDiscoveryResults endpoint.", + "type": "object", + "required": ["channelName", "gatewayOptions"], + "properties": { + "channelName": { + "type": "string", + "description": "Fabric channel which we want to query.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "description": "Fabric SDK gateway options. Note: discovery must be enabled for this method to work!", + "nullable": false + } + } + }, "FabricFullBlockDataV1": { "description": "Full hyperledger fabric block data." }, @@ -1152,6 +1171,171 @@ } } }, + "GetDiscoveryResultsResponseV1": { + "description": "Response for GetDiscoveryResults endpoint.", + "type": "object", + "required": ["msps", "orderers", "peersByMSP", "timestamp"], + "properties": { + "msps": { + "type": "object", + "description": "Definitions of all MSP defined on the channel", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": [ + "id", + "name", + "organizationalUnitIdentifiers", + "rootCerts", + "intermediateCerts", + "admins", + "tlsRootCerts", + "tlsIntermediateCerts" + ], + "properties": { + "id": { + "type": "string", + "example": "OrdererMSP", + "nullable": false + }, + "name": { + "type": "string", + "example": "OrdererMSP", + "nullable": false + }, + "organizationalUnitIdentifiers": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": false + }, + "rootCerts": { + "type": "string", + "example": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----", + "nullable": false + }, + "intermediateCerts": { + "type": "string", + "nullable": false + }, + "admins": { + "type": "string", + "nullable": false + }, + "tlsRootCerts": { + "type": "string", + "example": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----", + "nullable": false + }, + "tlsIntermediateCerts": { + "type": "string", + "nullable": false + } + } + } + }, + "orderers": { + "type": "object", + "description": "List of orderers defined on the channel", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": ["endpoints"], + "properties": { + "endpoints": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": ["host", "port", "name"], + "properties": { + "host": { + "type": "string", + "example": "orderer.example.com" + }, + "port": { + "type": "integer", + "example": 7050 + }, + "name": { + "type": "string", + "example": "orderer.example.com:7050" + } + } + } + } + } + } + }, + "peersByMSP": { + "type": "object", + "description": "List of peers organized by owner MSP.", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": ["peers"], + "properties": { + "peers": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": [ + "mspid", + "endpoint", + "name", + "ledgerHeight", + "chaincodes" + ], + "properties": { + "mspid": { + "type": "string", + "example": "Org1MSP" + }, + "endpoint": { + "type": "string", + "example": "peer0.org1.example.com:7051" + }, + "name": { + "type": "string", + "example": "peer0.org1.example.com:7051" + }, + "ledgerHeight": { + "type": "number", + "example": 123 + }, + "chaincodes": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": ["name", "version"], + "properties": { + "name": { + "type": "string", + "example": "_lifecycle" + }, + "version": { + "type": "string", + "example": "1" + } + } + } + } + } + } + } + } + } + }, + "timestamp": { + "type": "number", + "example": 1737125074324, + "nullable": false + } + } + }, "ErrorExceptionResponseV1": { "type": "object", "required": ["message", "error"], @@ -1948,6 +2132,50 @@ } } }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results": { + "post": { + "operationId": "getDiscoveryResultsV1", + "summary": "Get fabric ledger node structure (from the discovery service).", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetDiscoveryResultsRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetDiscoveryResultsResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics": { "get": { "x-hyperledger-cacti": { diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json index b27326c92b..1195b9b5c1 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json @@ -1089,6 +1089,25 @@ } } }, + "GetDiscoveryResultsRequestV1": { + "description": "Request for GetDiscoveryResults endpoint.", + "type": "object", + "required": ["channelName", "gatewayOptions"], + "properties": { + "channelName": { + "type": "string", + "description": "Fabric channel which we want to query.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "description": "Fabric SDK gateway options. Note: discovery must be enabled for this method to work!", + "nullable": false + } + } + }, "FabricFullBlockDataV1": { "description": "Full hyperledger fabric block data." }, @@ -1152,6 +1171,171 @@ } } }, + "GetDiscoveryResultsResponseV1": { + "description": "Response for GetDiscoveryResults endpoint.", + "type": "object", + "required": ["msps", "orderers", "peersByMSP", "timestamp"], + "properties": { + "msps": { + "type": "object", + "description": "Definitions of all MSP defined on the channel", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": [ + "id", + "name", + "organizationalUnitIdentifiers", + "rootCerts", + "intermediateCerts", + "admins", + "tlsRootCerts", + "tlsIntermediateCerts" + ], + "properties": { + "id": { + "type": "string", + "example": "OrdererMSP", + "nullable": false + }, + "name": { + "type": "string", + "example": "OrdererMSP", + "nullable": false + }, + "organizationalUnitIdentifiers": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": false + }, + "rootCerts": { + "type": "string", + "example": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----", + "nullable": false + }, + "intermediateCerts": { + "type": "string", + "nullable": false + }, + "admins": { + "type": "string", + "nullable": false + }, + "tlsRootCerts": { + "type": "string", + "example": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----", + "nullable": false + }, + "tlsIntermediateCerts": { + "type": "string", + "nullable": false + } + } + } + }, + "orderers": { + "type": "object", + "description": "List of orderers defined on the channel", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": ["endpoints"], + "properties": { + "endpoints": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": ["host", "port", "name"], + "properties": { + "host": { + "type": "string", + "example": "orderer.example.com" + }, + "port": { + "type": "integer", + "example": 7050 + }, + "name": { + "type": "string", + "example": "orderer.example.com:7050" + } + } + } + } + } + } + }, + "peersByMSP": { + "type": "object", + "description": "List of peers organized by owner MSP.", + "nullable": false, + "additionalProperties": { + "type": "object", + "required": ["peers"], + "properties": { + "peers": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": [ + "mspid", + "endpoint", + "name", + "ledgerHeight", + "chaincodes" + ], + "properties": { + "mspid": { + "type": "string", + "example": "Org1MSP" + }, + "endpoint": { + "type": "string", + "example": "peer0.org1.example.com:7051" + }, + "name": { + "type": "string", + "example": "peer0.org1.example.com:7051" + }, + "ledgerHeight": { + "type": "number", + "example": 123 + }, + "chaincodes": { + "type": "array", + "items": { + "type": "object", + "nullable": false, + "required": ["name", "version"], + "properties": { + "name": { + "type": "string", + "example": "_lifecycle" + }, + "version": { + "type": "string", + "example": "1" + } + } + } + } + } + } + } + } + } + }, + "timestamp": { + "type": "number", + "example": 1737125074324, + "nullable": false + } + } + }, "ErrorExceptionResponseV1": { "type": "object", "required": ["message", "error"], @@ -1948,6 +2132,50 @@ } } }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results": { + "post": { + "operationId": "getDiscoveryResultsV1", + "summary": "Get fabric ledger node structure (from the discovery service).", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetDiscoveryResultsRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetDiscoveryResultsResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics": { "get": { "x-hyperledger-cacti": { diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index b88f5e8810..bff11eaa69 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -62,6 +62,14 @@ src/main/kotlin/org/openapitools/client/models/GetBlockResponseTypeV1.kt src/main/kotlin/org/openapitools/client/models/GetBlockResponseV1.kt src/main/kotlin/org/openapitools/client/models/GetChainInfoRequestV1.kt src/main/kotlin/org/openapitools/client/models/GetChainInfoResponseV1.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsRequestV1.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1MspsValue.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValue.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValue.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.kt +src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.kt src/main/kotlin/org/openapitools/client/models/GetTransactionReceiptResponse.kt src/main/kotlin/org/openapitools/client/models/RunDelegatedSignTransactionRequest.kt src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md index 48208f638b..f4c6cc5ef5 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -48,6 +48,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**deployContractV1**](docs/DefaultApi.md#deploycontractv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract | Deploys a chaincode contract from a set of source files. Note: This endpoint only supports Fabric 2.x. The 'v1' suffix in the method name refers to the Cactus API version, not the supported Fabric ledger version. *DefaultApi* | [**getBlockV1**](docs/DefaultApi.md#getblockv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**getChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info. +*DefaultApi* | [**getDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service). *DefaultApi* | [**getPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics *DefaultApi* | [**getTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger. *DefaultApi* | [**runDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback. @@ -98,6 +99,14 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.GetBlockResponseV1](docs/GetBlockResponseV1.md) - [org.openapitools.client.models.GetChainInfoRequestV1](docs/GetChainInfoRequestV1.md) - [org.openapitools.client.models.GetChainInfoResponseV1](docs/GetChainInfoResponseV1.md) + - [org.openapitools.client.models.GetDiscoveryResultsRequestV1](docs/GetDiscoveryResultsRequestV1.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1](docs/GetDiscoveryResultsResponseV1.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1MspsValue](docs/GetDiscoveryResultsResponseV1MspsValue.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1OrderersValue](docs/GetDiscoveryResultsResponseV1OrderersValue.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1OrderersValueEndpointsInner](docs/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md) + - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md) - [org.openapitools.client.models.GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md) - [org.openapitools.client.models.RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md) - [org.openapitools.client.models.RunTransactionRequest](docs/RunTransactionRequest.md) diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 121dac0591..7a1c1fd494 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -29,6 +29,8 @@ import org.openapitools.client.models.GetBlockRequestV1 import org.openapitools.client.models.GetBlockResponseV1 import org.openapitools.client.models.GetChainInfoRequestV1 import org.openapitools.client.models.GetChainInfoResponseV1 +import org.openapitools.client.models.GetDiscoveryResultsRequestV1 +import org.openapitools.client.models.GetDiscoveryResultsResponseV1 import org.openapitools.client.models.GetTransactionReceiptResponse import org.openapitools.client.models.RunDelegatedSignTransactionRequest import org.openapitools.client.models.RunTransactionRequest @@ -346,6 +348,78 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } + /** + * Get fabric ledger node structure (from the discovery service). + * + * @param getDiscoveryResultsRequestV1 (optional) + * @return GetDiscoveryResultsResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getDiscoveryResultsV1(getDiscoveryResultsRequestV1: GetDiscoveryResultsRequestV1? = null) : GetDiscoveryResultsResponseV1 { + val localVarResponse = getDiscoveryResultsV1WithHttpInfo(getDiscoveryResultsRequestV1 = getDiscoveryResultsRequestV1) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as GetDiscoveryResultsResponseV1 + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * Get fabric ledger node structure (from the discovery service). + * + * @param getDiscoveryResultsRequestV1 (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getDiscoveryResultsV1WithHttpInfo(getDiscoveryResultsRequestV1: GetDiscoveryResultsRequestV1?) : ApiResponse { + val localVariableConfig = getDiscoveryResultsV1RequestConfig(getDiscoveryResultsRequestV1 = getDiscoveryResultsRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getDiscoveryResultsV1 + * + * @param getDiscoveryResultsRequestV1 (optional) + * @return RequestConfig + */ + fun getDiscoveryResultsV1RequestConfig(getDiscoveryResultsRequestV1: GetDiscoveryResultsRequestV1?) : RequestConfig { + val localVariableBody = getDiscoveryResultsRequestV1 + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + /** * Get the Prometheus Metrics * diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsRequestV1.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsRequestV1.kt new file mode 100644 index 0000000000..c9f5b312d4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsRequestV1.kt @@ -0,0 +1,41 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GatewayOptions + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Request for GetDiscoveryResults endpoint. + * + * @param channelName Fabric channel which we want to query. + * @param gatewayOptions + */ + + +data class GetDiscoveryResultsRequestV1 ( + + /* Fabric channel which we want to query. */ + @Json(name = "channelName") + val channelName: kotlin.String, + + @Json(name = "gatewayOptions") + val gatewayOptions: GatewayOptions + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1.kt new file mode 100644 index 0000000000..f8e882436d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1.kt @@ -0,0 +1,53 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GetDiscoveryResultsResponseV1MspsValue +import org.openapitools.client.models.GetDiscoveryResultsResponseV1OrderersValue +import org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValue + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Response for GetDiscoveryResults endpoint. + * + * @param msps Definitions of all MSP defined on the channel + * @param orderers List of orderers defined on the channel + * @param peersByMSP List of peers organized by owner MSP. + * @param timestamp + */ + + +data class GetDiscoveryResultsResponseV1 ( + + /* Definitions of all MSP defined on the channel */ + @Json(name = "msps") + val msps: kotlin.collections.Map, + + /* List of orderers defined on the channel */ + @Json(name = "orderers") + val orderers: kotlin.collections.Map, + + /* List of peers organized by owner MSP. */ + @Json(name = "peersByMSP") + val peersByMSP: kotlin.collections.Map, + + @Json(name = "timestamp") + val timestamp: java.math.BigDecimal + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1MspsValue.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1MspsValue.kt new file mode 100644 index 0000000000..1eac36abb9 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1MspsValue.kt @@ -0,0 +1,63 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param id + * @param name + * @param organizationalUnitIdentifiers + * @param rootCerts + * @param intermediateCerts + * @param admins + * @param tlsRootCerts + * @param tlsIntermediateCerts + */ + + +data class GetDiscoveryResultsResponseV1MspsValue ( + + @Json(name = "id") + val id: kotlin.String, + + @Json(name = "name") + val name: kotlin.String, + + @Json(name = "organizationalUnitIdentifiers") + val organizationalUnitIdentifiers: kotlin.collections.List, + + @Json(name = "rootCerts") + val rootCerts: kotlin.String, + + @Json(name = "intermediateCerts") + val intermediateCerts: kotlin.String, + + @Json(name = "admins") + val admins: kotlin.String, + + @Json(name = "tlsRootCerts") + val tlsRootCerts: kotlin.String, + + @Json(name = "tlsIntermediateCerts") + val tlsIntermediateCerts: kotlin.String + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValue.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValue.kt new file mode 100644 index 0000000000..90f934ee6f --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValue.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param endpoints + */ + + +data class GetDiscoveryResultsResponseV1OrderersValue ( + + @Json(name = "endpoints") + val endpoints: kotlin.collections.List + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.kt new file mode 100644 index 0000000000..1213eb5a29 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1OrderersValueEndpointsInner.kt @@ -0,0 +1,43 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param host + * @param port + * @param name + */ + + +data class GetDiscoveryResultsResponseV1OrderersValueEndpointsInner ( + + @Json(name = "host") + val host: kotlin.String, + + @Json(name = "port") + val port: kotlin.Int, + + @Json(name = "name") + val name: kotlin.String + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValue.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValue.kt new file mode 100644 index 0000000000..f296492607 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValue.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param peers + */ + + +data class GetDiscoveryResultsResponseV1PeersByMSPValue ( + + @Json(name = "peers") + val peers: kotlin.collections.List + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.kt new file mode 100644 index 0000000000..d84a7191fe --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param mspid + * @param endpoint + * @param name + * @param ledgerHeight + * @param chaincodes + */ + + +data class GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner ( + + @Json(name = "mspid") + val mspid: kotlin.String, + + @Json(name = "endpoint") + val endpoint: kotlin.String, + + @Json(name = "name") + val name: kotlin.String, + + @Json(name = "ledgerHeight") + val ledgerHeight: java.math.BigDecimal, + + @Json(name = "chaincodes") + val chaincodes: kotlin.collections.List + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.kt new file mode 100644 index 0000000000..58270c2020 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param name + * @param version + */ + + +data class GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner ( + + @Json(name = "name") + val name: kotlin.String, + + @Json(name = "version") + val version: kotlin.String + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts index 4dbaabd1dd..e991ea5a08 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -1199,6 +1199,218 @@ export interface GetChainInfoResponseV1 { */ 'previousBlockHash': string; } +/** + * Request for GetDiscoveryResults endpoint. + * @export + * @interface GetDiscoveryResultsRequestV1 + */ +export interface GetDiscoveryResultsRequestV1 { + /** + * Fabric channel which we want to query. + * @type {string} + * @memberof GetDiscoveryResultsRequestV1 + */ + 'channelName': string; + /** + * + * @type {GatewayOptions} + * @memberof GetDiscoveryResultsRequestV1 + */ + 'gatewayOptions': GatewayOptions; +} +/** + * Response for GetDiscoveryResults endpoint. + * @export + * @interface GetDiscoveryResultsResponseV1 + */ +export interface GetDiscoveryResultsResponseV1 { + /** + * Definitions of all MSP defined on the channel + * @type {{ [key: string]: GetDiscoveryResultsResponseV1MspsValue; }} + * @memberof GetDiscoveryResultsResponseV1 + */ + 'msps': { [key: string]: GetDiscoveryResultsResponseV1MspsValue; }; + /** + * List of orderers defined on the channel + * @type {{ [key: string]: GetDiscoveryResultsResponseV1OrderersValue; }} + * @memberof GetDiscoveryResultsResponseV1 + */ + 'orderers': { [key: string]: GetDiscoveryResultsResponseV1OrderersValue; }; + /** + * List of peers organized by owner MSP. + * @type {{ [key: string]: GetDiscoveryResultsResponseV1PeersByMSPValue; }} + * @memberof GetDiscoveryResultsResponseV1 + */ + 'peersByMSP': { [key: string]: GetDiscoveryResultsResponseV1PeersByMSPValue; }; + /** + * + * @type {number} + * @memberof GetDiscoveryResultsResponseV1 + */ + 'timestamp': number; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1MspsValue + */ +export interface GetDiscoveryResultsResponseV1MspsValue { + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'id': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'name': string; + /** + * + * @type {Array} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'organizationalUnitIdentifiers': Array; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'rootCerts': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'intermediateCerts': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'admins': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'tlsRootCerts': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1MspsValue + */ + 'tlsIntermediateCerts': string; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1OrderersValue + */ +export interface GetDiscoveryResultsResponseV1OrderersValue { + /** + * + * @type {Array} + * @memberof GetDiscoveryResultsResponseV1OrderersValue + */ + 'endpoints': Array; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + */ +export interface GetDiscoveryResultsResponseV1OrderersValueEndpointsInner { + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + */ + 'host': string; + /** + * + * @type {number} + * @memberof GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + */ + 'port': number; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1OrderersValueEndpointsInner + */ + 'name': string; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1PeersByMSPValue + */ +export interface GetDiscoveryResultsResponseV1PeersByMSPValue { + /** + * + * @type {Array} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValue + */ + 'peers': Array; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ +export interface GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner { + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ + 'mspid': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ + 'endpoint': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ + 'name': string; + /** + * + * @type {number} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ + 'ledgerHeight': number; + /** + * + * @type {Array} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner + */ + 'chaincodes': Array; +} +/** + * + * @export + * @interface GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + */ +export interface GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner { + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + */ + 'name': string; + /** + * + * @type {string} + * @memberof GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner + */ + 'version': string; +} /** * * @export @@ -1914,6 +2126,40 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary Get fabric ledger node structure (from the discovery service). + * @param {GetDiscoveryResultsRequestV1} [getDiscoveryResultsRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDiscoveryResultsV1: async (getDiscoveryResultsRequestV1?: GetDiscoveryResultsRequestV1, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(getDiscoveryResultsRequestV1, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Get the Prometheus Metrics @@ -2106,6 +2352,17 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getChainInfoV1(getChainInfoRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary Get fabric ledger node structure (from the discovery service). + * @param {GetDiscoveryResultsRequestV1} [getDiscoveryResultsRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getDiscoveryResultsV1(getDiscoveryResultsRequestV1?: GetDiscoveryResultsRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Get the Prometheus Metrics @@ -2199,6 +2456,16 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa getChainInfoV1(getChainInfoRequestV1?: GetChainInfoRequestV1, options?: any): AxiosPromise { return localVarFp.getChainInfoV1(getChainInfoRequestV1, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Get fabric ledger node structure (from the discovery service). + * @param {GetDiscoveryResultsRequestV1} [getDiscoveryResultsRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDiscoveryResultsV1(getDiscoveryResultsRequestV1?: GetDiscoveryResultsRequestV1, options?: any): AxiosPromise { + return localVarFp.getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options).then((request) => request(axios, basePath)); + }, /** * * @summary Get the Prometheus Metrics @@ -2296,6 +2563,18 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).getChainInfoV1(getChainInfoRequestV1, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Get fabric ledger node structure (from the discovery service). + * @param {GetDiscoveryResultsRequestV1} [getDiscoveryResultsRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getDiscoveryResultsV1(getDiscoveryResultsRequestV1?: GetDiscoveryResultsRequestV1, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Get the Prometheus Metrics diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-discovery-results/get-discovery-results-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-discovery-results/get-discovery-results-endpoint-v1.ts new file mode 100644 index 0000000000..6ea048565e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-discovery-results/get-discovery-results-endpoint-v1.ts @@ -0,0 +1,99 @@ +import { Express, Request, Response } from "express"; + +import { + Logger, + LoggerProvider, + LogLevelDesc, + Checks, + IAsyncProvider, +} from "@hyperledger/cactus-common"; + +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + handleRestEndpointException, + registerWebServiceEndpoint, +} from "@hyperledger/cactus-core"; + +import { PluginLedgerConnectorFabric } from "../plugin-ledger-connector-fabric"; +import OAS from "../../json/openapi.json"; + +export interface IGetDiscoveryResultsEndpointV1Options { + logLevel?: LogLevelDesc; + connector: PluginLedgerConnectorFabric; +} + +export class GetDiscoveryResultsEndpointV1 implements IWebServiceEndpoint { + private readonly log: Logger; + + constructor(public readonly opts: IGetDiscoveryResultsEndpointV1Options) { + const fnTag = "GetDiscoveryResultsEndpointV1#constructor()"; + + Checks.truthy(opts, `${fnTag} options`); + Checks.truthy(opts.connector, `${fnTag} options.connector`); + + this.log = LoggerProvider.getOrCreate({ + label: "get-discovery-results-endpoint-v1", + level: opts.logLevel || "INFO", + }); + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + // TODO: make this an injectable dependency in the constructor + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public getOasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results" + ]; + } + + public getPath(): string { + const apiPath = this.getOasPath(); + return apiPath.post["x-hyperledger-cacti"].http.path; + } + + public getVerbLowerCase(): string { + const apiPath = this.getOasPath(); + return apiPath.post["x-hyperledger-cacti"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.getOasPath().post.operationId; + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "GetDiscoveryResultsEndpointV1#handleRequest()"; + this.log.debug(`POST ${this.getPath()}`); + + try { + res + .status(200) + .send(await this.opts.connector.getDiscoveryResults(req.body)); + } catch (error) { + const errorMsg = `Crash while serving ${fnTag}`; + handleRestEndpointException({ errorMsg, log: this.log, error, res }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts index 89a0fa9e44..47d3bb82f3 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts @@ -3,6 +3,7 @@ import path from "path"; import { v4 as uuidv4 } from "uuid"; import { Certificate } from "@fidm/x509"; import { Express } from "express"; +import createHttpError from "http-errors"; import { RuntimeError } from "run-time-error-cjs"; import "multer"; import temp from "temp"; @@ -107,6 +108,8 @@ import { GetBlockResponseV1, GetChainInfoRequestV1, GetChainInfoResponseV1, + GetDiscoveryResultsRequestV1, + GetDiscoveryResultsResponseV1, } from "./generated/openapi/typescript-axios/index"; import { @@ -150,6 +153,7 @@ import { import { GetBlockEndpointV1 } from "./get-block/get-block-endpoint-v1"; import { GetChainInfoEndpointV1 } from "./get-chain-info/get-chain-info-endpoint-v1"; +import { GetDiscoveryResultsEndpointV1 } from "./get-discovery-results/get-discovery-results-endpoint-v1"; import { querySystemChainCode } from "./common/query-system-chain-code"; import { isSshExecOk } from "./common/is-ssh-exec-ok"; import { @@ -900,6 +904,14 @@ export class PluginLedgerConnectorFabric endpoints.push(endpoint); } + { + const endpoint = new GetDiscoveryResultsEndpointV1({ + connector: this, + logLevel: this.opts.logLevel, + }); + endpoints.push(endpoint); + } + { const opts: IGetPrometheusExporterMetricsEndpointV1Options = { connector: this, @@ -1658,10 +1670,10 @@ export class PluginLedgerConnectorFabric } /** - * Get fabric block from a channel, using one of selectors. + * Get fabric chain info from the system chaincode (qscc.GetChainInfo()) * * @param req input parameters - * @returns Entire block object or encoded buffer (if req.skipDecode is true) + * @returns {height, currentBlockHash, previousBlockHash} */ public async getChainInfo( req: GetChainInfoRequestV1, @@ -1937,4 +1949,61 @@ export class PluginLedgerConnectorFabric } } } + + /** + * Use fabric discovery service to find all the nodes that are part of specified channel. + * + * @param req request specification + * @returns fabric discovery request results + */ + public async getDiscoveryResults( + req: GetDiscoveryResultsRequestV1, + ): Promise { + // Validate input parameters + if (!req.channelName) { + throw createHttpError[400]("req.channelName must be provided"); + } + if (!req.gatewayOptions) { + throw createHttpError[400]("req.gatewayOptions must be provided"); + } + if (!(req.gatewayOptions.discovery?.enabled ?? true)) { + throw createHttpError[400]( + "req.gatewayOptions discovery must be enabled", + ); + } + + const gateway = await this.createGatewayWithOptions(req.gatewayOptions); + + // We use `discoveryService` member of `Network`, which isn't private according to the sources (as of 2025), + // but is not listed in exported TS types for some reason. + // Since it's public in the sources, and because this API is deprecated anyways, + // I don't think we're at risk of this being changed anyway, so I use it + // to prevent unnecessary code duplication (which would be more risky in the end). + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const looseNetwork: any = await gateway.getNetwork(req.channelName); + const discoveryResultsResponse = + await looseNetwork.discoveryService.getDiscoveryResults(true); + + // Rename the response fields + const discoveryResults = { + msps: discoveryResultsResponse.msps, + orderers: discoveryResultsResponse.orderers, + peersByMSP: discoveryResultsResponse.peers_by_org, + timestamp: discoveryResultsResponse.timestamp, + }; + + // Convert peer.ledgerHeight from Long to number + Object.keys(discoveryResults.peersByMSP).forEach((peerOrg) => { + discoveryResults.peersByMSP[peerOrg].peers = discoveryResults.peersByMSP[ + peerOrg + ].peers.map((peer: any) => { + return { + ...peer, + ledgerHeight: fabricLongToNumber(peer.ledgerHeight), + }; + }); + }); + + return discoveryResults; + } } diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts index e7e2649e2f..cf689ed5cf 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts @@ -58,6 +58,12 @@ import { import { sendTransactionOnFabric } from "../../common/send-transaction-on-fabric"; import { getBlock } from "../../common/get-block"; +// For development on local fabric network +// 1. leaveLedgerRunning = true, useRunningLedger = false to run ledger and leave it running after test finishes. +// 2. leaveLedgerRunning = true, useRunningLedger = true to use that ledger in future runs. +const useRunningLedger = false; +const leaveLedgerRunning = false; + describe("PluginLedgerConnectorFabric", () => { const logLevel: LogLevelDesc = "INFO"; const log: Logger = LoggerProvider.getOrCreate({ @@ -85,6 +91,7 @@ describe("PluginLedgerConnectorFabric", () => { imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION, envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]), logLevel, + useRunningLedger, }); await ledger.start({ omitPull: false }); @@ -94,7 +101,12 @@ describe("PluginLedgerConnectorFabric", () => { const enrollAdminOut = await ledger.enrollAdmin(); const adminWallet = enrollAdminOut[1]; - const [userIdentity] = await ledger.enrollUser(adminWallet); + + const [userIdentity] = await ledger.enrollUserV2({ + enrollmentID: uuidv4(), + organization: "org1", + wallet: adminWallet, + }); const sshConfig = await ledger.getSshConfig(); const keychainInstanceId = uuidv4(); @@ -167,8 +179,12 @@ describe("PluginLedgerConnectorFabric", () => { }); afterAll(async () => { - await ledger.stop(); - await ledger.destroy(); + if (ledger && !leaveLedgerRunning) { + log.info("Stop the fabric ledger..."); + await ledger.stop(); + await ledger.destroy(); + } + await pruneDockerAllIfGithubAction({ logLevel }); await Servers.shutdown(server); }); @@ -467,6 +483,7 @@ describe("PluginLedgerConnectorFabric", () => { const channelId = "mychannel"; const channelName = channelId; const contractName = "asset-transfer-private-data"; + const deployedContractName = `${contractName}-${(Math.random() + 1).toString(36).substring(7)}`; const contractRelPath = "../../fixtures/go/asset-transfer-private-data/chaincode-go"; @@ -529,14 +546,14 @@ describe("PluginLedgerConnectorFabric", () => { privateDataCollections, ], collectionsConfigFile: privateDataCollectionName, - ccName: contractName, + ccName: deployedContractName, targetOrganizations: [ FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, ], caFile: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, - ccLabel: contractName, + ccLabel: deployedContractName, ccLang: ChainCodeProgrammingLanguage.Golang, ccSequence: 1, orderer: "orderer.example.com:7050", @@ -600,7 +617,7 @@ describe("PluginLedgerConnectorFabric", () => { // CreateAsset(id string, color string, size int, owner string, appraisedValue int) const createRes = await apiClient.runTransactionV1({ transientData: rawTmpData, - contractName, + contractName: deployedContractName, channelName, //objectType, assetID, color, size, appraisedvalue params: [], @@ -614,7 +631,7 @@ describe("PluginLedgerConnectorFabric", () => { expect(createRes).toBeTruthy(); expect(createRes.status).toBeWithin(199, 300); const getRes = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [assetId], methodName: "ReadAsset", @@ -635,7 +652,7 @@ describe("PluginLedgerConnectorFabric", () => { /* const collectionToParse = "Org1MSPPrivateCollection"; const getResPrivate = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [collectionToParse, assetId], methodName: "ReadAssetPrivateDetails", @@ -650,7 +667,7 @@ describe("PluginLedgerConnectorFabric", () => { */ const getResQuery = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [assetId, assetId + "1"], methodName: "GetAssetByRange", @@ -670,8 +687,8 @@ describe("PluginLedgerConnectorFabric", () => { it("deployContractV1() - deploys contract and performs transactions", async () => { const channelId = "mychannel"; const channelName = channelId; - const contractName = "basic-asset-transfer-2"; - + const contractName = "basic-asset-transfer"; + const deployedContractName = `${contractName}-${(Math.random() + 1).toString(36).substring(7)}`; const contractRelPath = "../../fixtures/go/lock-asset/chaincode-typescript"; const contractDir = path.join(__dirname, contractRelPath); @@ -742,7 +759,7 @@ describe("PluginLedgerConnectorFabric", () => { channelId, ccVersion: "1.0.0", sourceFiles, - ccName: contractName, + ccName: deployedContractName, targetOrganizations: [ FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, @@ -787,7 +804,7 @@ describe("PluginLedgerConnectorFabric", () => { const assetId = uuidv4(); const createRes = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [assetId, "19"], methodName: "CreateAsset", @@ -802,7 +819,7 @@ describe("PluginLedgerConnectorFabric", () => { expect(createRes.status).toBeLessThan(300); const getRes = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [assetId], methodName: "ReadAsset", @@ -825,7 +842,7 @@ describe("PluginLedgerConnectorFabric", () => { expect(asset.ID).toBe(assetId); const lockRes = await apiClient.runTransactionV1({ - contractName, + contractName: deployedContractName, channelName, params: [assetId], methodName: "LockAsset", @@ -844,4 +861,103 @@ describe("PluginLedgerConnectorFabric", () => { log.warn(lockRes.data.functionOutput); }); + + it("getDiscoveryResults() - request fails when invalid input is provided", async () => { + // When channel name is empty + await expect( + apiClient.getDiscoveryResultsV1({ + channelName: "", + gatewayOptions, + }), + ).rejects.toMatchObject({ + message: "Request failed with status code " + StatusCodes.BAD_REQUEST, + name: "AxiosError", + code: "ERR_BAD_REQUEST", + response: { + status: StatusCodes.BAD_REQUEST, + statusText: "Bad Request", + }, + }); + + // When gateway is not provided + await expect( + apiClient.getDiscoveryResultsV1({ + channelName: "mychannel", + gatewayOptions: undefined as any, + }), + ).rejects.toMatchObject({ + message: "Request failed with status code " + StatusCodes.BAD_REQUEST, + name: "AxiosError", + code: "ERR_BAD_REQUEST", + response: { + status: StatusCodes.BAD_REQUEST, + statusText: "Bad Request", + }, + }); + + // When discovery is explicitly disabled in the gateway options + await expect( + apiClient.getDiscoveryResultsV1({ + channelName: "mychannel", + gatewayOptions: { + ...gatewayOptions, + discovery: { + enabled: false, + }, + }, + }), + ).rejects.toMatchObject({ + message: "Request failed with status code " + StatusCodes.BAD_REQUEST, + name: "AxiosError", + code: "ERR_BAD_REQUEST", + response: { + status: StatusCodes.BAD_REQUEST, + statusText: "Bad Request", + }, + }); + }); + + it("getDiscoveryResults() - Get test ledger structure.", async () => { + const discoveryResultsResponse = await apiClient.getDiscoveryResultsV1({ + channelName: "mychannel", + gatewayOptions, + }); + const discoveryResults = discoveryResultsResponse.data; + log.debug("discoveryResults:", JSON.stringify(discoveryResults)); + expect(discoveryResults).toBeTruthy(); + + // Check MSPs + expect(Object.keys(discoveryResults.msps).length).toBeGreaterThan(0); + for (const msp of Object.values(discoveryResults.msps)) { + expect(msp.id).toBeTruthy(); + expect(msp.name).toBeTruthy(); + expect(msp.rootCerts).toBeTruthy(); + } + + // Check Orderers + expect(Object.keys(discoveryResults.orderers).length).toBeGreaterThan(0); + for (const orderer of Object.values(discoveryResults.orderers)) { + expect(orderer.endpoints).toBeDefined(); + expect(orderer.endpoints.length).toBeGreaterThan(0); + for (const endpoint of orderer.endpoints) { + expect(endpoint.host).toBeTruthy(); + expect(endpoint.port).toBeGreaterThan(0); + expect(endpoint.name).toBeTruthy(); + } + } + + // Check Peers + expect(Object.keys(discoveryResults.peersByMSP).length).toBeGreaterThan(0); + for (const peerMsp of Object.values(discoveryResults.peersByMSP)) { + expect(peerMsp.peers).toBeDefined(); + expect(peerMsp.peers.length).toBeGreaterThan(0); + for (const peer of peerMsp.peers) { + expect(peer.mspid).toBeTruthy(); + expect(peer.endpoint).toBeTruthy(); + expect(peer.name).toBeTruthy(); + expect(peer.ledgerHeight).toBeGreaterThan(0); + expect(peer.chaincodes.length).toBeGreaterThan(0); // all should at least have _lifcecycle chaincode + } + } + }); }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/delegate-signing-methods.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/delegate-signing-methods.test.ts index 3b995767f2..74011fa08b 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/delegate-signing-methods.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/delegate-signing-methods.test.ts @@ -13,7 +13,7 @@ const assetTradeContractName = "copyAssetTrade"; const privateAssetTradeContractName = "privateAssetTrade"; const testTimeout = 1000 * 60 * 10; // 10 minutes per test -// For development on local sawtooth network +// For development on local fabric network // 1. leaveLedgerRunning = true, useRunningLedger = false to run ledger and leave it running after test finishes. // 2. leaveLedgerRunning = true, useRunningLedger = true to use that ledger in future runs. const useRunningLedger = false; diff --git a/yarn.lock b/yarn.lock index 13c2c0684d..7bbf437b2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10574,6 +10574,7 @@ __metadata: "@types/elliptic": "npm:6.4.16" "@types/express": "npm:5.0.0" "@types/fs-extra": "npm:11.0.4" + "@types/http-errors": "npm:2.0.4" "@types/jsrsasign": "npm:8.0.13" "@types/multer": "npm:1.4.7" "@types/node-vault": "npm:0.9.13" @@ -10593,6 +10594,7 @@ __metadata: fast-safe-stringify: "npm:2.1.1" form-data: "npm:4.0.0" fs-extra: "npm:11.2.0" + http-errors: "npm:2.0.0" http-status-codes: "npm:2.1.4" internal-ip: "npm:6.2.0" jsrsasign: "npm:11.0.0"