Skip to content

Commit

Permalink
feat(camPolicy): add camPolicy service
Browse files Browse the repository at this point in the history
  • Loading branch information
james-zhou-inspire11 committed May 18, 2022
1 parent 123b8dd commit 6c26c84
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/camPolicy/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CloudGraph from '@cloudgraph/sdk'
import groupBy from 'lodash/groupBy'
import isEmpty from 'lodash/isEmpty'
import { StrategyInfo } from 'tencentcloud-sdk-nodejs/tencentcloud/services/cam/v20190116/cam_models'
import cuid from 'cuid'
import loggerText from '../../properties/logger'
import { TencentServiceInput } from '../../types'
import { initTestEndpoint, generateTencentErrorLog } from '../../utils'
Expand All @@ -14,7 +15,7 @@ export const serviceName = 'CamPolicy'
const apiEndpoint = initTestEndpoint(serviceName)

export interface RawTencentCamPolicy extends StrategyInfo {
id: number
id: string
region: string
}

Expand All @@ -38,7 +39,7 @@ export default async ({
if (response && !isEmpty(response.List)) {
for (const instance of response.List) {
camPolicyList.push({
id: instance.PolicyId,
id: cuid(),
...instance,
region,
})
Expand Down
2 changes: 2 additions & 0 deletions src/services/camPolicy/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default ({
}): TencentCamPolicy => {
const {
id,
PolicyId: policyId,
PolicyName: name,
AddTime: addTime,
Type: type,
Expand All @@ -28,6 +29,7 @@ export default ({

return {
id: `${id}`,
policyId,
region,
name,
addTime,
Expand Down
1 change: 1 addition & 0 deletions src/services/camPolicy/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
type tencentCamPolicy implements tencentBaseService @key(fields: "id") {
policyId: Int @search
name: String @search(by: [hash, regexp])
addTime: String @search(by: [hash, regexp])
type: Int @search
Expand Down
1 change: 1 addition & 0 deletions src/types/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type TencentCamPolicy = TencentBaseService & {
isAttached?: Maybe<Scalars['Int']>;
isServiceLinkedPolicy?: Maybe<Scalars['Int']>;
name?: Maybe<Scalars['String']>;
policyId?: Maybe<Scalars['Int']>;
serviceType?: Maybe<Scalars['String']>;
type?: Maybe<Scalars['Int']>;
updateTime?: Maybe<Scalars['String']>;
Expand Down

0 comments on commit 6c26c84

Please sign in to comment.