01 /*
02 * SPDX-License-Identifier: Apache-2.0
03 *
04 * Copyright 2019-2022 Andres Almiray.
05 *
06 * Licensed under the Apache License, Version 2.0 (the "License");
07 * you may not use this file except in compliance with the License.
08 * You may obtain a copy of the License at
09 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.kordamp.gradle.plugin.oci.tasks.printers
19
20 import com.oracle.bmc.database.model.AutonomousDatabase
21 import com.oracle.bmc.database.model.AutonomousDatabaseSummary
22 import groovy.transform.CompileStatic
23 import org.kordamp.gradle.plugin.oci.tasks.interfaces.ValuePrinter
24
25 /**
26 * @author Andres Almiray
27 * @since 0.5.0
28 */
29 @CompileStatic
30 class AutonomousDatabasePrinter {
31 static void printAutonomousDatabase(ValuePrinter printer, AutonomousDatabase database, int offset) {
32 printer.printKeyValue('ID', database.id, offset + 1)
33 printer.printKeyValue('Compartment ID', database.compartmentId, offset + 1)
34 printer.printKeyValue('Display Name', database.displayName, offset + 1)
35 printer.printKeyValue('Lifecycle State', printer.state(database.lifecycleState.name()), offset + 1)
36 printer.printKeyValue('Time Created', database.timeCreated, offset + 1)
37 printer.printKeyValue('Time Maintenance Begin', database.timeMaintenanceBegin, offset + 1)
38 printer.printKeyValue('Time Maintenance End', database.timeMaintenanceEnd, offset + 1)
39 printer.printKeyValue('Time Last Failover', database.timeOfLastFailover, offset + 1)
40 printer.printKeyValue('Time Last Switchover', database.timeOfLastSwitchover, offset + 1)
41 printer.printKeyValue('Db Name', database.dbName, offset + 1)
42 printer.printKeyValue('Db Version', database.dbVersion, offset + 1)
43 printer.printKeyValue('Db Workload', database.dbWorkload, offset + 1)
44 printer.printKeyValue('CPU Core Count', database.cpuCoreCount, offset + 1)
45 printer.printKeyValue('Preview', database.isPreview, offset + 1)
46 printer.printKeyValue('Free Tier', database.isFreeTier, offset + 1)
47 printer.printKeyValue('Dedicated', database.isDedicated, offset + 1)
48 printer.printKeyValue('Auto Scaling Enabled', database.isAutoScalingEnabled, offset + 1)
49 printer.printKeyValue('Data Guard Enabled', database.isDataGuardEnabled, offset + 1)
50 printer.printKeyValue('Whitelisted IPS', database.whitelistedIps, offset + 1)
51 printer.printKeyValue('Service Console URL', database.serviceConsoleUrl, offset + 1)
52 }
53
54 static void printAutonomousDatabase(ValuePrinter printer, AutonomousDatabaseSummary database, int offset) {
55 printer.printKeyValue('ID', database.id, offset + 1)
56 printer.printKeyValue('Compartment ID', database.compartmentId, offset + 1)
57 printer.printKeyValue('Display Name', database.displayName, offset + 1)
58 printer.printKeyValue('Lifecycle State', printer.state(database.lifecycleState.name()), offset + 1)
59 printer.printKeyValue('Time Created', database.timeCreated, offset + 1)
60 printer.printKeyValue('Time Maintenance Begin', database.timeMaintenanceBegin, offset + 1)
61 printer.printKeyValue('Time Maintenance End', database.timeMaintenanceEnd, offset + 1)
62 printer.printKeyValue('Time Last Failover', database.timeOfLastFailover, offset + 1)
63 printer.printKeyValue('Time Last Switchover', database.timeOfLastSwitchover, offset + 1)
64 printer.printKeyValue('Db Name', database.dbName, offset + 1)
65 printer.printKeyValue('Db Version', database.dbVersion, offset + 1)
66 printer.printKeyValue('Db Workload', database.dbWorkload, offset + 1)
67 printer.printKeyValue('CPU Core Count', database.cpuCoreCount, offset + 1)
68 printer.printKeyValue('Preview', database.isPreview, offset + 1)
69 printer.printKeyValue('Free Tier', database.isFreeTier, offset + 1)
70 printer.printKeyValue('Dedicated', database.isDedicated, offset + 1)
71 printer.printKeyValue('Auto Scaling Enabled', database.isAutoScalingEnabled, offset + 1)
72 printer.printKeyValue('Data Guard Enabled', database.isDataGuardEnabled, offset + 1)
73 printer.printKeyValue('Whitelisted IPS', database.whitelistedIps, offset + 1)
74 printer.printKeyValue('Service Console URL', database.serviceConsoleUrl, offset + 1)
75 }
76 }
|