@stack-spot/portal-network 0.143.4 → 0.145.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ import
17
17
  getCertificate,
18
18
  getFolder,
19
19
  getFoundation,
20
+ getNetwork,
20
21
  getProject,
21
22
  getVpnConfiguration,
22
23
  listCertificates,
@@ -32,10 +33,10 @@ import
32
33
  } from '../api/cloudPlatform'
33
34
  import apis from '../apis.json'
34
35
  import { DefaultAPIError } from '../error/DefaultAPIError'
35
- import { cntDictionary } from '../error/dictionary/cnt'
36
36
  import { StackspotAPIError } from '../error/StackspotAPIError'
37
37
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
38
38
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
39
+ import { scfDictionary } from '../error/dictionary/cloud-platform'
39
40
 
40
41
  class CloudPlatformClient extends ReactQueryNetworkClient {
41
42
  constructor() {
@@ -43,7 +44,7 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
43
44
  }
44
45
 
45
46
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
46
- return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
47
+ return new DefaultAPIError(error.data, error.status, scfDictionary, error.headers)
47
48
  }
48
49
  /**
49
50
  * List foundations
@@ -153,6 +154,10 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
153
154
  * Create a vpn
154
155
  */
155
156
  createVpn = this.mutation(removeAuthorizationParam(createVpn))
157
+ /**
158
+ * Get a network details
159
+ */
160
+ getNetworkById = this.query(removeAuthorizationParam(getNetwork))
156
161
  }
157
162
 
158
163
  export const cloudPlatformClient = new CloudPlatformClient()
@@ -75,7 +75,6 @@ function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionar
75
75
  const name = dict[detail.code] || detail.field || codeTranslatedMessage || detail.details || ''
76
76
  return `${name}${getValues(detail)}`
77
77
  })?.filter(d => !!d)
78
-
79
78
  return { description: details ? `${title}\n${details?.join('\n')}` : title, ...dictionaryDetails }
80
79
  }
81
80
 
@@ -0,0 +1,12 @@
1
+ import { Dictionary } from '@stack-spot/portal-translate'
2
+
3
+ export const scfDictionary = {
4
+ en: {
5
+ SCF_CIDR_CREATION_ERROR: 'Error creating CIDR.',
6
+ SCF_CIDR_RANGE_CONFLICT: 'The specified CIDR conflicts with an existing CIDR. {1}',
7
+ },
8
+ pt: {
9
+ SCF_CIDR_CREATION_ERROR: 'Erro ao criar CIDR.',
10
+ SCF_CIDR_RANGE_CONFLICT: 'O CIDR especificado conflita com um CIDR já existente: {1}.',
11
+ },
12
+ } satisfies Dictionary