|
1 | | -import { TagData } from './../tag/interface'; |
2 | 1 | import { RegionType } from './../interface'; |
3 | 2 | import { CreateCfsParams } from './utils'; |
4 | 3 | import { CapiCredentials, ApiServiceType } from '../interface'; |
@@ -102,22 +101,20 @@ export default class CFS { |
102 | 101 | outputs.fileSystemId = FileSystemId; |
103 | 102 | } |
104 | 103 |
|
105 | | - if (inputs.tags) { |
106 | | - try { |
107 | | - const tags = await this.tagClient.deployResourceTags({ |
108 | | - tags: inputs.tags.map((item) => ({ TagKey: item.key, TagValue: item.value })), |
109 | | - serviceType: ApiServiceType.cfs, |
110 | | - resourcePrefix: 'filesystem', |
111 | | - resourceId: outputs.fileSystemId!, |
112 | | - }); |
113 | | - |
114 | | - outputs.tags = tags.map((item: TagData) => ({ |
115 | | - key: item.TagKey, |
116 | | - value: item.TagValue, |
117 | | - })); |
118 | | - } catch (e) { |
119 | | - console.log(`Deploy cfs tags error: ${e.message}`); |
| 104 | + try { |
| 105 | + const { tags = [] } = inputs; |
| 106 | + await this.tagClient.deployResourceTags({ |
| 107 | + tags: tags.map((item) => ({ TagKey: item.key, TagValue: item.value })), |
| 108 | + serviceType: ApiServiceType.cfs, |
| 109 | + resourcePrefix: 'filesystem', |
| 110 | + resourceId: outputs.fileSystemId!, |
| 111 | + }); |
| 112 | + |
| 113 | + if (tags.length > 0) { |
| 114 | + outputs.tags = tags; |
120 | 115 | } |
| 116 | + } catch (e) { |
| 117 | + console.log(`[TAG] ${e.message}`); |
121 | 118 | } |
122 | 119 |
|
123 | 120 | return outputs; |
|
0 commit comments