├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── documentation.yml │ ├── release.yml │ ├── test-snap-can-build.yml │ ├── test_pypi_release.yml │ └── tests.yml ├── .gitignore ├── .mailmap ├── .pre-commit-config.yaml ├── .readthedocs.yml ├── .secrets.baseline ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── ISSUE_TEMPLATE ├── LICENSE ├── MANIFEST.in ├── README-internal.md ├── README-snapcraft.md ├── README.rst ├── RELEASE.md ├── SECURITY.md ├── SoftLayer ├── API.py ├── CLI │ ├── __init__.py │ ├── account │ │ ├── __init__.py │ │ ├── billing_items.py │ │ ├── cancel_item.py │ │ ├── event_detail.py │ │ ├── events.py │ │ ├── hook_create.py │ │ ├── hook_delete.py │ │ ├── hooks.py │ │ ├── invoice_detail.py │ │ ├── invoices.py │ │ ├── item_detail.py │ │ ├── licenses.py │ │ ├── orders.py │ │ └── summary.py │ ├── bandwidth │ │ ├── __init__.py │ │ ├── pools.py │ │ ├── pools_create.py │ │ ├── pools_delete.py │ │ ├── pools_detail.py │ │ ├── pools_edit.py │ │ └── summary.py │ ├── block │ │ ├── __init__.py │ │ ├── access │ │ │ ├── __init__.py │ │ │ ├── authorize.py │ │ │ ├── list.py │ │ │ ├── password.py │ │ │ └── revoke.py │ │ ├── cancel.py │ │ ├── convert.py │ │ ├── count.py │ │ ├── detail.py │ │ ├── duplicate.py │ │ ├── duplicate_convert_status.py │ │ ├── limit.py │ │ ├── list.py │ │ ├── lun.py │ │ ├── modify.py │ │ ├── object_list.py │ │ ├── object_storage_detail.py │ │ ├── object_storage_permission.py │ │ ├── options.py │ │ ├── order.py │ │ ├── refresh.py │ │ ├── replication │ │ │ ├── __init__.py │ │ │ ├── disaster_recovery_failover.py │ │ │ ├── failback.py │ │ │ ├── failover.py │ │ │ ├── locations.py │ │ │ ├── order.py │ │ │ └── partners.py │ │ ├── set_note.py │ │ ├── snapshot │ │ │ ├── __init__.py │ │ │ ├── cancel.py │ │ │ ├── create.py │ │ │ ├── delete.py │ │ │ ├── disable.py │ │ │ ├── enable.py │ │ │ ├── get_notify_status.py │ │ │ ├── list.py │ │ │ ├── order.py │ │ │ ├── restore.py │ │ │ ├── schedule_list.py │ │ │ └── set_notify_status.py │ │ └── subnets │ │ │ ├── __init__.py │ │ │ ├── assign.py │ │ │ ├── list.py │ │ │ └── remove.py │ ├── call_api.py │ ├── cdn │ │ ├── __init__.py │ │ └── cdn.py │ ├── columns.py │ ├── command.py │ ├── config │ │ ├── __init__.py │ │ ├── setup.py │ │ └── show.py │ ├── core.py │ ├── custom_types.py │ ├── dedicatedhost │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── cancel_guests.py │ │ ├── create.py │ │ ├── create_options.py │ │ ├── detail.py │ │ ├── list.py │ │ └── list_guests.py │ ├── dns │ │ ├── __init__.py │ │ ├── record_add.py │ │ ├── record_edit.py │ │ ├── record_list.py │ │ ├── record_remove.py │ │ ├── zone_create.py │ │ ├── zone_delete.py │ │ ├── zone_import.py │ │ ├── zone_list.py │ │ └── zone_print.py │ ├── email │ │ ├── __init__.py │ │ ├── detail.py │ │ ├── edit.py │ │ └── list.py │ ├── environment.py │ ├── event_log │ │ ├── __init__.py │ │ ├── get.py │ │ └── types.py │ ├── exceptions.py │ ├── file │ │ ├── __init__.py │ │ ├── access │ │ │ ├── __init__.py │ │ │ ├── authorize.py │ │ │ ├── list.py │ │ │ └── revoke.py │ │ ├── cancel.py │ │ ├── convert.py │ │ ├── count.py │ │ ├── detail.py │ │ ├── duplicate.py │ │ ├── duplicate_convert_status.py │ │ ├── limit.py │ │ ├── list.py │ │ ├── modify.py │ │ ├── options.py │ │ ├── order.py │ │ ├── refresh.py │ │ ├── replication │ │ │ ├── __init__.py │ │ │ ├── disaster_recovery_failover.py │ │ │ ├── failback.py │ │ │ ├── failover.py │ │ │ ├── locations.py │ │ │ ├── order.py │ │ │ └── partners.py │ │ ├── set_note.py │ │ └── snapshot │ │ │ ├── __init__.py │ │ │ ├── cancel.py │ │ │ ├── create.py │ │ │ ├── delete.py │ │ │ ├── disable.py │ │ │ ├── enable.py │ │ │ ├── get_notify_status.py │ │ │ ├── list.py │ │ │ ├── order.py │ │ │ ├── restore.py │ │ │ ├── schedule_list.py │ │ │ └── set_notify_status.py │ ├── firewall │ │ ├── __init__.py │ │ ├── add.py │ │ ├── cancel.py │ │ ├── detail.py │ │ ├── edit.py │ │ ├── list.py │ │ └── monitoring.py │ ├── formatting.py │ ├── globalip │ │ ├── __init__.py │ │ ├── assign.py │ │ ├── cancel.py │ │ ├── create.py │ │ ├── list.py │ │ └── unassign.py │ ├── hardware │ │ ├── __init__.py │ │ ├── authorize_storage.py │ │ ├── bandwidth.py │ │ ├── billing.py │ │ ├── cancel.py │ │ ├── cancel_reasons.py │ │ ├── create.py │ │ ├── create_credential.py │ │ ├── create_options.py │ │ ├── credentials.py │ │ ├── detail.py │ │ ├── dns.py │ │ ├── edit.py │ │ ├── list.py │ │ ├── monitoring.py │ │ ├── notification_add.py │ │ ├── notification_delete.py │ │ ├── notifications.py │ │ ├── power.py │ │ ├── ready.py │ │ ├── reflash_firmware.py │ │ ├── reload.py │ │ ├── sensor.py │ │ ├── storage.py │ │ ├── toggle_ipmi.py │ │ ├── update_firmware.py │ │ ├── upgrade.py │ │ ├── vlan_add.py │ │ ├── vlan_remove.py │ │ └── vlan_trunkable.py │ ├── helpers.py │ ├── image │ │ ├── __init__.py │ │ ├── datacenter.py │ │ ├── delete.py │ │ ├── detail.py │ │ ├── edit.py │ │ ├── export.py │ │ ├── import.py │ │ ├── list.py │ │ ├── share.py │ │ └── share_deny.py │ ├── licenses │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── create.py │ │ └── create_options.py │ ├── loadbal │ │ ├── __init__.py │ │ ├── detail.py │ │ ├── health.py │ │ ├── layer7_policy_list.py │ │ ├── list.py │ │ ├── members.py │ │ ├── ns_detail.py │ │ ├── ns_list.py │ │ ├── order.py │ │ ├── pools.py │ │ ├── protocol_add.py │ │ ├── protocol_delete.py │ │ └── protocol_edit.py │ ├── login.py │ ├── metadata.py │ ├── nas │ │ ├── __init__.py │ │ ├── credentials.py │ │ └── list.py │ ├── object_storage │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── credential │ │ │ ├── __init__.py │ │ │ ├── create.py │ │ │ ├── delete.py │ │ │ ├── limit.py │ │ │ └── list.py │ │ ├── list_accounts.py │ │ └── list_endpoints.py │ ├── order │ │ ├── __init__.py │ │ ├── cancelation.py │ │ ├── category_list.py │ │ ├── item_list.py │ │ ├── lookup.py │ │ ├── package_list.py │ │ ├── package_locations.py │ │ ├── place.py │ │ ├── place_quote.py │ │ ├── preset_list.py │ │ ├── quote.py │ │ ├── quote_delete.py │ │ ├── quote_detail.py │ │ ├── quote_list.py │ │ └── quote_save.py │ ├── report │ │ ├── __init__.py │ │ └── dc_closures.py │ ├── routes.py │ ├── search.py │ ├── security │ │ ├── __init__.py │ │ ├── cert_add.py │ │ ├── cert_download.py │ │ ├── cert_edit.py │ │ ├── cert_list.py │ │ ├── cert_remove.py │ │ ├── sshkey_add.py │ │ ├── sshkey_edit.py │ │ ├── sshkey_list.py │ │ ├── sshkey_print.py │ │ └── sshkey_remove.py │ ├── securitygroup │ │ ├── __init__.py │ │ ├── create.py │ │ ├── delete.py │ │ ├── detail.py │ │ ├── edit.py │ │ ├── event_log.py │ │ ├── interface.py │ │ ├── list.py │ │ └── rule.py │ ├── sshkey │ │ └── __init__.py │ ├── ssl │ │ └── __init__.py │ ├── storage_utils.py │ ├── subnet │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── clear_route.py │ │ ├── create.py │ │ ├── detail.py │ │ ├── edit.py │ │ ├── edit_ip.py │ │ ├── list.py │ │ ├── lookup.py │ │ └── route.py │ ├── summary.py │ ├── tags │ │ ├── __init__.py │ │ ├── cleanup.py │ │ ├── delete.py │ │ ├── details.py │ │ ├── list.py │ │ ├── set.py │ │ └── taggable.py │ ├── template.py │ ├── ticket │ │ ├── __init__.py │ │ ├── attach.py │ │ ├── create.py │ │ ├── detach.py │ │ ├── detail.py │ │ ├── list.py │ │ ├── subjects.py │ │ ├── summary.py │ │ ├── update.py │ │ └── upload.py │ ├── user │ │ ├── __init__.py │ │ ├── apikey.py │ │ ├── create.py │ │ ├── delete.py │ │ ├── detail.py │ │ ├── device_access.py │ │ ├── edit_details.py │ │ ├── edit_notifications.py │ │ ├── edit_permissions.py │ │ ├── grant_access.py │ │ ├── list.py │ │ ├── notifications.py │ │ ├── permissions.py │ │ ├── remove_access.py │ │ ├── vpn_enable_or_disable.py │ │ ├── vpn_manual.py │ │ ├── vpn_password.py │ │ └── vpn_subnet.py │ ├── virt │ │ ├── __init__.py │ │ ├── access.py │ │ ├── authorize_storage.py │ │ ├── bandwidth.py │ │ ├── billing.py │ │ ├── cancel.py │ │ ├── capacity │ │ │ ├── __init__.py │ │ │ ├── create.py │ │ │ ├── create_guest.py │ │ │ ├── create_options.py │ │ │ ├── detail.py │ │ │ └── list.py │ │ ├── capture.py │ │ ├── create.py │ │ ├── create_options.py │ │ ├── credentials.py │ │ ├── detail.py │ │ ├── dns.py │ │ ├── edit.py │ │ ├── list.py │ │ ├── migrate.py │ │ ├── monitoring.py │ │ ├── notification_add.py │ │ ├── notification_delete.py │ │ ├── notifications.py │ │ ├── os_available.py │ │ ├── placementgroup │ │ │ ├── __init__.py │ │ │ ├── create.py │ │ │ ├── create_options.py │ │ │ ├── delete.py │ │ │ ├── detail.py │ │ │ └── list.py │ │ ├── power.py │ │ ├── ready.py │ │ ├── reload.py │ │ ├── storage.py │ │ ├── upgrade.py │ │ └── usage.py │ ├── vlan │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── create.py │ │ ├── create_options.py │ │ ├── detail.py │ │ ├── edit.py │ │ └── list.py │ └── vpn │ │ ├── __init__.py │ │ └── ipsec │ │ ├── __init__.py │ │ ├── cancel.py │ │ ├── configure.py │ │ ├── detail.py │ │ ├── list.py │ │ ├── order.py │ │ ├── subnet │ │ ├── __init__.py │ │ ├── add.py │ │ └── remove.py │ │ ├── translation │ │ ├── __init__.py │ │ ├── add.py │ │ ├── remove.py │ │ └── update.py │ │ └── update.py ├── __init__.py ├── auth.py ├── config.py ├── consts.py ├── decoration.py ├── exceptions.py ├── fixtures │ ├── BluePages_Search.py │ ├── SoftLayer_Account.py │ ├── SoftLayer_Billing_Invoice.py │ ├── SoftLayer_Billing_Invoice_Item.py │ ├── SoftLayer_Billing_Item.py │ ├── SoftLayer_Billing_Item_Cancellation_Request.py │ ├── SoftLayer_Billing_Order.py │ ├── SoftLayer_Billing_Order_Quote.py │ ├── SoftLayer_Dns_Domain.py │ ├── SoftLayer_Dns_Domain_ResourceRecord.py │ ├── SoftLayer_Email_Subscription.py │ ├── SoftLayer_Event_Log.py │ ├── SoftLayer_Hardware.py │ ├── SoftLayer_Hardware_Server.py │ ├── SoftLayer_Location.py │ ├── SoftLayer_Location_Datacenter.py │ ├── SoftLayer_Location_Group.py │ ├── SoftLayer_Metric_Tracking_Object.py │ ├── SoftLayer_Network_Application_Delivery_Controller.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Health_Check_Type.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Routing_Method.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Routing_Type.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Service.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Service_Group.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_VirtualIpAddress.py │ ├── SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_VirtualServer.py │ ├── SoftLayer_Network_Bandwidth_Version1_Allotment.py │ ├── SoftLayer_Network_CdnMarketplace_Configuration_Cache_Purge.py │ ├── SoftLayer_Network_CdnMarketplace_Configuration_Mapping.py │ ├── SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path.py │ ├── SoftLayer_Network_CdnMarketplace_Metrics.py │ ├── SoftLayer_Network_Component.py │ ├── SoftLayer_Network_Component_Firewall.py │ ├── SoftLayer_Network_Firewall_Update_Request.py │ ├── SoftLayer_Network_LBaaS_HealthMonitor.py │ ├── SoftLayer_Network_LBaaS_L7Pool.py │ ├── SoftLayer_Network_LBaaS_Listener.py │ ├── SoftLayer_Network_LBaaS_LoadBalancer.py │ ├── SoftLayer_Network_LBaaS_Member.py │ ├── SoftLayer_Network_Message_Delivery_Email_Sendgrid.py │ ├── SoftLayer_Network_Pod.py │ ├── SoftLayer_Network_SecurityGroup.py │ ├── SoftLayer_Network_Service_Vpn_Overrides.py │ ├── SoftLayer_Network_Storage.py │ ├── SoftLayer_Network_Storage_Allowed_Host.py │ ├── SoftLayer_Network_Storage_Hub_Cleversafe_Account.py │ ├── SoftLayer_Network_Storage_Iscsi.py │ ├── SoftLayer_Network_Subnet.py │ ├── SoftLayer_Network_Subnet_IpAddress.py │ ├── SoftLayer_Network_Subnet_IpAddress_Global.py │ ├── SoftLayer_Network_Subnet_Rwhois_Data.py │ ├── SoftLayer_Network_Vlan.py │ ├── SoftLayer_Network_Vlan_Firewall.py │ ├── SoftLayer_Notification_Occurrence_Event.py │ ├── SoftLayer_Product_Order.py │ ├── SoftLayer_Product_Package.py │ ├── SoftLayer_Product_Package_Preset.py │ ├── SoftLayer_Provisioning_Hook.py │ ├── SoftLayer_Provisioning_Maintenance_Window.py │ ├── SoftLayer_Resource_Metadata.py │ ├── SoftLayer_Scale_Group.py │ ├── SoftLayer_Scale_Policy.py │ ├── SoftLayer_Search.py │ ├── SoftLayer_Security_Certificate.py │ ├── SoftLayer_Security_Ssh_Key.py │ ├── SoftLayer_Software_AccountLicense.py │ ├── SoftLayer_Software_Component_Password.py │ ├── SoftLayer_Tag.py │ ├── SoftLayer_Ticket.py │ ├── SoftLayer_Ticket_Subject.py │ ├── SoftLayer_User_Customer.py │ ├── SoftLayer_User_Customer_CustomerPermission_Permission.py │ ├── SoftLayer_User_Customer_Notification_Hardware.py │ ├── SoftLayer_User_Customer_Notification_Virtual_Guest.py │ ├── SoftLayer_User_Permission_Action.py │ ├── SoftLayer_User_Permission_Department.py │ ├── SoftLayer_Virtual_DedicatedHost.py │ ├── SoftLayer_Virtual_Guest.py │ ├── SoftLayer_Virtual_Guest_Block_Device_Template_Group.py │ ├── SoftLayer_Virtual_Host.py │ ├── SoftLayer_Virtual_PlacementGroup.py │ ├── SoftLayer_Virtual_PlacementGroup_Rule.py │ ├── SoftLayer_Virtual_ReservedCapacityGroup.py │ ├── __init__.py │ ├── empty.conf │ ├── full.conf │ ├── id_rsa.pub │ ├── no_options.conf │ ├── realtest.com │ ├── sample_vs_template.conf │ ├── soap │ │ ├── SoftLayer_Account_getObject.soap │ │ ├── SoftLayer_Account_getVirtualGuests.soap │ │ ├── SoftLayer_Virtual_Guest_getObject.soap │ │ ├── test_objectFilter.soap │ │ └── test_objectMask.soap │ └── xmlrpc │ │ ├── Employee_getObject.xml │ │ ├── expiredToken.xml │ │ ├── invalidLogin.xml │ │ ├── refreshFailure.xml │ │ ├── refreshSuccess.xml │ │ └── successLogin.xml ├── managers │ ├── __init__.py │ ├── account.py │ ├── bandwidth.py │ ├── block.py │ ├── dedicated_host.py │ ├── dns.py │ ├── email.py │ ├── event_log.py │ ├── file.py │ ├── firewall.py │ ├── hardware.py │ ├── image.py │ ├── ipsec.py │ ├── license.py │ ├── load_balancer.py │ ├── metadata.py │ ├── network.py │ ├── object_storage.py │ ├── ordering.py │ ├── search.py │ ├── sshkey.py │ ├── ssl.py │ ├── storage.py │ ├── storage_utils.py │ ├── tags.py │ ├── ticket.py │ ├── user.py │ ├── vs.py │ ├── vs_capacity.py │ └── vs_placement.py ├── shell │ ├── __init__.py │ ├── cmd_env.py │ ├── cmd_exit.py │ ├── cmd_help.py │ ├── completer.py │ ├── core.py │ └── routes.py ├── testing │ ├── __init__.py │ └── xmlrpc.py ├── transports │ ├── __init__.py │ ├── debug.py │ ├── fixture.py │ ├── rest.py │ ├── soap.py.unstable │ ├── timing.py │ ├── transport.py │ └── xmlrpc.py └── utils.py ├── checker.py ├── checker_README.md ├── docCheck.py ├── docs ├── Makefile ├── _templates │ └── manager_template.rst ├── api │ ├── client.rst │ └── managers │ │ ├── SoftLayer.managers.AccountManager.rst │ │ ├── SoftLayer.managers.BandwidthManager.rst │ │ ├── SoftLayer.managers.BlockStorageManager.rst │ │ ├── SoftLayer.managers.CDNManager.rst │ │ ├── SoftLayer.managers.CapacityManager.rst │ │ ├── SoftLayer.managers.DNSManager.rst │ │ ├── SoftLayer.managers.DedicatedHostManager.rst │ │ ├── SoftLayer.managers.EventLogManager.rst │ │ ├── SoftLayer.managers.FileStorageManager.rst │ │ ├── SoftLayer.managers.FirewallManager.rst │ │ ├── SoftLayer.managers.HardwareManager.rst │ │ ├── SoftLayer.managers.IPSECManager.rst │ │ ├── SoftLayer.managers.ImageManager.rst │ │ ├── SoftLayer.managers.LicensesManager.rst │ │ ├── SoftLayer.managers.LoadBalancerManager.rst │ │ ├── SoftLayer.managers.MetadataManager.rst │ │ ├── SoftLayer.managers.NetworkManager.rst │ │ ├── SoftLayer.managers.ObjectStorageManager.rst │ │ ├── SoftLayer.managers.OrderingManager.rst │ │ ├── SoftLayer.managers.PlacementManager.rst │ │ ├── SoftLayer.managers.SSLManager.rst │ │ ├── SoftLayer.managers.SearchManager.rst │ │ ├── SoftLayer.managers.SshKeyManager.rst │ │ ├── SoftLayer.managers.TagManager.rst │ │ ├── SoftLayer.managers.TicketManager.rst │ │ ├── SoftLayer.managers.UserManager.rst │ │ └── SoftLayer.managers.VSManager.rst ├── cli.rst ├── cli │ ├── account.rst │ ├── bandwidth.rst │ ├── block.rst │ ├── cdn.rst │ ├── commands.rst │ ├── config.rst │ ├── dedicated.rst │ ├── dns.rst │ ├── email.rst │ ├── event_log.rst │ ├── file.rst │ ├── firewall.rst │ ├── global_ip.rst │ ├── hardware.rst │ ├── image.rst │ ├── ipsec.rst │ ├── licenses.rst │ ├── loadbal.rst │ ├── nas.rst │ ├── object_storage.rst │ ├── ordering.rst │ ├── reports.rst │ ├── security.rst │ ├── security_groups.rst │ ├── subnet.rst │ ├── tags.rst │ ├── tickets.rst │ ├── users.rst │ ├── vlan.rst │ ├── vs.rst │ └── vs │ │ ├── placement_group.rst │ │ └── reserved_capacity.rst ├── cli_directory.rst ├── conf.py ├── config_file.rst ├── dev │ ├── SoftLayer-Python.drawio │ ├── cla-corporate.md │ ├── cla-individual.md │ ├── cli.rst │ ├── example_module.rst │ └── index.rst ├── images │ └── SoftLayer-Python.png ├── index.rst ├── install.rst └── requirements.txt ├── fabfile.py ├── output.txt ├── pkg └── softlayer-python.spec ├── setup.cfg ├── setup.py ├── slcli ├── snap ├── local │ └── slcli.png └── snapcraft.yaml ├── tests ├── CLI │ ├── __init__.py │ ├── core_tests.py │ ├── custom_types_tests.py │ ├── environment_tests.py │ ├── formatting_table_tests.py │ ├── helper_tests.py │ └── modules │ │ ├── __init__.py │ │ ├── account_tests.py │ │ ├── bandwidth_tests.py │ │ ├── block_tests.py │ │ ├── call_api_tests.py │ │ ├── config_tests.py │ │ ├── dedicatedhost_tests.py │ │ ├── dns_tests.py │ │ ├── email_tests.py │ │ ├── event_log_tests.py │ │ ├── file_tests.py │ │ ├── firewall_tests.py │ │ ├── globalip_tests.py │ │ ├── hardware │ │ ├── hardware_basic_tests.py │ │ ├── hardware_firmware_tests.py │ │ ├── hardware_list_tests.py │ │ └── hardware_vlan_tests.py │ │ ├── image_tests.py │ │ ├── ipsec_tests.py │ │ ├── licenses_test.py │ │ ├── loadbal_tests.py │ │ ├── nas_tests.py │ │ ├── object_storage_tests.py │ │ ├── order_tests.py │ │ ├── report_tests.py │ │ ├── search_tests.py │ │ ├── security_tests.py │ │ ├── securitygroup_tests.py │ │ ├── sshkey_tests.py │ │ ├── ssl_tests.py │ │ ├── subnet_tests.py │ │ ├── summary_tests.py │ │ ├── tag_tests.py │ │ ├── ticket_tests.py │ │ ├── user_tests.py │ │ ├── vlan_tests.py │ │ └── vs │ │ ├── __init__.py │ │ ├── vs_capacity_tests.py │ │ ├── vs_create_tests.py │ │ ├── vs_placement_tests.py │ │ └── vs_tests.py ├── __init__.py ├── api_tests.py ├── auth_tests.py ├── basic_tests.py ├── config_tests.py ├── conftest.py ├── decoration_tests.py ├── functional_tests.py ├── managers │ ├── __init__.py │ ├── account_tests.py │ ├── bandwidth_tests.py │ ├── block_tests.py │ ├── dedicated_host_tests.py │ ├── dns_tests.py │ ├── email_tests.py │ ├── event_log_tests.py │ ├── file_tests.py │ ├── firewall_tests.py │ ├── hardware_tests.py │ ├── image_tests.py │ ├── ipsec_tests.py │ ├── loadbal_tests.py │ ├── metadata_tests.py │ ├── network_tests.py │ ├── object_storage_tests.py │ ├── ordering_tests.py │ ├── search_tests.py │ ├── sshkey_tests.py │ ├── ssl_tests.py │ ├── storage_generic_tests.py │ ├── storage_utils_tests.py │ ├── tag_tests.py │ ├── ticket_tests.py │ ├── user_tests.py │ └── vs │ │ ├── __init__.py │ │ ├── vs_capacity_tests.py │ │ ├── vs_order_tests.py │ │ ├── vs_placement_tests.py │ │ ├── vs_tests.py │ │ └── vs_waiting_for_ready_tests.py ├── resources │ └── attachment_upload ├── transports │ ├── __init__.py │ ├── debug_tests.py │ ├── rest_tests.py │ ├── soap_tests.py.unstable │ ├── transport_tests.py │ └── xmlrpc_tests.py └── utils_tests.py ├── tools ├── requirements.txt └── test-requirements.txt └── tox.ini /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | *.* text eol=lf 4 | 5 | # Language aware diff headers 6 | # https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more 7 | # https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81 8 | *.css diff=css 9 | *.html diff=html 10 | *.py diff=python 11 | *.md diff=markdown 12 | 13 | 14 | # Declare files that will always have CRLF line endings on checkout. 15 | *.sln text eol=crlf 16 | 17 | # Denote all files that are truly binary and should not be modified. 18 | *.png binary 19 | *.jpg binary 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: Bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | > Reminder: No username or APIkeys should be added to these issues, as they are public. 11 | 12 | 13 | **Describe the bug** 14 | A clear and concise description of what the bug is. Include the command you used, make sure to include the `-v` flag, as that information is very helpful. Ex: `slcli -v vs list` 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Version** 23 | Include the output of `slcli --version` 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: New Feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | > REMINDER: Never add usernames or apikeys in these issues, as they are public. 11 | 12 | **What are you trying to do?** 13 | A brief explanation of what you are trying to do. Could be something simple like `slcli vs list` doesn't support a filter you need. Or more complex like recreating some functionality that exists in the cloud.ibm.com portal 14 | 15 | **Screen shots** 16 | If the functionality you want exists in the portal, please add a screenshot so we have a better idea of what you need. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Use `allow` to specify which dependencies to maintain 2 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-update 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: "pip" 7 | directory: "/" 8 | schedule: 9 | interval: "weekly" 10 | commit-message: 11 | prefix: "pip prod" 12 | prefix-development: "pip dev" 13 | include: "scope" -------------------------------------------------------------------------------- /.github/workflows/documentation.yml: -------------------------------------------------------------------------------- 1 | name: documentation 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | python-version: [3.11] 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up Python ${{ matrix.python-version }} 18 | uses: actions/setup-python@v4 19 | with: 20 | python-version: ${{ matrix.python-version }} 21 | - name: Install dependencies 22 | run: | 23 | python -m pip install --upgrade pip 24 | pip install -r tools/test-requirements.txt 25 | - name: Documentation Checks 26 | run: | 27 | python docCheck.py 28 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ 2 | # Trusted Publisher stuff: https://docs.pypi.org/trusted-publishers/adding-a-publisher/ 3 | 4 | name: Release to PyPi 5 | 6 | on: 7 | release: 8 | types: [published] 9 | 10 | jobs: 11 | build-n-publish: 12 | name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI 13 | runs-on: ubuntu-latest 14 | environment: 15 | name: pypi 16 | url: https://pypi.org/project/SoftLayer/ 17 | permissions: 18 | id-token: write 19 | steps: 20 | - uses: actions/checkout@v4 21 | - name: Set up Python 3.11 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: 3.11 25 | - name: Install pypa/build 26 | run: >- 27 | python -m 28 | pip install 29 | build 30 | --user 31 | - name: Build a binary wheel and a source tarball 32 | run: >- 33 | python -m 34 | build 35 | --sdist 36 | --wheel 37 | --outdir dist/ 38 | . 39 | - name: 📦 to PyPI 40 | uses: pypa/gh-action-pypi-publish@release/v1 41 | 42 | -------------------------------------------------------------------------------- /.github/workflows/test-snap-can-build.yml: -------------------------------------------------------------------------------- 1 | name: Snap Builds 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | node-version: [20.x] 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - uses: snapcore/action-build@v1 20 | id: build 21 | 22 | - uses: diddlesnaps/snapcraft-review-action@v1 23 | with: 24 | snap: ${{ steps.build.outputs.snap }} 25 | isClassic: 'false' 26 | # Plugs and Slots declarations to override default denial (requires store assertion to publish) 27 | # plugs: ./plug-declaration.json 28 | # slots: ./slot-declaration.json 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | Thumbs.db 4 | .svn 5 | ._* 6 | *.pyc 7 | .coverage 8 | htmlcov 9 | cover/* 10 | .tox 11 | docs/_build/* 12 | build/* 13 | dist/* 14 | *.egg-info 15 | .cache 16 | .idea 17 | .pytest_cache/* 18 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Christopher Gallo 2 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | build: 9 | os: ubuntu-22.04 10 | tools: 11 | python: "3.10" 12 | 13 | # Build documentation in the docs/ directory with Sphinx 14 | sphinx: 15 | builder: htmldir 16 | configuration: docs/conf.py 17 | 18 | # Build documentation with MkDocs 19 | #mkdocs: 20 | # configuration: mkdocs.yml 21 | 22 | # Optionally build your docs in additional formats such as PDF and ePub 23 | # formats: all 24 | 25 | # Optionally set the version of Python and requirements required to build your docs 26 | python: 27 | install: 28 | - requirements: docs/requirements.txt 29 | - method: pip 30 | path: . 31 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | **Please triple-check to make sure that you have properly masked out user credentials like usernames, passwords and API keys before submitting your issue** 2 | 3 | ### Expected Behavior 4 | 5 | ### Actual Behavior 6 | 7 | ### Environment Information 8 | Operating System: 9 | softlayer-python version (`slcli --version`): 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 SoftLayer Technologies, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | -------------------------------------------------------------------------------- /README-snapcraft.md: -------------------------------------------------------------------------------- 1 | # To Install: 2 | 3 | `sudo snap install slcli` 4 | 5 | ------------------------------------------------------------------------ 6 | 7 | # What are SNAPS? 8 | 9 | Snaps are available for any Linux OS running snapd, the service that runs and manage snaps. For more info, see: https://snapcraft.io/ 10 | 11 | or to learn to build and publish your own snaps, please see: 12 | https://docs.snapcraft.io/build-snaps/languages?_ga=2.49470950.193172077.1519771181-1009549731.1511399964 13 | 14 | # Releasing 15 | Builds should be automagic here. 16 | 17 | https://build.snapcraft.io/user/softlayer/softlayer-python 18 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Generally only the latest release will be actively worked on and supported. 6 | Version 5.7.2 is the last version that supports python2.7. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 6.2.x | :white_check_mark: | 11 | | 5.7.2 | :white_check_mark: | 12 | | < 5.7.2 | :x: | 13 | 14 | ## Reporting a Vulnerability 15 | 16 | Create a new [Bug Report](https://github.com/softlayer/softlayer-python/issues/new?assignees=&labels=Bug&template=bug_report.md&title=) to let us know about any vulnerabilities in the code base. 17 | -------------------------------------------------------------------------------- /SoftLayer/CLI/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.CLI 3 | ~~~~~~~~~~~~~~ 4 | Contains all code related to the CLI interface 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | # pylint: disable=w0401, invalid-name 9 | 10 | from SoftLayer.CLI.helpers import * # NOQA 11 | -------------------------------------------------------------------------------- /SoftLayer/CLI/account/__init__.py: -------------------------------------------------------------------------------- 1 | """Account commands""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/account/cancel_item.py: -------------------------------------------------------------------------------- 1 | """Cancels a billing item.""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.managers.account import AccountManager as AccountManager 8 | 9 | 10 | @click.command(cls=SLCommand) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Cancel the resource or service for a billing item. 15 | 16 | By default the billing item will be canceled on the next bill date and 17 | reclaim of the resource will begin shortly after the cancellation 18 | """ 19 | 20 | manager = AccountManager(env.client) 21 | item = manager.cancel_item(identifier) 22 | 23 | if item: 24 | env.fout(f"Item: {identifier} was cancelled.") 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/account/hook_create.py: -------------------------------------------------------------------------------- 1 | """Order/create a provisioning script.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand) 12 | @click.option('--name', '-N', required=True, prompt=True, help="The name of the hook.") 13 | @click.option('--uri', '-U', required=True, prompt=True, help="The endpoint that the script will be downloaded") 14 | @environment.pass_env 15 | def cli(env, name, uri): 16 | """Order/create a provisioning script.""" 17 | 18 | manager = SoftLayer.AccountManager(env.client) 19 | 20 | provisioning = manager.create_provisioning(name, uri) 21 | 22 | table = formatting.KeyValueTable(['name', 'value']) 23 | table.align['name'] = 'r' 24 | table.align['value'] = 'l' 25 | 26 | table.add_row(['Id', provisioning.get('id')]) 27 | table.add_row(['Name', provisioning.get('name')]) 28 | table.add_row(['Created', provisioning.get('createDate')]) 29 | table.add_row(['Uri', provisioning.get('uri')]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/account/hook_delete.py: -------------------------------------------------------------------------------- 1 | """Delete a provisioning script""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | 7 | from SoftLayer.CLI.command import SLCommand as SLCommand 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.managers.account import AccountManager as AccountManager 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """Delete a provisioning script""" 17 | 18 | manager = AccountManager(env.client) 19 | 20 | try: 21 | manager.delete_provisioning(identifier) 22 | click.secho("%s deleted successfully" % identifier, fg='green') 23 | except SoftLayer.SoftLayerAPIError as ex: 24 | click.secho("Failed to delete %s\n%s" % (identifier, ex), fg='red') 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/account/hooks.py: -------------------------------------------------------------------------------- 1 | """Show all Provisioning Scripts.""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.managers import account 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """Show all Provisioning Scripts.""" 16 | 17 | manager = account.AccountManager(env.client) 18 | hooks = manager.get_provisioning_scripts() 19 | 20 | table = formatting.Table(["Id", "Name", "Uri"]) 21 | 22 | for hook in hooks: 23 | table.add_row([hook.get('id'), hook.get('name'), hook.get('uri')]) 24 | 25 | env.fout(table) 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/bandwidth/__init__.py: -------------------------------------------------------------------------------- 1 | """Bandwidth.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/bandwidth/pools_delete.py: -------------------------------------------------------------------------------- 1 | """Delete bandwidth pool.""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer import BandwidthManager 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SLCommand) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Delete bandwidth pool.""" 15 | 16 | manager = BandwidthManager(env.client) 17 | manager.delete_pool(identifier) 18 | env.fout(f"Bandwidth pool {identifier} has been scheduled for deletion.") 19 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/__init__.py: -------------------------------------------------------------------------------- 1 | """Block Storage.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/access/__init__.py: -------------------------------------------------------------------------------- 1 | """Block Storage Access Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/access/password.py: -------------------------------------------------------------------------------- 1 | """Modifies a password for a volume's access""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('access_id') 11 | @click.option('--password', '-p', multiple=False, 12 | help='Password you want to set, this command will fail if the password is not strong.') 13 | @environment.pass_env 14 | def cli(env, access_id, password): 15 | """Changes a password for a volume's access. 16 | 17 | access id is the allowed_host_id from slcli block access-list 18 | """ 19 | 20 | block_manager = SoftLayer.BlockStorageManager(env.client) 21 | 22 | result = block_manager.set_credential_password(access_id=access_id, password=password) 23 | 24 | if result: 25 | click.echo('Password updated for %s' % access_id) 26 | else: 27 | click.echo('FAILED updating password for %s' % access_id) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/convert.py: -------------------------------------------------------------------------------- 1 | """Convert a dependent duplicate volume to an independent volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @environment.pass_env 12 | def cli(env, volume_id): 13 | """Convert a dependent duplicate volume to an independent volume.""" 14 | block_manager = SoftLayer.BlockStorageManager(env.client) 15 | resp = block_manager.convert_dep_dupe(volume_id) 16 | 17 | click.echo(resp) 18 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/duplicate_convert_status.py: -------------------------------------------------------------------------------- 1 | """Get status for split or move completed percentage of a given block duplicate volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand) 11 | @click.argument('volume-id') 12 | @environment.pass_env 13 | def cli(env, volume_id): 14 | """Get status for split or move completed percentage of a given block storage duplicate volume.""" 15 | table = formatting.Table(['Username', 'Active Conversion Start Timestamp', 'Completed Percentage']) 16 | 17 | block_manager = SoftLayer.BlockStorageManager(env.client) 18 | 19 | value = block_manager.convert_dupe_status(volume_id) 20 | 21 | table.add_row( 22 | [ 23 | value['volumeUsername'], 24 | value['activeConversionStartTime'], 25 | value['deDuplicateConversionPercentage'] 26 | ] 27 | ) 28 | 29 | env.fout(table) 30 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/object_list.py: -------------------------------------------------------------------------------- 1 | """List cloud object storage volumes.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @environment.pass_env 13 | def cli(env): 14 | """List cloud block storage.""" 15 | block_manager = SoftLayer.BlockStorageManager(env.client) 16 | 17 | storages = block_manager.get_cloud_list() 18 | 19 | table = formatting.Table(['Id', 20 | 'Account name', 21 | 'Description', 22 | 'Create Date', 23 | 'Type']) 24 | for storage in storages: 25 | table.add_row([storage.get('id'), 26 | storage.get('username'), 27 | storage['storageType']['description'], 28 | storage['billingItem']['createDate'], 29 | storage['storageType']['keyName']]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/refresh.py: -------------------------------------------------------------------------------- 1 | """Refresh a duplicate volume with a snapshot from its parent.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.argument('snapshot_id') 12 | @click.option('--force-refresh', '-f', is_flag=True, default=False, show_default=True, 13 | help="Cancel current refresh process and initiates the new refresh.") 14 | @environment.pass_env 15 | def cli(env, volume_id, snapshot_id, force_refresh): 16 | """Refresh a duplicate volume with a snapshot from its parent. 17 | 18 | EXAMPLE:: 19 | 20 | slcli block volume-refresh VOLUME_ID SNAPSHOT_ID 21 | Refresh a duplicate VOLUME_ID with a snapshot from its parent SNAPSHOT_ID. 22 | """ 23 | block_manager = SoftLayer.BlockStorageManager(env.client) 24 | resp = block_manager.refresh_dupe(volume_id, snapshot_id, force_refresh) 25 | 26 | click.echo(resp) 27 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/replication/__init__.py: -------------------------------------------------------------------------------- 1 | """Block Storage Replication Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/replication/failback.py: -------------------------------------------------------------------------------- 1 | """Failback from a replicant volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume-id') 11 | @environment.pass_env 12 | def cli(env, volume_id): 13 | """Failback a block volume from the given replica volume.""" 14 | block_storage_manager = SoftLayer.BlockStorageManager(env.client) 15 | 16 | success = block_storage_manager.failback_from_replicant(volume_id) 17 | 18 | if success: 19 | click.echo("Failback from replicant is now in progress.") 20 | else: 21 | click.echo("Failback operation could not be initiated.") 22 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/replication/failover.py: -------------------------------------------------------------------------------- 1 | """Failover to a replicant volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume-id') 11 | @click.option('--replicant-id', help="ID of the replicant volume.") 12 | @environment.pass_env 13 | def cli(env, volume_id, replicant_id): 14 | """Failover a block volume to the given replica volume.""" 15 | block_storage_manager = SoftLayer.BlockStorageManager(env.client) 16 | 17 | success = block_storage_manager.failover_to_replicant( 18 | volume_id, 19 | replicant_id 20 | ) 21 | 22 | if success: 23 | click.echo("Failover to replicant is now in progress.") 24 | else: 25 | click.echo("Failover operation could not be initiated.") 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/set_note.py: -------------------------------------------------------------------------------- 1 | """Set note for an existing block storage volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import helpers 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('volume-id') 12 | @click.option('--note', '-n', 13 | type=str, 14 | required=True, 15 | help='Public notes related to a Storage volume') 16 | @environment.pass_env 17 | def cli(env, volume_id, note): 18 | """Set note for an existing block storage volume. 19 | 20 | EXAMPLE:: 21 | 22 | slcli block volume-set-note 12345678 --note 'this is my note' 23 | """ 24 | block_manager = SoftLayer.BlockStorageManager(env.client) 25 | block_volume_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Block Volume') 26 | 27 | result = block_manager.volume_set_note(block_volume_id, note) 28 | 29 | if result: 30 | click.echo("Set note successfully!") 31 | 32 | else: 33 | click.echo("Note could not be set! Please verify your options and try again.") 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/__init__.py: -------------------------------------------------------------------------------- 1 | """Block Storage Snapshot Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/create.py: -------------------------------------------------------------------------------- 1 | """Create a block storage snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option('--notes', '-n', 12 | help='Notes to set on the new snapshot.') 13 | @environment.pass_env 14 | def cli(env, volume_id, notes): 15 | """Creates a snapshot on a given volume.""" 16 | block_manager = SoftLayer.BlockStorageManager(env.client) 17 | snapshot = block_manager.create_snapshot(volume_id, notes=notes) 18 | 19 | if 'id' in snapshot: 20 | click.echo('New snapshot created with id: %s' % snapshot['id']) 21 | else: 22 | click.echo('Error occurred while creating snapshot.\n' 23 | 'Ensure volume is not failed over or in another ' 24 | 'state which prevents taking snapshots.') 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/delete.py: -------------------------------------------------------------------------------- 1 | """Delete a block storage snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('snapshot_id') 11 | @environment.pass_env 12 | def cli(env, snapshot_id): 13 | """Deletes a snapshot on a given volume.""" 14 | block_manager = SoftLayer.BlockStorageManager(env.client) 15 | deleted = block_manager.delete_snapshot(snapshot_id) 16 | 17 | if deleted: 18 | click.echo('Snapshot %s deleted' % snapshot_id) 19 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/disable.py: -------------------------------------------------------------------------------- 1 | """Disable scheduled snapshots of a specific volume""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import exceptions 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('volume_id') 12 | @click.option('--schedule-type', 13 | help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].', 14 | required=True) 15 | @environment.pass_env 16 | def cli(env, volume_id, schedule_type): 17 | """Disables snapshots on the specified schedule for a given volume.""" 18 | 19 | if (schedule_type not in ['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']): 20 | raise exceptions.CLIAbort( 21 | '--schedule-type must be INTERVAL, HOURLY, DAILY, or WEEKLY') 22 | 23 | block_manager = SoftLayer.BlockStorageManager(env.client) 24 | disabled = block_manager.disable_snapshots(volume_id, schedule_type) 25 | 26 | if disabled: 27 | click.echo('%s snapshots have been disabled for volume %s' 28 | % (schedule_type, volume_id)) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/get_notify_status.py: -------------------------------------------------------------------------------- 1 | """Get the snapshots space usage threshold warning flag setting for specific volume""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @environment.pass_env 12 | def cli(env, volume_id): 13 | """Get snapshots space usage threshold warning flag setting for a given volume.""" 14 | block_manager = SoftLayer.BlockStorageManager(env.client) 15 | enabled = block_manager.get_volume_snapshot_notification_status(volume_id) 16 | 17 | if enabled == 0: 18 | click.echo(f"Disabled: Snapshots space usage threshold is disabled for volume {volume_id}") 19 | else: 20 | click.echo(f"Enabled: Snapshots space usage threshold is enabled for volume {volume_id}") 21 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/restore.py: -------------------------------------------------------------------------------- 1 | """Restore a block volume from a snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option('--snapshot-id', '-s', 12 | help='The id of the snapshot which will be used' 13 | ' to restore the block volume.') 14 | @environment.pass_env 15 | def cli(env, volume_id, snapshot_id): 16 | """Restore block volume using a given snapshot.""" 17 | block_manager = SoftLayer.BlockStorageManager(env.client) 18 | success = block_manager.restore_from_snapshot(volume_id, snapshot_id) 19 | 20 | if success: 21 | click.echo('Block volume %s is being restored using snapshot %s' 22 | % (volume_id, snapshot_id)) 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/snapshot/set_notify_status.py: -------------------------------------------------------------------------------- 1 | """Disable/Enable snapshots space usage threshold warning for a specific volume""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option( 12 | '--enable/--disable', 13 | default=True, 14 | help=""" 15 | Enable/Disable snapshot notification. Use `slcli block snapshot-set-notification volumeId --enable` to enable. 16 | """, 17 | required=True) 18 | @environment.pass_env 19 | def cli(env, volume_id, enable): 20 | """Enables/Disables snapshot space usage threshold warning for a given volume.""" 21 | block_manager = SoftLayer.BlockStorageManager(env.client) 22 | 23 | block_manager.set_volume_snapshot_notification(volume_id, enable) 24 | 25 | click.echo( 26 | 'Snapshots space usage threshold warning notification has bee set to %s for volume %s' 27 | % (enable, volume_id)) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/block/subnets/__init__.py: -------------------------------------------------------------------------------- 1 | """Block Storage Subnets Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/cdn/__init__.py: -------------------------------------------------------------------------------- 1 | """Content Delivery Network.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/cdn/cdn.py: -------------------------------------------------------------------------------- 1 | """https://cloud.ibm.com/docs/CDN?topic=CDN-cdn-deprecation""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, deprecated=True) 10 | def cli(): 11 | """https://cloud.ibm.com/docs/CDN?topic=CDN-cdn-deprecation""" 12 | -------------------------------------------------------------------------------- /SoftLayer/CLI/config/show.py: -------------------------------------------------------------------------------- 1 | """Show current CLI configuration.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import config 8 | from SoftLayer.CLI import environment 9 | 10 | 11 | @click.command(cls=SLCommand) 12 | @environment.pass_env 13 | def cli(env): 14 | """Show current configuration.""" 15 | 16 | settings = config.get_settings_from_client(client=env.client, theme=env.theme) 17 | env.fout(config.config_table(settings)) 18 | -------------------------------------------------------------------------------- /SoftLayer/CLI/custom_types.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.CLI.custom_types 3 | ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | Custom type declarations extending click.ParamType 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | 9 | import click 10 | 11 | 12 | # pylint: disable=inconsistent-return-statements 13 | class NetworkParamType(click.ParamType): 14 | """Validates a network parameter type and converts to a tuple. 15 | 16 | todo: Implement to ipaddress.ip_network once the ipaddress backport 17 | module can be added as a dependency or is available on all 18 | supported python versions. 19 | """ 20 | name = 'network' 21 | 22 | def convert(self, value, param, ctx): 23 | try: 24 | # Inlined from python standard ipaddress module 25 | # https://docs.python.org/3/library/ipaddress.html 26 | address = str(value).split('/') 27 | if len(address) != 2: 28 | raise ValueError("Only one '/' permitted in %r" % value) 29 | 30 | ip_address, cidr = address 31 | return (ip_address, int(cidr)) 32 | except ValueError: 33 | self.fail(f'{value} is not a valid network', param, ctx) 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dedicatedhost/__init__.py: -------------------------------------------------------------------------------- 1 | """Dedicated Host.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dedicatedhost/cancel.py: -------------------------------------------------------------------------------- 1 | """Cancel a dedicated host.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @environment.pass_env 16 | def cli(env, identifier): 17 | """Cancel a dedicated host server immediately""" 18 | 19 | mgr = SoftLayer.DedicatedHostManager(env.client) 20 | 21 | host_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'dedicated host') 22 | 23 | if not (env.skip_confirmations or formatting.no_going_back(host_id)): 24 | raise exceptions.CLIAbort('Aborted') 25 | 26 | mgr.cancel_host(host_id) 27 | 28 | click.secho('Dedicated Host %s was cancelled' % host_id, fg='green') 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dns/__init__.py: -------------------------------------------------------------------------------- 1 | """Domain Name System.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dns/record_remove.py: -------------------------------------------------------------------------------- 1 | """Remove resource record.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('record_id') 14 | @environment.pass_env 15 | def cli(env, record_id): 16 | """Remove resource record. 17 | 18 | Example:: 19 | slcli dns record-remove 12345678 20 | This command removes resource record with ID 12345678. 21 | """ 22 | 23 | manager = SoftLayer.DNSManager(env.client) 24 | 25 | if not (env.skip_confirmations or formatting.no_going_back('yes')): 26 | raise exceptions.CLIAbort("Aborted.") 27 | 28 | manager.delete_record(record_id) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dns/zone_create.py: -------------------------------------------------------------------------------- 1 | """Create a zone.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('zone') 12 | @environment.pass_env 13 | def cli(env, zone): 14 | """Create a zone. 15 | 16 | Example:: 17 | slcli dns zone-create ibm.com 18 | This command creates a zone that is named ibm.com. 19 | """ 20 | 21 | manager = SoftLayer.DNSManager(env.client) 22 | manager.create_zone(zone) 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dns/zone_delete.py: -------------------------------------------------------------------------------- 1 | """Delete zone.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('zone') 15 | @environment.pass_env 16 | def cli(env, zone): 17 | """Delete zone. 18 | 19 | Example:: 20 | 21 | slcli dns zone-delete ibm.com 22 | This command deletes a zone that is named ibm.com 23 | """ 24 | 25 | manager = SoftLayer.DNSManager(env.client) 26 | zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') 27 | 28 | if not (env.skip_confirmations or formatting.no_going_back(zone)): 29 | raise exceptions.CLIAbort("Aborted.") 30 | 31 | manager.delete_zone(zone_id) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/dns/zone_print.py: -------------------------------------------------------------------------------- 1 | """Print zone in BIND format.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('zone') 13 | @environment.pass_env 14 | def cli(env, zone): 15 | """Print zone in BIND format. 16 | 17 | Example:: 18 | slcli dns zone-print ibm.com 19 | This command prints zone that is named ibm.com, and in BIND format. 20 | """ 21 | 22 | manager = SoftLayer.DNSManager(env.client) 23 | zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone') 24 | env.fout(manager.dump_zone(zone_id)) 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/email/__init__.py: -------------------------------------------------------------------------------- 1 | """Network Delivery account""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/event_log/__init__.py: -------------------------------------------------------------------------------- 1 | """Event Logs.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/event_log/types.py: -------------------------------------------------------------------------------- 1 | """Get Event Log Types.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | COLUMNS = ['types'] 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @environment.pass_env 15 | def cli(env): 16 | """Get Event Log Types""" 17 | mgr = SoftLayer.EventLogManager(env.client) 18 | 19 | event_log_types = mgr.get_event_log_types() 20 | 21 | table = formatting.Table(COLUMNS) 22 | 23 | for event_log_type in event_log_types: 24 | table.add_row([event_log_type]) 25 | 26 | env.fout(table) 27 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/__init__.py: -------------------------------------------------------------------------------- 1 | """File Storage.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/access/__init__.py: -------------------------------------------------------------------------------- 1 | """File Storage Access Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/convert.py: -------------------------------------------------------------------------------- 1 | """Convert a dependent duplicate volume to an independent volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @environment.pass_env 12 | def cli(env, volume_id): 13 | """Convert a dependent duplicate volume to an independent volume.""" 14 | file_manager = SoftLayer.FileStorageManager(env.client) 15 | resp = file_manager.convert_dep_dupe(volume_id) 16 | 17 | click.echo(resp) 18 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/duplicate_convert_status.py: -------------------------------------------------------------------------------- 1 | """Get status for split or move completed percentage of a given file duplicate volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, 11 | epilog="""Get status for split or move completed percentage of a given file duplicate volume.""") 12 | @click.argument('volume-id') 13 | @environment.pass_env 14 | def cli(env, volume_id): 15 | """Get status for split or move completed percentage of a given file duplicate volume.""" 16 | table = formatting.Table(['Username', 'Active Conversion Start Timestamp', 'Completed Percentage']) 17 | 18 | file_manager = SoftLayer.FileStorageManager(env.client) 19 | 20 | value = file_manager.convert_dupe_status(volume_id) 21 | 22 | table.add_row( 23 | [ 24 | value['volumeUsername'], 25 | value['activeConversionStartTime'], 26 | value['deDuplicateConversionPercentage'] 27 | ] 28 | ) 29 | 30 | env.fout(table) 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/refresh.py: -------------------------------------------------------------------------------- 1 | """Refresh a dependent duplicate volume with a snapshot from its parent.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.argument('snapshot_id') 12 | @click.option('--force-refresh', '-f', is_flag=True, default=False, show_default=True, 13 | help="Cancel current refresh process and initiates the new refresh.") 14 | @environment.pass_env 15 | def cli(env, volume_id, snapshot_id, force_refresh): 16 | """Refresh a duplicate volume with a snapshot from its parent. 17 | 18 | Example:: 19 | slcli file volume-refresh volume_id snapshot_id 20 | 21 | Refresh a duplicate volume_id with a snapshot from its parent snapshot_id. 22 | Refresh a duplicate volume with a snapshot from its parent. 23 | """ 24 | file_manager = SoftLayer.FileStorageManager(env.client) 25 | resp = file_manager.refresh_dupe(volume_id, snapshot_id, force_refresh) 26 | 27 | click.echo(resp) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/replication/__init__.py: -------------------------------------------------------------------------------- 1 | """File Storage Replication Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/replication/failback.py: -------------------------------------------------------------------------------- 1 | """Failback from a replicant volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('volume-id') 12 | @environment.pass_env 13 | def cli(env, volume_id): 14 | """Failback a file volume from the given replicant volume. 15 | 16 | Example:: 17 | slcli file replica-failback 12345678 18 | This command performs failback operation for volume with ID 12345678. 19 | """ 20 | file_storage_manager = SoftLayer.FileStorageManager(env.client) 21 | 22 | success = file_storage_manager.failback_from_replicant(volume_id) 23 | 24 | if success: 25 | click.echo("Failback from replicant is now in progress.") 26 | else: 27 | click.echo("Failback operation could not be initiated.") 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/replication/failover.py: -------------------------------------------------------------------------------- 1 | """Failover to a replicant volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume-id') 11 | @click.option('--replicant-id', help="ID of the replicant volume") 12 | @environment.pass_env 13 | def cli(env, volume_id, replicant_id): 14 | """Failover a file volume to the given replicant volume. 15 | 16 | Example:: 17 | slcli file replica-failover 12345678 87654321 18 | This command performs failover operation for volume with ID 12345678 to replica volume with ID 87654321. 19 | """ 20 | file_storage_manager = SoftLayer.FileStorageManager(env.client) 21 | 22 | success = file_storage_manager.failover_to_replicant( 23 | volume_id, 24 | replicant_id 25 | ) 26 | 27 | if success: 28 | click.echo("Failover to replicant is now in progress.") 29 | else: 30 | click.echo("Failover operation could not be initiated.") 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/set_note.py: -------------------------------------------------------------------------------- 1 | """Set note for an existing File storage volume.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import helpers 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('volume-id') 12 | @click.option('--note', '-n', 13 | type=str, 14 | required=True, 15 | help='Public notes related to a Storage volume') 16 | @environment.pass_env 17 | def cli(env, volume_id, note): 18 | """Set note for an existing file storage volume. 19 | 20 | Example:: 21 | slcli file volume-set-note 12345678 --note 'this is my note' 22 | """ 23 | 24 | file_manager = SoftLayer.FileStorageManager(env.client) 25 | file_volume_id = helpers.resolve_id(file_manager.resolve_ids, volume_id, 'File Storage') 26 | 27 | result = file_manager.volume_set_note(file_volume_id, note) 28 | 29 | if result: 30 | click.echo("Set note successfully!") 31 | 32 | else: 33 | click.echo("Note could not be set! Please verify your options and try again.") 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/__init__.py: -------------------------------------------------------------------------------- 1 | """File Storage Snapshot Control.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/create.py: -------------------------------------------------------------------------------- 1 | """Create a file storage snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option('--notes', '-n', 12 | help='Notes to set on the new snapshot') 13 | @environment.pass_env 14 | def cli(env, volume_id, notes): 15 | """Creates a snapshot on a given volume 16 | 17 | Example:: 18 | 19 | slcli file snapshot-create 12345678 --note snapshotforsoftlayer 20 | This command creates a snapshot for volume with ID 12345678 and with addition note as snapshotforsoftlayer. 21 | """ 22 | file_storage_manager = SoftLayer.FileStorageManager(env.client) 23 | snapshot = file_storage_manager.create_snapshot(volume_id, notes=notes) 24 | 25 | if 'id' in snapshot: 26 | click.echo('New snapshot created with id: %s' % snapshot['id']) 27 | else: 28 | click.echo('Error occurred while creating snapshot.\n' 29 | 'Ensure volume is not failed over or in another ' 30 | 'state which prevents taking snapshots.') 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/delete.py: -------------------------------------------------------------------------------- 1 | """Delete a file storage snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('snapshot_id') 11 | @environment.pass_env 12 | def cli(env, snapshot_id): 13 | """Deletes a snapshot on a given volume""" 14 | file_storage_manager = SoftLayer.FileStorageManager(env.client) 15 | deleted = file_storage_manager.delete_snapshot(snapshot_id) 16 | 17 | if deleted: 18 | click.echo('Snapshot %s deleted' % snapshot_id) 19 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/get_notify_status.py: -------------------------------------------------------------------------------- 1 | """Get the snapshots space usage threshold warning flag setting for specific volume""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @environment.pass_env 12 | def cli(env, volume_id): 13 | """Get snapshots space usage threshold warning flag setting for a given volume""" 14 | 15 | file_manager = SoftLayer.FileStorageManager(env.client) 16 | enabled = file_manager.get_volume_snapshot_notification_status(volume_id) 17 | 18 | if enabled == 0: 19 | click.echo(f"Disabled: Snapshots space usage threshold is disabled for volume {volume_id}") 20 | else: 21 | click.echo(f"Enabled: Snapshots space usage threshold is enabled for volume {volume_id}") 22 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/restore.py: -------------------------------------------------------------------------------- 1 | """Restore a file volume from a snapshot.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option('--snapshot-id', '-s', 12 | help='The id of the snapshot which will be used' 13 | ' to restore the block volume') 14 | @environment.pass_env 15 | def cli(env, volume_id, snapshot_id): 16 | """Restore file volume using a given snapshot 17 | 18 | Example:: 19 | slcli file snapshot-restore 12345678 -s 87654321 20 | This command restores volume with ID 12345678 from snapshot with ID 87654321. 21 | """ 22 | file_manager = SoftLayer.FileStorageManager(env.client) 23 | success = file_manager.restore_from_snapshot(volume_id, snapshot_id) 24 | 25 | if success: 26 | click.echo('File volume %s is being restored using snapshot %s' 27 | % (volume_id, snapshot_id)) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/file/snapshot/set_notify_status.py: -------------------------------------------------------------------------------- 1 | """Disable/Enable snapshots space usage threshold warning for a specific volume""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('volume_id') 11 | @click.option( 12 | '--enable/--disable', 13 | default=True, 14 | help='Enable/Disable snapshot notification. Use `slcli file snapshot-set-notification volumeId --enable` to enable', 15 | required=True) 16 | @environment.pass_env 17 | def cli(env, volume_id, enable): 18 | """Enables/Disables snapshot space usage threshold warning for a given volume""" 19 | file_manager = SoftLayer.FileStorageManager(env.client) 20 | 21 | status = file_manager.set_volume_snapshot_notification(volume_id, enable) 22 | if status: 23 | click.echo( 24 | 'Snapshots space usage threshold warning notification has bee set to %s for volume %s' 25 | % (enable, volume_id)) 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/firewall/__init__.py: -------------------------------------------------------------------------------- 1 | """Firewalls.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | from SoftLayer.CLI import exceptions 5 | 6 | 7 | def parse_id(input_id): 8 | """Helper package to retrieve the actual IDs. 9 | 10 | :param input_id: the ID provided by the user 11 | :returns: A list of valid IDs 12 | """ 13 | key_value = input_id.split(':') 14 | 15 | if len(key_value) != 2: 16 | raise exceptions.CLIAbort( 17 | 'Invalid ID %s: ID should be of the form xxx:yyy' % input_id) 18 | return key_value[0], int(key_value[1]) 19 | -------------------------------------------------------------------------------- /SoftLayer/CLI/globalip/__init__.py: -------------------------------------------------------------------------------- 1 | """Global IP addresses.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/globalip/cancel.py: -------------------------------------------------------------------------------- 1 | """Cancel global IP.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @click.option('-f', '--force', default=False, is_flag=True, help="Force operation without confirmation") 16 | @environment.pass_env 17 | def cli(env, identifier, force): 18 | """Cancel global IP. 19 | 20 | Example:: 21 | 22 | slcli globalip cancel 12345 23 | """ 24 | 25 | mgr = SoftLayer.NetworkManager(env.client) 26 | global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier, name='global ip') 27 | 28 | if not force: 29 | if not (env.skip_confirmations or 30 | formatting.confirm(f"This will cancel the IP address: {global_ip_id} and cannot be undone. Continue?")): 31 | raise exceptions.CLIAbort('Aborted') 32 | 33 | mgr.cancel_global_ip(global_ip_id) 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/globalip/unassign.py: -------------------------------------------------------------------------------- 1 | """Unassigns a global IP from a target.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Unroutes IDENTIFIER 16 | 17 | IDENTIFIER should be either the Global IP address, or the SoftLayer_Network_Subnet_IpAddress_Global id 18 | Example:: 19 | 20 | slcli globalip unassign 123456 21 | 22 | slcli globalip unassign 123.43.22.11 23 | """ 24 | 25 | mgr = SoftLayer.NetworkManager(env.client) 26 | global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier, name='global ip') 27 | 28 | # Find Global IPs SoftLayer_Network_Subnet::id 29 | mask = "mask[id,ipAddress[subnetId]]" 30 | subnet = env.client.call('SoftLayer_Network_Subnet_IpAddress_Global', 'getObject', id=global_ip_id, mask=mask) 31 | subnet_id = subnet.get('ipAddress', {}).get('subnetId') 32 | mgr.clear_route(subnet_id) 33 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/__init__.py: -------------------------------------------------------------------------------- 1 | """Hardware servers.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/authorize_storage.py: -------------------------------------------------------------------------------- 1 | """Authorize File or Block Storage to a Hardware Server""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--username-storage', '-u', type=click.STRING, 15 | help="The storage username to be added to the hardware server") 16 | @environment.pass_env 17 | def cli(env, identifier, username_storage): 18 | """Authorize File or Block Storage to a Hardware Server.""" 19 | hardware = SoftLayer.HardwareManager(env.client) 20 | hardware_id = helpers.resolve_id(hardware.resolve_ids, identifier, 'hardware') 21 | 22 | if not hardware.authorize_storage(hardware_id, username_storage): 23 | raise exceptions.CLIAbort('Authorize Storage Failed') 24 | env.fout('Successfully Storage Added.') 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/cancel_reasons.py: -------------------------------------------------------------------------------- 1 | """Display a list of cancellation reasons.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @environment.pass_env 13 | def cli(env): 14 | """Display a list of cancellation reasons.""" 15 | 16 | table = formatting.Table(['Code', 'Reason']) 17 | table.align['Code'] = 'r' 18 | table.align['Reason'] = 'l' 19 | 20 | mgr = SoftLayer.HardwareManager(env.client) 21 | 22 | for code, reason in mgr.get_cancellation_reasons().items(): 23 | table.add_row([code, reason]) 24 | 25 | env.fout(table) 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/notification_delete.py: -------------------------------------------------------------------------------- 1 | """Remove a user hardware notification entry.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Remove a user hardware notification entry.""" 15 | 16 | hardware = SoftLayer.HardwareManager(env.client) 17 | 18 | result = hardware.remove_notification(identifier) 19 | 20 | if result: 21 | env.fout(f"The hardware notification instance: {identifier} was deleted.") 22 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/notifications.py: -------------------------------------------------------------------------------- 1 | """Get all hardware notifications associated with the passed hardware ID.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Get all hardware notifications.""" 16 | 17 | hardware = SoftLayer.HardwareManager(env.client) 18 | 19 | notifications = hardware.get_notifications(identifier) 20 | 21 | table = formatting.KeyValueTable(['Id', 'Domain', 'Hostmane', 'Username', 'Email', 'FirstName', 'Lastname']) 22 | table.align['Domain'] = 'r' 23 | table.align['Username'] = 'l' 24 | 25 | for notification in notifications: 26 | table.add_row([notification['id'], 27 | notification['hardware']['fullyQualifiedDomainName'], notification['hardware']['hostname'], 28 | notification['user']['username'], notification['user']['email'], 29 | notification['user']['firstName'], notification['user']['lastName']]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/ready.py: -------------------------------------------------------------------------------- 1 | """Check if a server is ready.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--wait', default=0, show_default=True, type=click.INT, 15 | help="Seconds to wait") 16 | @environment.pass_env 17 | def cli(env, identifier, wait): 18 | """Check if a server is ready.""" 19 | 20 | compute = SoftLayer.HardwareManager(env.client) 21 | compute_id = helpers.resolve_id(compute.resolve_ids, identifier, 22 | 'hardware') 23 | ready = compute.wait_for_ready(compute_id, wait) 24 | if ready: 25 | env.fout("READY") 26 | else: 27 | raise exceptions.CLIAbort("Server %s not ready" % compute_id) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/reflash_firmware.py: -------------------------------------------------------------------------------- 1 | """Reflash firmware.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @environment.pass_env 16 | def cli(env, identifier): 17 | """Reflash server firmware.""" 18 | 19 | mgr = SoftLayer.HardwareManager(env.client) 20 | hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') 21 | if not (env.skip_confirmations or 22 | formatting.confirm('This will power off the server with id %s and ' 23 | 'reflash device firmware. Continue?' % hw_id)): 24 | raise exceptions.CLIAbort('Aborted.') 25 | 26 | if mgr.reflash_firmware(hw_id): 27 | click.echo('Successfully device firmware reflashed') 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/hardware/toggle_ipmi.py: -------------------------------------------------------------------------------- 1 | """Toggle the IPMI interface on and off.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--enable/--disable', default=True, 14 | help="Whether enable (DEFAULT) or disable the interface.") 15 | @environment.pass_env 16 | def cli(env, identifier, enable): 17 | """Toggle the IPMI interface on and off""" 18 | 19 | mgr = SoftLayer.HardwareManager(env.client) 20 | hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware') 21 | result = env.client['Hardware_Server'].toggleManagementInterface(enable, id=hw_id) 22 | env.fout(result) 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/__init__.py: -------------------------------------------------------------------------------- 1 | """Compute images.""" 2 | # :license: MIT, see LICENSE for more details. 3 | from SoftLayer.CLI import formatting 4 | 5 | 6 | MASK = ('id,createDate,note,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,' 7 | 'imageType,children[blockDevices[diskImage[softwareReferences[softwareDescription]]]]') 8 | DETAIL_MASK = ('id,createDate,note,accountId,name,globalIdentifier,parentId,publicFlag,flexImageFlag,' 9 | 'imageType,firstChild,children[id,blockDevicesDiskSpaceTotal,datacenter,' 10 | 'transaction[transactionGroup,transactionStatus],' 11 | 'blockDevices[diskImage[capacity,name,units,softwareReferences[softwareDescription]],diskSpace]],' 12 | 'status,transaction,accountReferences') 13 | PUBLIC_TYPE = formatting.FormattedItem('PUBLIC', 'Public') 14 | PRIVATE_TYPE = formatting.FormattedItem('PRIVATE', 'Private') 15 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/datacenter.py: -------------------------------------------------------------------------------- 1 | """Edit details of an image.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--add/--remove', default=True, 14 | help="To add or remove Datacenter") 15 | @click.argument('locations', nargs=-1, required=True) 16 | @environment.pass_env 17 | def cli(env, identifier, add, locations): 18 | """Add/Remove datacenter of an image.""" 19 | 20 | image_mgr = SoftLayer.ImageManager(env.client) 21 | image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image') 22 | 23 | if add: 24 | result = image_mgr.add_locations(image_id, locations) 25 | else: 26 | result = image_mgr.remove_locations(image_id, locations) 27 | 28 | env.fout(result) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/delete.py: -------------------------------------------------------------------------------- 1 | """Delete an image.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Delete an image.""" 16 | 17 | image_mgr = SoftLayer.ImageManager(env.client) 18 | image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image') 19 | 20 | image_mgr.delete_image(image_id) 21 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/edit.py: -------------------------------------------------------------------------------- 1 | """Edit details of an image.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--name', help="Name of the image") 15 | @click.option('--note', help="Additional note for the image") 16 | @click.option('--tag', help="Tags for the image") 17 | @environment.pass_env 18 | def cli(env, identifier, name, note, tag): 19 | """Edit details of an image.""" 20 | 21 | image_mgr = SoftLayer.ImageManager(env.client) 22 | data = {} 23 | if name: 24 | data['name'] = name 25 | if note: 26 | data['note'] = note 27 | if tag: 28 | data['tag'] = tag 29 | image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image') 30 | if not image_mgr.edit(image_id, **data): 31 | raise exceptions.CLIAbort("Failed to Edit Image") 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/share.py: -------------------------------------------------------------------------------- 1 | """Share an image template with another account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--account-id', help='Account Id for another account to share image template', required=True) 14 | @environment.pass_env 15 | def cli(env, identifier, account_id): 16 | """Share an image template with another account.""" 17 | 18 | image_mgr = SoftLayer.ImageManager(env.client) 19 | image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image') 20 | shared_image = image_mgr.share_image(image_id, account_id) 21 | 22 | if shared_image: 23 | env.fout(f"Image template {identifier} was shared to account {account_id}.") 24 | -------------------------------------------------------------------------------- /SoftLayer/CLI/image/share_deny.py: -------------------------------------------------------------------------------- 1 | """Deny share an image template with another account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--account-id', help='Account Id for another account to deny share image template', required=True) 14 | @environment.pass_env 15 | def cli(env, identifier, account_id): 16 | """Deny share an image template with another account.""" 17 | 18 | image_mgr = SoftLayer.ImageManager(env.client) 19 | image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image') 20 | shared_image = image_mgr.deny_share_image(image_id, account_id) 21 | 22 | if shared_image: 23 | env.fout(f"Image template {identifier} was deny shared to account {account_id}.") 24 | -------------------------------------------------------------------------------- /SoftLayer/CLI/licenses/__init__.py: -------------------------------------------------------------------------------- 1 | """VMware licenses.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/licenses/cancel.py: -------------------------------------------------------------------------------- 1 | """Cancel a license.""" 2 | # :licenses: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('key') 12 | @click.option('--immediate', is_flag=True, help='Immediate cancellation') 13 | @environment.pass_env 14 | def cli(env, key, immediate): 15 | """Cancel a license.""" 16 | 17 | licenses = SoftLayer.LicensesManager(env.client) 18 | 19 | item = licenses.cancel_item(key, immediate) 20 | 21 | if item: 22 | env.fout(f"License key: {key} was cancelled.") 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/licenses/create.py: -------------------------------------------------------------------------------- 1 | """Order/create a vwmare licenses.""" 2 | # :licenses: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import formatting 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.option('--key', '-k', required=True, prompt=True, 14 | help="The VMware License Key. " 15 | "To get could use the product_package::getItems id=301 with name Software License Package" 16 | "E.g VMWARE_VSAN_ENTERPRISE_TIER_III_65_124_TB_6_X_2") 17 | @click.option('--datacenter', '-d', required=True, prompt=True, help="Datacenter shortname") 18 | @environment.pass_env 19 | def cli(env, key, datacenter): 20 | """Order/Create License.""" 21 | 22 | item_package = [key] 23 | 24 | licenses = SoftLayer.LicensesManager(env.client) 25 | 26 | result = licenses.create(datacenter, item_package) 27 | 28 | table = formatting.KeyValueTable(['name', 'value']) 29 | table.align['name'] = 'r' 30 | table.align['value'] = 'l' 31 | table.add_row(['id', result['orderId']]) 32 | table.add_row(['created', result['orderDate']]) 33 | 34 | env.fout(table) 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/licenses/create_options.py: -------------------------------------------------------------------------------- 1 | """Licenses order options for a given VMware licenses.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.managers.license import LicensesManager 10 | from SoftLayer import utils 11 | 12 | 13 | @click.command(cls=SLCommand) 14 | @environment.pass_env 15 | def cli(env): 16 | """Server order options for a given chassis.""" 17 | 18 | licenses_manager = LicensesManager(env.client) 19 | 20 | options = licenses_manager.get_create_options() 21 | 22 | table = formatting.Table(['Id', 'description', 'keyName', 'capacity', 'recurringFee']) 23 | for item in options: 24 | fee = 0 25 | if len(item.get('prices', [])) > 0: 26 | fee = item.get('prices')[0].get('recurringFee', 0) 27 | table.add_row([item.get('id'), 28 | utils.trim_to(item.get('description'), 40), 29 | item.get('keyName'), 30 | item.get('capacity'), 31 | fee]) 32 | 33 | env.fout(table) 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/loadbal/__init__.py: -------------------------------------------------------------------------------- 1 | """Load balancers.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/loadbal/protocol_delete.py: -------------------------------------------------------------------------------- 1 | """Delete load balancer protocol.""" 2 | import click 3 | 4 | import SoftLayer 5 | from SoftLayer.CLI import environment 6 | from SoftLayer.CLI import formatting 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @click.argument('identifier') 11 | @click.option('--uuid', help="Load Balancer Uuid.") 12 | @environment.pass_env 13 | def cli(env, identifier, uuid): 14 | """delete a load balancer protocol.""" 15 | 16 | mgr = SoftLayer.LoadBalancerManager(env.client) 17 | 18 | uuid_lb = mgr.get_lb(identifier)['uuid'] 19 | 20 | protocol = mgr.delete_protocol(uuid_lb, uuid) 21 | 22 | table = formatting.KeyValueTable(['name', 'value']) 23 | table.align['name'] = 'r' 24 | table.align['value'] = 'l' 25 | table.add_row(['Id', protocol.get('id')]) 26 | table.add_row(['UUI', protocol.get('uuid')]) 27 | table.add_row(['Address', protocol.get('address')]) 28 | table.add_row(['Type', SoftLayer.LoadBalancerManager.TYPE.get(protocol.get('type'))]) 29 | table.add_row(['Description', protocol.get('description')]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/nas/__init__.py: -------------------------------------------------------------------------------- 1 | """Network Attached Storage.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/nas/credentials.py: -------------------------------------------------------------------------------- 1 | """List NAS account credentials.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """List NAS account credentials.""" 16 | 17 | nw_mgr = SoftLayer.NetworkManager(env.client) 18 | result = nw_mgr.get_nas_credentials(identifier) 19 | table = formatting.Table(['username', 'password']) 20 | table.add_row([result.get('username', 'None'), 21 | result.get('password', 'None')]) 22 | env.fout(table) 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/nas/list.py: -------------------------------------------------------------------------------- 1 | """List NAS accounts.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer import utils 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """List NAS accounts.""" 16 | 17 | account = env.client['Account'] 18 | 19 | nas_accounts = account.getNasNetworkStorage( 20 | mask='eventCount,serviceResource[datacenter.name]') 21 | 22 | table = formatting.Table(['id', 'datacenter', 'size', 'server']) 23 | 24 | for nas_account in nas_accounts: 25 | table.add_row([ 26 | nas_account['id'], 27 | utils.lookup(nas_account, 28 | 'serviceResource', 29 | 'datacenter', 30 | 'name') or formatting.blank(), 31 | formatting.FormattedItem( 32 | nas_account.get('capacityGb', formatting.blank()), 33 | "%dGB" % nas_account.get('capacityGb', 0)), 34 | nas_account.get('serviceResourceBackendIpAddress', 35 | formatting.blank())]) 36 | 37 | env.fout(table) 38 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/__init__.py: -------------------------------------------------------------------------------- 1 | """Object Storage.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/credential/create.py: -------------------------------------------------------------------------------- 1 | """Create credentials for an IBM Cloud Object Storage Account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """Create credentials for an IBM Cloud Object Storage Account""" 17 | 18 | mgr = SoftLayer.ObjectStorageManager(env.client) 19 | storage_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Object Storage') 20 | credential = mgr.create_credential(storage_id) 21 | table = formatting.Table(['id', 'password', 'username', 'type_name']) 22 | table.sortby = 'id' 23 | table.add_row([ 24 | credential.get('id'), 25 | credential.get('password'), 26 | credential.get('username'), 27 | credential.get('type', {}).get('name') 28 | ]) 29 | 30 | env.fout(table) 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/credential/delete.py: -------------------------------------------------------------------------------- 1 | """Delete the credential of an Object Storage Account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--credential_id', '-c', type=click.INT, 14 | help="This is the credential id associated with the volume") 15 | @environment.pass_env 16 | def cli(env, identifier, credential_id): 17 | """Delete the credential of an Object Storage Account.""" 18 | 19 | mgr = SoftLayer.ObjectStorageManager(env.client) 20 | storage_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Object Storage') 21 | credential = mgr.delete_credential(storage_id, credential_id=credential_id) 22 | 23 | env.fout(credential) 24 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/credential/limit.py: -------------------------------------------------------------------------------- 1 | """ Credential limits for this IBM Cloud Object Storage account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """Credential limits for this IBM Cloud Object Storage account.""" 17 | 18 | mgr = SoftLayer.ObjectStorageManager(env.client) 19 | storage_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Object Storage') 20 | credential_limit = mgr.limit_credential(storage_id) 21 | table = formatting.Table(['limit']) 22 | table.add_row([ 23 | credential_limit, 24 | ]) 25 | 26 | env.fout(table) 27 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/credential/list.py: -------------------------------------------------------------------------------- 1 | """Retrieve credentials used for generating an AWS signature. Max of 2.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """Retrieve credentials used for generating an AWS signature. Max of 2.""" 17 | 18 | mgr = SoftLayer.ObjectStorageManager(env.client) 19 | storage_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Object Storage') 20 | credential_list = mgr.list_credential(storage_id) 21 | 22 | table = formatting.Table(['id', 'password', 'username', 'type_name']) 23 | 24 | for credential in credential_list: 25 | table.add_row([ 26 | credential.get('id'), 27 | credential.get('password'), 28 | credential.get('username'), 29 | credential.get('type', {}).get('name') 30 | ]) 31 | 32 | env.fout(table) 33 | -------------------------------------------------------------------------------- /SoftLayer/CLI/object_storage/list_accounts.py: -------------------------------------------------------------------------------- 1 | """List Object Storage accounts.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.option('--limit', 13 | type=int, 14 | default=10, 15 | help="Result limit") 16 | @environment.pass_env 17 | def cli(env, limit): 18 | """List object storage accounts.""" 19 | 20 | mgr = SoftLayer.ObjectStorageManager(env.client) 21 | accounts = mgr.list_accounts(limit=limit) 22 | table = formatting.Table(['id', 'name', 'apiType']) 23 | table.sortby = 'id' 24 | api_type = None 25 | for account in accounts: 26 | if 'vendorName' in account and account['vendorName'] == 'Swift': 27 | api_type = 'Swift' 28 | elif 'Cleversafe' in account['serviceResource']['name']: 29 | api_type = 'S3' 30 | 31 | table.add_row([ 32 | account['id'], 33 | account['username'], 34 | api_type, 35 | ]) 36 | 37 | env.fout(table) 38 | -------------------------------------------------------------------------------- /SoftLayer/CLI/order/__init__.py: -------------------------------------------------------------------------------- 1 | """View and order from the catalog.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/order/cancelation.py: -------------------------------------------------------------------------------- 1 | """List all cancelation.""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | from SoftLayer.managers import ordering 9 | from SoftLayer import utils 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """List all account cancelations""" 16 | table = formatting.Table([ 17 | 'Case Number', 'Items', 'Created', 'Status', 'Requested by']) 18 | 19 | manager = ordering.OrderingManager(env.client) 20 | cancelations = manager.get_all_cancelation() 21 | 22 | for item in cancelations: 23 | table.add_row([item.get('ticketId'), item.get('itemCount'), 24 | utils.clean_time(item.get('createDate'), 25 | in_format='%Y-%m-%dT%H:%M:%S', out_format='%Y-%m-%d %H:%M'), 26 | item['status']['name'], 27 | item['user']['firstName'] + ' ' + item['user']['lastName'] 28 | ]) 29 | 30 | env.fout(table) 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/order/quote_delete.py: -------------------------------------------------------------------------------- 1 | """Delete the quote of an order""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.managers import ordering 8 | 9 | 10 | @click.command(cls=SLCommand) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Delete the quote of an order""" 15 | 16 | manager = ordering.OrderingManager(env.client) 17 | result = manager.delete_quote(identifier) 18 | 19 | if result: 20 | env.fout(f"Quote id: {identifier} was deleted.") 21 | -------------------------------------------------------------------------------- /SoftLayer/CLI/order/quote_list.py: -------------------------------------------------------------------------------- 1 | """List active quotes on an account.""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | from SoftLayer.managers import ordering 9 | from SoftLayer.utils import clean_time 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """List all active quotes on an account""" 16 | table = formatting.Table([ 17 | 'Id', 'Name', 'Created', 'Expiration', 'Status', 'Package Name', 'Package Id' 18 | ]) 19 | table.align['Name'] = 'l' 20 | table.align['Package Name'] = 'r' 21 | table.align['Package Id'] = 'l' 22 | 23 | manager = ordering.OrderingManager(env.client) 24 | items = manager.get_quotes() 25 | 26 | for item in items: 27 | package = item['order']['items'][0]['package'] 28 | table.add_row([ 29 | item.get('id'), 30 | item.get('name'), 31 | clean_time(item.get('createDate')), 32 | clean_time(item.get('modifyDate')), 33 | item.get('status'), 34 | package.get('keyName'), 35 | package.get('id') 36 | ]) 37 | env.fout(table) 38 | -------------------------------------------------------------------------------- /SoftLayer/CLI/order/quote_save.py: -------------------------------------------------------------------------------- 1 | """Save a quote""" 2 | # :license: MIT, see LICENSE for more details. 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | from SoftLayer.managers import ordering 9 | from SoftLayer.utils import clean_time 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @click.argument('quote') 14 | @environment.pass_env 15 | def cli(env, quote): 16 | """Save a quote""" 17 | 18 | manager = ordering.OrderingManager(env.client) 19 | result = manager.save_quote(quote) 20 | 21 | table = formatting.Table([ 22 | 'Id', 'Name', 'Created', 'Modified', 'Status' 23 | ]) 24 | table.align['Name'] = 'l' 25 | 26 | table.add_row([ 27 | result.get('id'), 28 | result.get('name'), 29 | clean_time(result.get('createDate')), 30 | clean_time(result.get('modifyDate')), 31 | result.get('status'), 32 | ]) 33 | 34 | env.fout(table) 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/report/__init__.py: -------------------------------------------------------------------------------- 1 | """Reports.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/__init__.py: -------------------------------------------------------------------------------- 1 | """SSH Keys and SSL Certificates.""" 2 | # :license: MIT, see LICENSE for more details. 3 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/cert_download.py: -------------------------------------------------------------------------------- 1 | """Download SSL certificate and key file.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Download SSL certificate and key file.""" 15 | 16 | manager = SoftLayer.SSLManager(env.client) 17 | certificate = manager.get_certificate(identifier) 18 | 19 | write_cert(certificate['commonName'] + '.crt', certificate['certificate']) 20 | write_cert(certificate['commonName'] + '.key', certificate['privateKey']) 21 | 22 | if 'intermediateCertificate' in certificate: 23 | write_cert(certificate['commonName'] + '.icc', 24 | certificate['intermediateCertificate']) 25 | 26 | if 'certificateSigningRequest' in certificate: 27 | write_cert(certificate['commonName'] + '.csr', 28 | certificate['certificateSigningRequest']) 29 | 30 | 31 | def write_cert(filename, content): 32 | """Writes certificate body to the given file path.""" 33 | with open(filename, 'w', encoding="utf-8") as cert_file: 34 | cert_file.write(content) 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/cert_remove.py: -------------------------------------------------------------------------------- 1 | """Remove SSL certificate.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """Remove SSL certificate.""" 17 | 18 | manager = SoftLayer.SSLManager(env.client) 19 | if not (env.skip_confirmations or formatting.no_going_back('yes')): 20 | raise exceptions.CLIAbort("Aborted.") 21 | 22 | manager.remove_certificate(identifier) 23 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/sshkey_edit.py: -------------------------------------------------------------------------------- 1 | """Edits an SSH key.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--label', '-k', help="The new label for the key") 15 | @click.option('--note', help="New notes for the key") 16 | @environment.pass_env 17 | def cli(env, identifier, label, note): 18 | """Edits an SSH key.""" 19 | 20 | mgr = SoftLayer.SshKeyManager(env.client) 21 | 22 | key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') 23 | 24 | if not mgr.edit_key(key_id, label=label, notes=note): 25 | raise exceptions.CLIAbort('Failed to edit SSH key') 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/sshkey_list.py: -------------------------------------------------------------------------------- 1 | """List SSH keys.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.option('--sortby', 13 | help='Column to sort by', 14 | type=click.Choice(['id', 15 | 'label', 16 | 'fingerprint', 17 | 'notes'])) 18 | @environment.pass_env 19 | def cli(env, sortby): 20 | """List SSH keys.""" 21 | 22 | mgr = SoftLayer.SshKeyManager(env.client) 23 | keys = mgr.list_keys() 24 | 25 | table = formatting.Table(['id', 'label', 'fingerprint', 'notes']) 26 | table.sortby = sortby 27 | 28 | for key in keys: 29 | table.add_row([key['id'], 30 | key.get('label'), 31 | key.get('fingerprint'), 32 | key.get('notes', '-')]) 33 | 34 | env.fout(table) 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/sshkey_print.py: -------------------------------------------------------------------------------- 1 | """Prints out an SSH key to the screen.""" 2 | # :license: MIT, see LICENSE for more details. 3 | from os import path 4 | 5 | import click 6 | 7 | import SoftLayer 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @click.option('--out-file', '-f', 16 | type=click.Path(exists=True, writable=True), 17 | help="The public SSH key will be written to this file") 18 | @environment.pass_env 19 | def cli(env, identifier, out_file): 20 | """Prints out an SSH key to the screen.""" 21 | 22 | mgr = SoftLayer.SshKeyManager(env.client) 23 | 24 | key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') 25 | 26 | key = mgr.get_key(key_id) 27 | 28 | if out_file: 29 | with open(path.expanduser(out_file), 'w', encoding="utf-8") as pub_file: 30 | pub_file.write(key['key']) 31 | 32 | table = formatting.KeyValueTable(['name', 'value']) 33 | table.add_row(['id', key['id']]) 34 | table.add_row(['label', key.get('label')]) 35 | table.add_row(['notes', key.get('notes', '-')]) 36 | env.fout(table) 37 | -------------------------------------------------------------------------------- /SoftLayer/CLI/security/sshkey_remove.py: -------------------------------------------------------------------------------- 1 | """Permanently removes an SSH key.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @environment.pass_env 16 | def cli(env, identifier): 17 | """Permanently removes an SSH key.""" 18 | mgr = SoftLayer.SshKeyManager(env.client) 19 | 20 | key_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'SshKey') 21 | if not (env.skip_confirmations or formatting.no_going_back(key_id)): 22 | raise exceptions.CLIAbort('Aborted') 23 | 24 | mgr.delete_key(key_id) 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/__init__.py: -------------------------------------------------------------------------------- 1 | """Network security groups.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/create.py: -------------------------------------------------------------------------------- 1 | """Create security groups.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.option('--name', '-n', 13 | help="The name of the security group") 14 | @click.option('--description', '-d', 15 | help="The description of the security group") 16 | @environment.pass_env 17 | def cli(env, name, description): 18 | """Create a security group.""" 19 | mgr = SoftLayer.NetworkManager(env.client) 20 | 21 | result = mgr.create_securitygroup(name, description) 22 | table = formatting.KeyValueTable(['name', 'value']) 23 | table.align['name'] = 'r' 24 | table.align['value'] = 'l' 25 | table.add_row(['id', result['id']]) 26 | table.add_row(['name', 27 | result.get('name') or formatting.blank()]) 28 | table.add_row(['description', 29 | result.get('description') or formatting.blank()]) 30 | table.add_row(['created', result['createDate']]) 31 | 32 | env.fout(table) 33 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/delete.py: -------------------------------------------------------------------------------- 1 | """Delete a security group.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import exceptions 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('securitygroup_id') 12 | @environment.pass_env 13 | def cli(env, securitygroup_id): 14 | """Deletes the given security group""" 15 | mgr = SoftLayer.NetworkManager(env.client) 16 | if not mgr.delete_securitygroup(securitygroup_id): 17 | raise exceptions.CLIAbort("Failed to delete security group") 18 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/edit.py: -------------------------------------------------------------------------------- 1 | """Edit details of a security group.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('group_id') 13 | @click.option('--name', '-n', 14 | help="The name of the security group") 15 | @click.option('--description', '-d', 16 | help="The description of the security group") 17 | @environment.pass_env 18 | def cli(env, group_id, name, description): 19 | """Edit details of a security group.""" 20 | mgr = SoftLayer.NetworkManager(env.client) 21 | data = {} 22 | if name: 23 | data['name'] = name 24 | if description: 25 | data['description'] = description 26 | 27 | if not mgr.edit_securitygroup(group_id, **data): 28 | raise exceptions.CLIAbort("Failed to edit security group") 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/event_log.py: -------------------------------------------------------------------------------- 1 | """Get event logs relating to security groups""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import json 5 | 6 | import click 7 | 8 | import SoftLayer 9 | from SoftLayer.CLI import environment 10 | from SoftLayer.CLI import formatting 11 | 12 | COLUMNS = ['event', 'label', 'date', 'metadata'] 13 | 14 | 15 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 16 | @click.argument('request_id') 17 | @environment.pass_env 18 | def get_by_request_id(env, request_id): 19 | """Search for event logs by request id""" 20 | mgr = SoftLayer.NetworkManager(env.client) 21 | 22 | logs = mgr.get_event_logs_by_request_id(request_id) 23 | 24 | table = formatting.Table(COLUMNS) 25 | table.align['metadata'] = "l" 26 | 27 | for log in logs: 28 | metadata = json.dumps(json.loads(log['metaData']), indent=4, sort_keys=True) 29 | 30 | table.add_row([log['eventName'], log['label'], log['eventCreateDate'], metadata]) 31 | 32 | env.fout(table) 33 | -------------------------------------------------------------------------------- /SoftLayer/CLI/securitygroup/list.py: -------------------------------------------------------------------------------- 1 | """List securitygroups.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | COLUMNS = ['id', 11 | 'name', 12 | 'description', ] 13 | 14 | 15 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 16 | @click.option('--sortby', 17 | help='Column to sort by', 18 | type=click.Choice(COLUMNS)) 19 | @click.option('--limit', '-l', 20 | help='How many results to get in one api call, default is 100', 21 | default=100, 22 | show_default=True) 23 | @environment.pass_env 24 | def cli(env, sortby, limit): 25 | """List security groups.""" 26 | 27 | mgr = SoftLayer.NetworkManager(env.client) 28 | 29 | table = formatting.Table(COLUMNS) 30 | table.sortby = sortby 31 | 32 | sgs = mgr.list_securitygroups(limit=limit) 33 | for secgroup in sgs: 34 | table.add_row([ 35 | secgroup['id'], 36 | secgroup.get('name') or formatting.blank(), 37 | secgroup.get('description') or formatting.blank(), 38 | ]) 39 | 40 | env.fout(table) 41 | -------------------------------------------------------------------------------- /SoftLayer/CLI/sshkey/__init__.py: -------------------------------------------------------------------------------- 1 | """SSH Keys.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/ssl/__init__.py: -------------------------------------------------------------------------------- 1 | """SSL Certificates.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/subnet/__init__.py: -------------------------------------------------------------------------------- 1 | """Network subnets.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/subnet/cancel.py: -------------------------------------------------------------------------------- 1 | """Cancel a subnet.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @environment.pass_env 16 | def cli(env, identifier): 17 | """Cancel a subnet.""" 18 | 19 | mgr = SoftLayer.NetworkManager(env.client) 20 | subnet_id = helpers.resolve_id(mgr.resolve_subnet_ids, identifier, 21 | name='subnet') 22 | 23 | if not (env.skip_confirmations or formatting.no_going_back(subnet_id)): 24 | raise exceptions.CLIAbort('Aborted') 25 | 26 | mgr.cancel_subnet(subnet_id) 27 | -------------------------------------------------------------------------------- /SoftLayer/CLI/subnet/clear_route.py: -------------------------------------------------------------------------------- 1 | """Remove the route of your Account Owned subnets.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Remove the route of your Account Owned subnets.""" 16 | 17 | mgr = SoftLayer.NetworkManager(env.client) 18 | 19 | subnet = mgr.clear_route(identifier) 20 | 21 | if subnet: 22 | click.secho("The transaction to clear the route is created, routes will be updated in one or two minutes.") 23 | else: 24 | raise exceptions.CLIAbort('Failed to clear the route for the subnet.') 25 | -------------------------------------------------------------------------------- /SoftLayer/CLI/subnet/edit_ip.py: -------------------------------------------------------------------------------- 1 | """Edit ip note""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('identifier') 12 | @click.option('--note', help="set ip address note of subnet") 13 | @environment.pass_env 14 | def cli(env, identifier, note): 15 | """Set the note of the ipAddress""" 16 | 17 | data = { 18 | 'note': note 19 | } 20 | mgr = SoftLayer.NetworkManager(env.client) 21 | ip_id = None 22 | if str.isdigit(identifier): 23 | ip_id = identifier 24 | else: 25 | ip_object = mgr.get_ip_by_address(identifier) 26 | ip_id = ip_object.get('id') 27 | mgr.set_subnet_ipddress_note(ip_id, data) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/__init__.py: -------------------------------------------------------------------------------- 1 | """Manage Tags""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/cleanup.py: -------------------------------------------------------------------------------- 1 | """Removes unused Tags""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.managers.tags import TagManager 9 | 10 | 11 | @click.command(cls=SLCommand) 12 | @click.option('--dry-run', '-d', is_flag=True, default=False, 13 | help="Don't delete, just show what will be deleted.") 14 | @environment.pass_env 15 | def cli(env, dry_run): 16 | """Removes all empty tags.""" 17 | 18 | tag_manager = TagManager(env.client) 19 | empty_tags = tag_manager.get_unattached_tags() 20 | 21 | for tag in empty_tags: 22 | if dry_run: 23 | click.secho(f"(Dry Run) Removing {tag.get('name')}", fg='yellow') 24 | else: 25 | result = tag_manager.delete_tag(tag.get('name')) 26 | color = 'green' if result else 'red' 27 | click.secho(f"Removing {tag.get('name')}", fg=color) 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/delete.py: -------------------------------------------------------------------------------- 1 | """Delete Tags.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.managers.tags import TagManager 9 | 10 | 11 | @click.command(cls=SLCommand) 12 | @click.argument('identifier') 13 | @click.option('--name', required=False, default=False, is_flag=True, show_default=False, 14 | help='Assume identifier is a tag name. Useful if your tag name is a number.') 15 | @environment.pass_env 16 | def cli(env, identifier, name): 17 | """Delete a Tag. Tag names that contain spaces need to be encased in quotes""" 18 | 19 | tag_manager = TagManager(env.client) 20 | tag_name = identifier 21 | # If the identifier is a int, and user didn't tell us it was a name. 22 | if str.isdigit(identifier) and not name: 23 | tag = tag_manager.get_tag(identifier) 24 | tag_name = tag.get('name', None) 25 | 26 | result = tag_manager.delete_tag(tag_name) 27 | if result: 28 | click.secho(f"Tag {tag_name} has been removed", fg='green') 29 | else: 30 | click.secho(f"Failed to remove tag {tag_name}", fg='red') 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/details.py: -------------------------------------------------------------------------------- 1 | """Details of a Tag.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI.tags.list import detailed_table 9 | from SoftLayer.managers.tags import TagManager 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @click.argument('identifier') 14 | @click.option('--name', required=False, default=False, is_flag=True, show_default=False, 15 | help='Assume identifier is a tag name. Useful if your tag name is a number.') 16 | @environment.pass_env 17 | def cli(env, identifier, name): 18 | """Get details for a Tag. Identifier can be either a name or tag-id""" 19 | 20 | tag_manager = TagManager(env.client) 21 | 22 | # If the identifier is a int, and user didn't tell us it was a name. 23 | if str.isdigit(identifier) and not name: 24 | tags = [tag_manager.get_tag(identifier)] 25 | else: 26 | tags = tag_manager.get_tag_by_name(identifier) 27 | table = detailed_table(tag_manager, tags) 28 | env.fout(table) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/set.py: -------------------------------------------------------------------------------- 1 | """Set Tags.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.managers.tags import TagManager 9 | 10 | 11 | @click.command(cls=SLCommand) 12 | @click.option('--tags', '-t', type=click.STRING, required=True, 13 | help='Comma seperated list of tags, enclosed in quotes. "tag1, tag2"') 14 | @click.option('--key-name', '-k', type=click.STRING, required=True, 15 | help="Key name of a tag type e.g. GUEST, HARDWARE. See slcli tags taggable output.") 16 | @click.option('--resource-id', '-r', type=click.INT, required=True, help="ID of the object being tagged") 17 | @environment.pass_env 18 | def cli(env, tags, key_name, resource_id): 19 | """Set Tags.""" 20 | 21 | tag_manager = TagManager(env.client) 22 | tags = tag_manager.set_tags(tags, key_name, resource_id) 23 | 24 | if tags: 25 | click.secho("Set tags successfully", fg='green') 26 | else: 27 | click.secho("Failed to set tags", fg='red') 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/tags/taggable.py: -------------------------------------------------------------------------------- 1 | """List everything that could be tagged.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI.command import SLCommand as SLCommand 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.managers.tags import TagManager 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """List everything that could be tagged.""" 16 | 17 | tag_manager = TagManager(env.client) 18 | tag_types = tag_manager.get_all_tag_types() 19 | for tag_type in tag_types: 20 | title = f"{tag_type['description']} ({tag_type['keyName']})" 21 | table = formatting.Table(['Id', 'Name'], title=title) 22 | resources = tag_manager.taggable_by_type(tag_type['keyName']) 23 | for resource in resources: 24 | table.add_row([ 25 | resource['resource']['id'], 26 | tag_manager.get_resource_name(resource['resource'], tag_type['keyName']) 27 | ]) 28 | env.fout(table) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/ticket/detail.py: -------------------------------------------------------------------------------- 1 | """Get details for a ticket.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | from SoftLayer.CLI import ticket 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--count', 15 | type=click.INT, 16 | help="Number of updates", 17 | show_default=True, 18 | default=10) 19 | @environment.pass_env 20 | def cli(env, identifier, count): 21 | """Get details for a ticket.""" 22 | 23 | is_json = False 24 | if env.format == 'json': 25 | is_json = True 26 | mgr = SoftLayer.TicketManager(env.client) 27 | 28 | ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket') 29 | env.fout(ticket.get_ticket_results(mgr, ticket_id, is_json, update_count=count)) 30 | -------------------------------------------------------------------------------- /SoftLayer/CLI/ticket/subjects.py: -------------------------------------------------------------------------------- 1 | """List Subject IDs for ticket creation.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @environment.pass_env 13 | def cli(env): 14 | """List Subject IDs for ticket creation.""" 15 | ticket_mgr = SoftLayer.TicketManager(env.client) 16 | 17 | table = formatting.Table(['id', 'subject']) 18 | for subject in ticket_mgr.list_subjects(): 19 | table.add_row([subject['id'], subject['name']]) 20 | 21 | env.fout(table) 22 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/__init__.py: -------------------------------------------------------------------------------- 1 | """Manage Users.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/delete.py: -------------------------------------------------------------------------------- 1 | """Delete user.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import helpers 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Sets a user's status to CANCEL_PENDING, which will immediately disable the account, 16 | 17 | and will eventually be fully removed from the account by an automated internal process. 18 | 19 | Example: slcli user delete userId 20 | 21 | """ 22 | 23 | mgr = SoftLayer.UserManager(env.client) 24 | 25 | user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username') 26 | 27 | user_template = {'userStatusId': 1021} 28 | 29 | result = mgr.edit_user(user_id, user_template) 30 | if result: 31 | click.secho(f"{identifier} deleted successfully", fg='green') 32 | else: 33 | click.secho(f"Failed to delete {identifier}", fg='red') 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/edit_notifications.py: -------------------------------------------------------------------------------- 1 | """Enable or Disable specific noticication for the current user""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.option('--enable/--disable', default=True, 12 | help="Enable (DEFAULT) or Disable selected notification") 13 | @click.argument('notification', nargs=-1, required=True) 14 | @environment.pass_env 15 | def cli(env, enable, notification): 16 | """Enable or Disable specific notifications for the active user. 17 | 18 | Notification names should be enclosed in quotation marks. 19 | Example:: 20 | 21 | slcli user edit-notifications --enable 'Order Approved' 'Reload Complete' 22 | 23 | """ 24 | 25 | mgr = SoftLayer.UserManager(env.client) 26 | 27 | if enable: 28 | result = mgr.enable_notifications(notification) 29 | else: 30 | result = mgr.disable_notifications(notification) 31 | 32 | if result: 33 | click.secho(f"Notifications updated successfully: {', '.join(notification)}", fg='green') 34 | else: 35 | click.secho(f"Failed to update notifications: {', '.join(notification)}", fg='red') 36 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/notifications.py: -------------------------------------------------------------------------------- 1 | """List user notifications""" 2 | import click 3 | 4 | import SoftLayer 5 | from SoftLayer.CLI import environment 6 | from SoftLayer.CLI import formatting 7 | 8 | 9 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 10 | @environment.pass_env 11 | def cli(env): 12 | """My Notifications.""" 13 | 14 | mgr = SoftLayer.UserManager(env.client) 15 | 16 | all_notifications = mgr.get_all_notifications() 17 | 18 | env.fout(notification_table(all_notifications)) 19 | 20 | 21 | def notification_table(all_notifications): 22 | """Creates a table of available notifications""" 23 | 24 | table = formatting.Table(['Id', 'Name', 'Description', 'Enabled']) 25 | table.align['Id'] = 'l' 26 | table.align['Name'] = 'l' 27 | table.align['Description'] = 'l' 28 | table.align['Enabled'] = 'l' 29 | for notification in all_notifications: 30 | table.add_row([notification['id'], 31 | notification['name'], 32 | notification['description'], 33 | notification['enabled']]) 34 | return table 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/vpn_manual.py: -------------------------------------------------------------------------------- 1 | """Enable or Disable vpn subnets manual config for a user.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | 5 | import click 6 | 7 | import SoftLayer 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('user') 14 | @click.option('--enable/--disable', default=True, 15 | help="Enable or disable vpn subnets manual config.") 16 | @environment.pass_env 17 | def cli(env, user, enable): 18 | """Enable or disable user vpn subnets manual config""" 19 | mgr = SoftLayer.UserManager(env.client) 20 | user_id = helpers.resolve_id(mgr.resolve_ids, user, 'username') 21 | 22 | result = mgr.vpn_manual(user_id, enable) 23 | message = f"{user} vpn manual config {'enable' if enable else 'disable'}" 24 | 25 | if result: 26 | click.secho(message, fg='green') 27 | else: 28 | click.secho(f"Failed to update {user}", fg='red') 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/vpn_password.py: -------------------------------------------------------------------------------- 1 | """Set the user VPN password.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | import SoftLayer 6 | 7 | from SoftLayer.CLI.command import SLCommand as SLCommand 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--password', required=True, help="Your new VPN password") 15 | @environment.pass_env 16 | def cli(env, identifier, password): 17 | """Set the user VPN password. 18 | 19 | Example: slcli user vpn-password 123456 --password=Mypassword1. 20 | """ 21 | 22 | mgr = SoftLayer.UserManager(env.client) 23 | user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username') 24 | result = mgr.update_vpn_password(user_id, password) 25 | if result: 26 | click.secho("Successfully updated user VPN password.", fg='green') 27 | -------------------------------------------------------------------------------- /SoftLayer/CLI/user/vpn_subnet.py: -------------------------------------------------------------------------------- 1 | """Add or remove specific subnets access for a user.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | 5 | import click 6 | 7 | import SoftLayer 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.option('--add/--remove', default=True, 14 | help="Add or remove access to subnets.") 15 | @click.argument('user', nargs=1, required=True) 16 | @click.argument('subnet', nargs=-1, required=True) 17 | @environment.pass_env 18 | def cli(env, user, add, subnet): 19 | """Add or remove subnets access for a user.""" 20 | mgr = SoftLayer.UserManager(env.client) 21 | user_id = helpers.resolve_id(mgr.resolve_ids, user, 'username') 22 | if add: 23 | result = mgr.vpn_subnet_add(user_id, subnet) 24 | else: 25 | result = mgr.vpn_subnet_remove(user_id, subnet) 26 | 27 | if result: 28 | click.secho(f"{user} updated successfully", fg='green') 29 | else: 30 | click.secho(f"Failed to update {user}", fg='red') 31 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/__init__.py: -------------------------------------------------------------------------------- 1 | """Virtual Servers.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import re 5 | 6 | import click 7 | 8 | MEMORY_RE = re.compile(r"^(?P[0-9]+)(?Pg|gb|m|mb)?$") 9 | 10 | 11 | class MemoryType(click.ParamType): 12 | """Memory type.""" 13 | name = 'integer' 14 | 15 | def convert(self, value, param, ctx): # pylint: disable=inconsistent-return-statements 16 | """Validate memory argument. Returns the memory value in megabytes.""" 17 | matches = MEMORY_RE.match(value.lower()) 18 | if matches is None: 19 | self.fail('%s is not a valid value for memory amount' % value, param, ctx) 20 | amount_str, unit = matches.groups() 21 | amount = int(amount_str) 22 | if unit in [None, 'm', 'mb']: 23 | # Assume the user intends gigabytes if they specify a number < 1024 24 | if amount < 1024: 25 | return amount * 1024 26 | else: 27 | if amount % 1024 != 0: 28 | self.fail('%s is not an integer that is divisable by 1024' % value, param, ctx) 29 | return amount 30 | elif unit in ['g', 'gb']: 31 | return amount * 1024 32 | 33 | 34 | MEM_TYPE = MemoryType() 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/access.py: -------------------------------------------------------------------------------- 1 | """Get user access details a virtual server.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Get user access details a virtual server.""" 16 | 17 | vsi = SoftLayer.VSManager(env.client) 18 | access_logs = vsi.browser_access_log(identifier) 19 | 20 | table = formatting.KeyValueTable(['Username', 'Source IP', 'Port', 'Date', 'Event', 'Message']) 21 | for log in access_logs: 22 | table.add_row([log.get('username'), log.get('sourceIp'), log.get('sourcePort'), log.get('createDate'), 23 | log.get('eventType'), log.get('message')]) 24 | 25 | env.fout(table) 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/cancel.py: -------------------------------------------------------------------------------- 1 | """Cancel virtual servers.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import formatting 10 | from SoftLayer.CLI import helpers 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.argument('identifier') 15 | @environment.pass_env 16 | def cli(env, identifier): 17 | """Cancel virtual servers.""" 18 | 19 | vsi = SoftLayer.VSManager(env.client) 20 | vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') 21 | if not (env.skip_confirmations or formatting.no_going_back(vs_id)): 22 | raise exceptions.CLIAbort('Aborted') 23 | 24 | virtual_server = vsi.cancel_instance(vs_id) 25 | 26 | if virtual_server: 27 | env.fout(f"The virtual server instance: {vs_id} was cancelled.") 28 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/credentials.py: -------------------------------------------------------------------------------- 1 | """List virtual server credentials.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @environment.pass_env 15 | def cli(env, identifier): 16 | """List virtual server credentials.""" 17 | 18 | vsi = SoftLayer.VSManager(env.client) 19 | vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') 20 | instance = vsi.get_instance(vs_id) 21 | 22 | table = formatting.Table(['username', 'password', 'Software', 'Version']) 23 | 24 | for item in instance['operatingSystem']['passwords']: 25 | table.add_row([item['username'], item['password'], 26 | instance['operatingSystem']['softwareLicense']['softwareDescription']['referenceCode'], 27 | instance['operatingSystem']['softwareLicense']['softwareDescription']['version']]) 28 | env.fout(table) 29 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/notification_add.py: -------------------------------------------------------------------------------- 1 | """Create a user virtual notification entry.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @click.option('--users', multiple=True, 14 | help='UserId to be notified on monitoring failure.') 15 | @environment.pass_env 16 | def cli(env, identifier, users): 17 | """Create a user virtual notification entry.""" 18 | 19 | virtual = SoftLayer.VSManager(env.client) 20 | 21 | table = formatting.KeyValueTable(['Id', 'Hostmane', 'Username', 'Email', 'FirstName', 'Lastname']) 22 | table.align['Id'] = 'r' 23 | table.align['Username'] = 'l' 24 | 25 | for user in users: 26 | notification = virtual.add_notification(identifier, user) 27 | table.add_row([notification['id'], notification['guest']['fullyQualifiedDomainName'], 28 | notification['user']['username'], notification['user']['email'], 29 | notification['user']['lastName'], notification['user']['firstName']]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/notification_delete.py: -------------------------------------------------------------------------------- 1 | """Remove a user VS notification entry.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | 9 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 11 | @click.argument('identifier') 12 | @environment.pass_env 13 | def cli(env, identifier): 14 | """Remove a user VS notification entry.""" 15 | 16 | virtual = SoftLayer.VSManager(env.client) 17 | 18 | result = virtual.remove_notification(identifier) 19 | 20 | if result: 21 | env.fout(f"The virtual server notification instance: {identifier} was deleted.") 22 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/notifications.py: -------------------------------------------------------------------------------- 1 | """Get all hardware notifications associated with the passed hardware ID.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('identifier') 13 | @environment.pass_env 14 | def cli(env, identifier): 15 | """Get all VS notifications.""" 16 | 17 | virtual = SoftLayer.VSManager(env.client) 18 | 19 | notifications = virtual.get_notifications(identifier) 20 | 21 | table = formatting.KeyValueTable(['Id', 'Domain', 'Hostmane', 'Username', 'Email', 'FirstName', 'Lastname']) 22 | table.align['Domain'] = 'r' 23 | table.align['Username'] = 'l' 24 | 25 | for notification in notifications: 26 | table.add_row([notification['id'], 27 | notification['guest']['fullyQualifiedDomainName'], notification['guest']['hostname'], 28 | notification['user']['username'], notification['user']['email'], 29 | notification['user']['lastName'], notification['user']['firstName']]) 30 | 31 | env.fout(table) 32 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/placementgroup/list.py: -------------------------------------------------------------------------------- 1 | """List Placement Groups""" 2 | 3 | import click 4 | 5 | from SoftLayer.CLI.command import SLCommand as SLCommand 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | from SoftLayer.managers.vs_placement import PlacementManager as PlacementManager 9 | from SoftLayer import utils 10 | 11 | 12 | @click.command(cls=SLCommand) 13 | @environment.pass_env 14 | def cli(env): 15 | """List placement groups.""" 16 | manager = PlacementManager(env.client) 17 | result = manager.list() 18 | table = formatting.Table( 19 | ["Id", "Name", "Backend Router", "Rule", "Guests", "Created"], 20 | title="Placement Groups" 21 | ) 22 | for group in result: 23 | table.add_row([ 24 | utils.lookup(group, 'id'), 25 | utils.lookup(group, 'name'), 26 | utils.lookup(group, 'backendRouter', 'hostname'), 27 | utils.lookup(group, 'rule', 'name'), 28 | utils.lookup(group, 'guestCount'), 29 | utils.lookup(group, 'createDate') 30 | ]) 31 | 32 | env.fout(table) 33 | -------------------------------------------------------------------------------- /SoftLayer/CLI/virt/ready.py: -------------------------------------------------------------------------------- 1 | """Check if a virtual server is ready.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import exceptions 9 | from SoftLayer.CLI import helpers 10 | 11 | 12 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 13 | @click.argument('identifier') 14 | @click.option('--wait', default=0, show_default=True, type=click.INT, help="Seconds to wait") 15 | @environment.pass_env 16 | def cli(env, identifier, wait): 17 | """Check if a virtual server is ready.""" 18 | 19 | vsi = SoftLayer.VSManager(env.client) 20 | vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS') 21 | ready = vsi.wait_for_ready(vs_id, wait) 22 | if ready: 23 | env.fout("READY") 24 | else: 25 | raise exceptions.CLIAbort(f"Instance {vs_id} not ready") 26 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vlan/__init__.py: -------------------------------------------------------------------------------- 1 | """Network VLANs.""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vlan/create_options.py: -------------------------------------------------------------------------------- 1 | """Vlan order options.""" 2 | # :license: MIT, see LICENSE for more details. 3 | # pylint: disable=too-many-statements 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI import formatting 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, short_help="Get options to use for creating Vlan servers.") 12 | @environment.pass_env 13 | def cli(env): 14 | """List all the options for creating VLAN""" 15 | 16 | mgr = SoftLayer.NetworkManager(env.client) 17 | datacenters = mgr.get_list_datacenter() 18 | 19 | table = formatting.Table(['Options', 'Value'], title="Datacenters") 20 | router_table = formatting.Table(['Datacenter', 'Router/Pod']) 21 | dc_table = formatting.Table(['Datacenters']) 22 | table.add_row(['VLAN type', 'Private, Public']) 23 | 24 | for datacenter in datacenters: 25 | dc_table.add_row([datacenter['name']]) 26 | routers = mgr.get_routers(datacenter['id']) 27 | for router in routers: 28 | router_table.add_row([datacenter['name'], router['hostname']]) 29 | 30 | table.add_row(['Datacenters', dc_table]) 31 | table.add_row(['Routers', router_table]) 32 | 33 | env.fout(table) 34 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/__init__.py: -------------------------------------------------------------------------------- 1 | """Virtual Private Networks""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/__init__.py: -------------------------------------------------------------------------------- 1 | """IPSEC VPN""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/configure.py: -------------------------------------------------------------------------------- 1 | """Request network configuration of an IPSEC tunnel context.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI.exceptions import CLIHalt 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('context_id', type=int) 13 | @environment.pass_env 14 | def cli(env, context_id): 15 | """Request configuration of a tunnel context. 16 | 17 | This action will update the advancedConfigurationFlag on the context 18 | instance and further modifications against the context will be prevented 19 | until all changes can be propgated to network devices. 20 | """ 21 | manager = SoftLayer.IPSECManager(env.client) 22 | # ensure context can be retrieved by given id 23 | manager.get_tunnel_context(context_id) 24 | 25 | succeeded = manager.apply_configuration(context_id) 26 | if succeeded: 27 | click.echo(f'Configuration request received for context #{context_id}') 28 | else: 29 | raise CLIHalt(f'Failed to enqueue configuration request for context #{context_id}') 30 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/order.py: -------------------------------------------------------------------------------- 1 | """Order a IPSec VPN tunnel.""" 2 | # :licenses: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.CLI import exceptions 10 | from SoftLayer.CLI import formatting 11 | 12 | 13 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 14 | @click.option('--datacenter', '-d', required=True, prompt=True, help="Datacenter shortname") 15 | @environment.pass_env 16 | def cli(env, datacenter): 17 | """Order/create a IPSec VPN tunnel instance.""" 18 | 19 | ipsec_manager = SoftLayer.IPSECManager(env.client) 20 | 21 | if not (env.skip_confirmations or formatting.confirm( 22 | "This action will incur charges on your account. Continue?")): 23 | raise exceptions.CLIAbort('Aborting ipsec order.') 24 | 25 | result = ipsec_manager.order(datacenter, ['IPSEC_STANDARD']) 26 | 27 | table = formatting.KeyValueTable(['Name', 'Value']) 28 | table.align['name'] = 'r' 29 | table.align['value'] = 'l' 30 | table.add_row(['Id', result['orderId']]) 31 | table.add_row(['Created', result['orderDate']]) 32 | table.add_row(['Name', result['placedOrder']['items'][0]['description']]) 33 | 34 | env.fout(table) 35 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/subnet/__init__.py: -------------------------------------------------------------------------------- 1 | """IPSEC VPN Subnets""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/translation/__init__.py: -------------------------------------------------------------------------------- 1 | """IPSEC VPN Address Translations""" 2 | -------------------------------------------------------------------------------- /SoftLayer/CLI/vpn/ipsec/translation/remove.py: -------------------------------------------------------------------------------- 1 | """Remove a translation entry from an IPSEC tunnel context.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | import SoftLayer 7 | from SoftLayer.CLI import environment 8 | from SoftLayer.CLI.exceptions import CLIHalt 9 | 10 | 11 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) 12 | @click.argument('context_id', type=int) 13 | @click.option('-t', 14 | '--translation-id', 15 | required=True, 16 | type=int, 17 | help='Translation identifier to remove') 18 | @environment.pass_env 19 | def cli(env, context_id, translation_id): 20 | """Remove a translation entry from an IPSEC tunnel context. 21 | 22 | A separate configuration request should be made to realize changes on 23 | network devices. 24 | """ 25 | manager = SoftLayer.IPSECManager(env.client) 26 | # ensure translation can be retrieved by given id 27 | manager.get_translation(context_id, translation_id) 28 | 29 | succeeded = manager.remove_translation(context_id, translation_id) 30 | if succeeded: 31 | env.out(f'Removed translation #{translation_id}') 32 | else: 33 | raise CLIHalt(f'Failed to remove translation #{translation_id}') 34 | -------------------------------------------------------------------------------- /SoftLayer/consts.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.consts 3 | ~~~~~~~~~~~~~~~~ 4 | Contains constants used throughout the library 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | VERSION = 'v6.2.6' 9 | API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/' 10 | API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/' 11 | API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/' 12 | API_PRIVATE_ENDPOINT_REST = 'https://api.service.softlayer.com/rest/v3.1/' 13 | USER_AGENT = "softlayer-python/%s" % VERSION 14 | CONFIG_FILE = "~/.softlayer" 15 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/BluePages_Search.py: -------------------------------------------------------------------------------- 1 | findBluePagesProfile = True 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Billing_Invoice_Item.py: -------------------------------------------------------------------------------- 1 | from SoftLayer.fixtures.SoftLayer_Billing_Item import getObject as billingItem 2 | 3 | getBillingItem = billingItem 4 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Billing_Item_Cancellation_Request.py: -------------------------------------------------------------------------------- 1 | getAllCancellationRequests = [ 2 | {"createDate": "2023-04-20T06:53:17-06:00", 3 | "id": 123456, 4 | "ticketId": 147258, 5 | "itemCount": 1, 6 | "items": [ 7 | { 8 | "billingItemId": 369852, 9 | "id": 147852369, 10 | "billingItem": { 11 | "cancellationDate": "2023-05-03T22:59:59-06:00", 12 | "categoryCode": "server", 13 | } 14 | } 15 | ], 16 | "status": { 17 | "id": 4, 18 | "name": "Approved" 19 | }, 20 | "user": { 21 | "firstName": "CHRISTOPHER", 22 | "id": 167758, 23 | "lastName": "GALLO" 24 | } 25 | }] 26 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Dns_Domain.py: -------------------------------------------------------------------------------- 1 | createObject = {'name': 'example.com'} 2 | deleteObject = True 3 | editObject = True 4 | getZoneFileContents = 'lots of text' 5 | getResourceRecords = [ 6 | {'id': 1, 'ttl': 7200, 'data': 'd', 'host': 'a', 'type': 'cname'}, 7 | {'id': 2, 'ttl': 900, 'data': '1', 'host': 'b', 'type': 'a'}, 8 | {'id': 3, 'ttl': 900, 'data': 'x', 'host': 'c', 'type': 'ptr'}, 9 | {'id': 4, 'ttl': 86400, 'data': 'b', 'host': 'd', 'type': 'txt'}, 10 | {'id': 5, 'ttl': 86400, 'data': 'b', 'host': 'e', 'type': 'txt'}, 11 | {'id': 6, 'ttl': 600, 'data': 'b', 'host': 'f', 'type': 'txt'}, 12 | ] 13 | getObject = {'id': 98765, 'name': 'test-example.com'} 14 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Dns_Domain_ResourceRecord.py: -------------------------------------------------------------------------------- 1 | createObject = {'name': 'example.com'} 2 | deleteObject = True 3 | editObject = True 4 | getObject = {'id': 12345, 'ttl': 7200, 'data': 'd', 'host': 'a', 'type': 'cname'} 5 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Email_Subscription.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | {'description': 'Email about your order.', 3 | 'enabled': True, 4 | 'id': 1, 5 | 'name': 'Order Being Reviewed' 6 | }, 7 | {'description': 'Maintenances that will or are likely to cause service ' 8 | 'outages and disruptions', 9 | 'enabled': True, 10 | 'id': 8, 11 | 'name': 'High Impact' 12 | }, 13 | {'description': 'Testing description.', 14 | 'enabled': True, 15 | 'id': 111, 16 | 'name': 'Test notification' 17 | } 18 | ] 19 | 20 | enable = True 21 | 22 | disable = True 23 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Location.py: -------------------------------------------------------------------------------- 1 | getDatacenters = [{'id': 1854895, 'longName': 'dallas 13', 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}] 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Location_Datacenter.py: -------------------------------------------------------------------------------- 1 | getDatacenters = [ 2 | { 3 | "id": 1441195, 4 | "longName": "Dallas 10", 5 | "name": "dal10" 6 | }, 7 | { 8 | "id": 449494, 9 | "longName": "Dallas 9", 10 | "name": "dal09" 11 | } 12 | ] 13 | 14 | getHardwareRouters = [] 15 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Health_Check_Type.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | {'id': 21, 'keyname': 'DEFAULT', 'name': 'Default'}, 3 | {'id': 3, 'keyname': 'DNS', 'name': 'DNS'}, 4 | {'id': 2, 'keyname': 'HTTP', 'name': 'HTTP'}, 5 | {'id': 5, 'keyname': 'HTTP-CUSTOM', 'name': 'HTTP-CUSTOM'}, 6 | {'id': 4, 'keyname': 'ICMP', 'name': 'Ping'}, 7 | {'id': 1, 'keyname': 'TCP', 'name': 'TCP'} 8 | ] 9 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Routing_Type.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [{'id': 4, 'keyname': 'DNS', 'name': 'DNS'}, 2 | {'id': 5, 'keyname': 'FTP', 'name': 'FTP'}, 3 | {'id': 2, 'keyname': 'HTTP', 'name': 'HTTP'}, 4 | {'id': 41, 'keyname': 'HTTPS', 'name': 'HTTPS'}, 5 | {'id': 3, 'keyname': 'TCP', 'name': 'TCP'}, 6 | {'id': 6, 'keyname': 'UDP', 'name': 'UDP'}] 7 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Service.py: -------------------------------------------------------------------------------- 1 | deleteObject = True 2 | toggleStatus = True 3 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_Service_Group.py: -------------------------------------------------------------------------------- 1 | kickAllConnections = True 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller_LoadBalancer_VirtualServer.py: -------------------------------------------------------------------------------- 1 | deleteObject = True 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Cache_Purge.py: -------------------------------------------------------------------------------- 1 | createPurge = [] 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py: -------------------------------------------------------------------------------- 1 | getMappingUsageMetrics = [ 2 | { 3 | "names": [ 4 | "TotalBandwidth", 5 | "TotalHits", 6 | "HitRatio" 7 | ], 8 | "totals": [ 9 | 1.0, 10 | 3, 11 | 2.0 12 | ], 13 | "type": "TOTALS" 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Component.py: -------------------------------------------------------------------------------- 1 | addNetworkVlanTrunks = True 2 | clearNetworkVlanTrunks = True 3 | removeNetworkVlanTrunks = True 4 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Firewall_Update_Request.py: -------------------------------------------------------------------------------- 1 | getObject = { 2 | "guestNetworkComponentId": 1705294, 3 | "id": 1234, 4 | } 5 | 6 | createObject = {} 7 | 8 | edit = True 9 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_LBaaS_HealthMonitor.py: -------------------------------------------------------------------------------- 1 | updateLoadBalancerHealthMonitors = { 2 | 'backendPort': 80, 3 | 'backendProtocol': 'HTTP', 4 | 'healthMonitorUuid': '1a1aa111-4474-4e16-9f02-4de959244444', 5 | 'interval': 50, 6 | 'maxRetries': 10, 7 | 'timeout': 10, 8 | 'urlPath': None 9 | } 10 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_LBaaS_Member.py: -------------------------------------------------------------------------------- 1 | # Should be sldn.softlayer.com/reference/datatypes/SoftLayer_Network_LBaaS_LoadBalancer 2 | deleteLoadBalancerMembers = {} 3 | addLoadBalancerMembers = deleteLoadBalancerMembers 4 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Pod.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | { 3 | 'backendRouterId': 117917, 4 | 'backendRouterName': 'bcr01a.ams01', 5 | 'datacenterId': 265592, 6 | 'datacenterLongName': 'Amsterdam 1', 7 | 'datacenterName': 'ams01', 8 | 'frontendRouterId': 117960, 9 | 'frontendRouterName': 'fcr01a.ams01', 10 | 'name': 'ams01.pod01' 11 | }, 12 | { 13 | 'backendRouterId': 1115295, 14 | 'backendRouterName': 'bcr01a.wdc07', 15 | 'datacenterId': 2017603, 16 | 'datacenterLongName': 'Washington 7', 17 | 'datacenterName': 'wdc07', 18 | 'frontendRouterId': 1114993, 19 | 'frontendRouterName': 'fcr01a.wdc07', 20 | 'name': 'wdc07.pod01' 21 | }, 22 | { 23 | 'backendRouterId': 1234567, 24 | 'backendRouterName': 'bcr01a.wdc07', 25 | 'datacenterId': 2017603, 26 | 'datacenterLongName': 'Washington 7', 27 | 'datacenterName': 'wdc07', 28 | 'frontendRouterId': 258741369, 29 | 'frontendRouterName': 'fcr01a.wdc07', 30 | 'name': 'TEST00.pod2' 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Service_Vpn_Overrides.py: -------------------------------------------------------------------------------- 1 | createObjects = True 2 | deleteObjects = True 3 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Storage_Iscsi.py: -------------------------------------------------------------------------------- 1 | getObject = { 2 | "id": 11111, 3 | "allowedVirtualGuests": [ 4 | { 5 | "id": 22222, 6 | "allowedHost": { 7 | "accountId": 12345, 8 | "id": 18311111, 9 | "name": "iqn.2020-03.com.ibm:sl02su11111-v62941551", 10 | "resourceTableId": 6222222, 11 | "resourceTableName": "VIRTUAL_GUEST", 12 | "credential": { 13 | "accountId": "12345", 14 | "createDate": "2020-03-20T13:35:47-06:00", 15 | "id": 1522222, 16 | "nasCredentialTypeId": 2, 17 | "password": "SjFDCpHrmKewos", 18 | "username": "SL02SU322222-V62922222" 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Subnet_IpAddress.py: -------------------------------------------------------------------------------- 1 | getByIpAddress = { 2 | 'id': 12345, 3 | 'ipAddress': '10.0.1.37', 4 | 'isBroadcast': False, 5 | 'isGateway': False, 6 | 'isNetwork': False, 7 | 'isReserved': False, 8 | 'subnetId': 5678, 9 | "hardware": { 10 | "id": 12856, 11 | "fullyQualifiedDomainName": "unit.test.com" 12 | }, 13 | "subnet": { 14 | "broadcastAddress": "10.0.1.91", 15 | "cidr": 26, 16 | "gateway": "10.47.16.129", 17 | "id": 258369, 18 | "isCustomerOwned": False, 19 | "isCustomerRoutable": False, 20 | "modifyDate": "2019-04-02T13:45:52-06:00", 21 | "netmask": "255.255.255.192", 22 | "networkIdentifier": "10.0.1.38", 23 | "networkVlanId": 1236987, 24 | "sortOrder": "0", 25 | "subnetType": "PRIMARY", 26 | "totalIpAddresses": "64", 27 | "usableIpAddressCount": "61", 28 | "version": 4 29 | } 30 | } 31 | 32 | editObject = True 33 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Subnet_IpAddress_Global.py: -------------------------------------------------------------------------------- 1 | route = True 2 | unroute = True 3 | getObject = {'id': 1234, 'billingItem': {'id': 1234}, 'ipAddress': {'subnetId': 9988}} 4 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Network_Subnet_Rwhois_Data.py: -------------------------------------------------------------------------------- 1 | editObject = True 2 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Notification_Occurrence_Event.py: -------------------------------------------------------------------------------- 1 | getObject = { 2 | 'endDate': '2019-03-18T17:00:00-06:00', 3 | 'id': 1234, 4 | 'lastImpactedUserCount': 417756, 5 | 'modifyDate': '2019-03-12T15:32:48-06:00', 6 | 'recoveryTime': None, 7 | 'startDate': '2019-03-18T16:00:00-06:00', 8 | 'subject': 'Public Website Maintenance', 9 | 'summary': 'Blah Blah Blah', 10 | 'systemTicketId': 76057381, 11 | 'acknowledgedFlag': False, 12 | 'attachments': [], 13 | 'impactedResources': [{ 14 | 'resourceType': 'Server', 15 | 'resourceTableId': 12345, 16 | 'hostname': 'test', 17 | 'privateIp': '10.0.0.1', 18 | 'filterLable': 'Server' 19 | }], 20 | 'notificationOccurrenceEventType': {'keyName': 'PLANNED'}, 21 | 'statusCode': {'keyName': 'PUBLISHED', 'name': 'Published'}, 22 | 'updates': [{ 23 | 'contents': 'More Blah Blah', 24 | 'createDate': '2019-03-12T13:07:22-06:00', 25 | 'endDate': None, 'startDate': '2019-03-12T13:07:22-06:00' 26 | }] 27 | } 28 | 29 | getAllObjects = [getObject] 30 | 31 | acknowledgeNotification = True 32 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Provisioning_Hook.py: -------------------------------------------------------------------------------- 1 | createObject = { 2 | 'createDate': '2023-03-22T06:37:45-06:00', 3 | 'id': 207054, 4 | 'name': 'testslcli', 5 | 'uri': 'http://slclitest.com', 6 | 'hookType': {} 7 | } 8 | deleteObject = True 9 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Provisioning_Maintenance_Window.py: -------------------------------------------------------------------------------- 1 | getMaintenanceWindows = [ 2 | { 3 | "beginDate": "2021-05-13T16:00:00-06:00", 4 | "dayOfWeek": 4, 5 | "endDate": "2021-05-13T19:00:00-06:00", 6 | "id": 198351, 7 | "locationId": 1441195, 8 | "portalTzId": 114 9 | }, 10 | { 11 | "beginDat": "2021-05-14T00:00:00-06:00", 12 | "dayOfWeek": 5, 13 | "endDate": "2021-05-14T03:00:00-06:00", 14 | "id": 189747, 15 | "locationId": 1441195, 16 | "portalTzId": 114 17 | }, 18 | { 19 | "beginDate": "2021-05-14T08:00:00-06:00", 20 | "dayOfWeek": 5, 21 | "endDate": "2021-05-14T11:00:00-06:00", 22 | "id": 198355, 23 | "locationId": 1441195, 24 | "portalTzId": 114 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Resource_Metadata.py: -------------------------------------------------------------------------------- 1 | getFrontendMacAddresses = ['06-00-00-00-00-00'] 2 | getBackendMacAddresses = ['07-00-00-00-00-00'] 3 | getFrontendMacAddresses = ['06-00-00-00-00-00'] 4 | getRouter = 'brc01' 5 | getVlans = [10, 124] 6 | getVlanIds = [8384, 12446] 7 | getDatacenter = 'dal01' 8 | getUserMetadata = 'User-supplied data' 9 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Security_Certificate.py: -------------------------------------------------------------------------------- 1 | getObject = { 2 | "certificate": "-----BEGIN CERTIFICATE----- \nMIIEJTCCAw2gAwIBAgIDCbQ0MA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNVBAYTAlVT" 3 | " -----END CERTIFICATE-----", 4 | "certificateSigningRequest": "-----BEGIN CERTIFICATE REQUEST-----\n" 5 | "MIIC1jCCAb4CAQAwgZAxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhh123456QMA4G\n" 6 | "-----END CERTIFICATE REQUEST-----", 7 | "commonName": "techbabble.xyz", 8 | "createDate": "2016-01-20T10:56:44-06:00", 9 | "id": 123456, 10 | "intermediateCertificate": "", 11 | "keySize": 258369, 12 | "modifyDate": "2019-06-05T14:10:40-06:00", 13 | "organizationName": "Unspecified", 14 | "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA3SwTZ7sh7we5zIbmtSbxGJxff07eutrK12345678WXtwQSdE\n" 15 | "-----END RSA PRIVATE KEY-----", 16 | "validityBegin": "2016-01-19T17:59:37-06:00", 17 | "validityDays": 0, 18 | "validityEnd": "2017-01-20T13:48:41-06:00" 19 | } 20 | createObject = {} 21 | editObject = True 22 | deleteObject = True 23 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Security_Ssh_Key.py: -------------------------------------------------------------------------------- 1 | deleteObject = True 2 | editObject = True 3 | getObject = {'id': 1234, 4 | 'fingerprint': 'aa:bb:cc:dd', 5 | 'label': 'label', 6 | 'notes': 'notes', 7 | 'key': 'ssh-rsa AAAAB3N...pa67 user@example.com'} 8 | createObject = getObject 9 | getAllObjects = [getObject] 10 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Software_Component_Password.py: -------------------------------------------------------------------------------- 1 | createObject = { 2 | "createDate": "2022-10-18T09:27:48-06:00", 3 | "id": 78026761, 4 | "notes": "test slcli", 5 | "password": "123456", 6 | "softwareId": 67064532, 7 | "username": "testslcli", 8 | "software": { 9 | "hardwareId": 1532729, 10 | "id": 67064532, 11 | "manufacturerLicenseInstance": "" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Tag.py: -------------------------------------------------------------------------------- 1 | getUnattachedTagsForCurrentUser = [{'id': 287895, 'name': 'coreos', 'referenceCount': 0}] 2 | getAttachedTagsForCurrentUser = [{'id': 1286571, 'name': 'bs_test_instance', 'referenceCount': 5}] 3 | getReferences = [ 4 | { 5 | 'id': 73009305, 6 | 'resourceTableId': 33488921, 7 | 'tag': { 8 | 'id': 1286571, 9 | 'name': 'bs_test_instance', 10 | }, 11 | 'tagId': 1286571, 12 | 'tagType': {'description': 'CCI', 'keyName': 'GUEST'}, 13 | 'tagTypeId': 2, 14 | 'usrRecordId': 6625205 15 | } 16 | ] 17 | 18 | deleteTag = True 19 | 20 | setTags = True 21 | 22 | getObject = getAttachedTagsForCurrentUser[0] 23 | 24 | getTagByTagName = getAttachedTagsForCurrentUser 25 | 26 | getAllTagTypes = [ 27 | { 28 | "description": "Hardware", 29 | "keyName": "HARDWARE" 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Ticket_Subject.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | { 3 | "id": 1001, 4 | "name": "Accounting Request" 5 | }, 6 | { 7 | "id": 1002, 8 | "name": "Sales Request" 9 | }, 10 | { 11 | "id": 1003, 12 | "name": "Reboots and Console Access" 13 | }, 14 | { 15 | "id": 1004, 16 | "name": "DNS Request" 17 | }, 18 | { 19 | "id": 1005, 20 | "name": "Hardware Issue" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_User_Customer_CustomerPermission_Permission.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | { 3 | "key": "T_1", 4 | "keyName": "TICKET_VIEW", 5 | "name": "View Tickets" 6 | }, 7 | { 8 | "key": "T_2", 9 | "keyName": "TEST", 10 | "name": "A Testing Permission" 11 | }, 12 | { 13 | "key": "T_3", 14 | "keyName": "TEST_3", 15 | "name": "A Testing Permission 3" 16 | }, 17 | { 18 | "key": "T_4", 19 | "keyName": "TEST_4", 20 | "name": "A Testing Permission 4" 21 | }, 22 | { 23 | "key": "T_5", 24 | "keyName": "ACCESS_ALL_HARDWARE", 25 | "name": "A Testing Permission 5" 26 | }, 27 | { 28 | 'key': 'ALL_1', 29 | 'keyName': 'ACCESS_ALL_HARDWARE', 30 | 'name': 'All Hardware Access' 31 | }, 32 | { 33 | 'key': 'A_1', 34 | 'keyName': 'ACCOUNT_SUMMARY_VIEW', 35 | 'name': 'View Account Summary' 36 | }, 37 | { 38 | 'key': 'A_10', 39 | 'keyName': 'ADD_SERVICE_STORAGE', 40 | 'name': 'Add/Upgrade Storage (StorageLayer)' 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_User_Permission_Action.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | { 3 | "key": "T_1", 4 | "keyName": "TICKET_VIEW", 5 | "name": "View Tickets" 6 | }, 7 | { 8 | "key": "T_2", 9 | "keyName": "TEST", 10 | "name": "A Testing Permission" 11 | }, 12 | { 13 | "key": "T_3", 14 | "keyName": "TEST_3", 15 | "name": "A Testing Permission 3" 16 | }, 17 | { 18 | "key": "T_4", 19 | "keyName": "TEST_4", 20 | "name": "A Testing Permission 4" 21 | }, 22 | { 23 | "key": "T_5", 24 | "keyName": "ACCESS_ALL_HARDWARE", 25 | "name": "A Testing Permission 5" 26 | }, 27 | { 28 | 'key': 'ALL_1', 29 | 'keyName': 'ACCESS_ALL_HARDWARE', 30 | 'name': 'All Hardware Access' 31 | }, 32 | { 33 | 'key': 'A_1', 34 | 'keyName': 'ACCOUNT_SUMMARY_VIEW', 35 | 'name': 'View Account Summary' 36 | }, 37 | { 38 | 'key': 'A_10', 39 | 'keyName': 'ADD_SERVICE_STORAGE', 40 | 'name': 'Add/Upgrade Storage (StorageLayer)' 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Virtual_Host.py: -------------------------------------------------------------------------------- 1 | getGuests = [ 2 | { 3 | "accountId": 11111, 4 | "createDate": "2019-09-05T17:03:42-06:00", 5 | "fullyQualifiedDomainName": "NSX-T Manager", 6 | "hostname": "NSX-T Manager", 7 | "id": 22222, 8 | "maxCpu": 16, 9 | "maxCpuUnits": "CORE", 10 | "maxMemory": 49152, 11 | "startCpus": 16, 12 | "powerState": { 13 | "keyName": "RUNNING", 14 | "name": "Running" 15 | }, 16 | "status": { 17 | "keyName": "ACTIVE", 18 | "name": "Active" 19 | } 20 | }, 21 | { 22 | "accountId": 11111, 23 | "createDate": "2019-09-23T06:00:53-06:00", 24 | "hostname": "NSX-T Manager2", 25 | "id": 33333, 26 | "maxCpu": 12, 27 | "maxCpuUnits": "CORE", 28 | "maxMemory": 49152, 29 | "startCpus": 12, 30 | "statusId": 1001, 31 | "powerState": { 32 | "keyName": "RUNNING", 33 | "name": "Running" 34 | }, 35 | "status": { 36 | "keyName": "ACTIVE", 37 | "name": "Active" 38 | } 39 | } 40 | ] 41 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/SoftLayer_Virtual_PlacementGroup_Rule.py: -------------------------------------------------------------------------------- 1 | getAllObjects = [ 2 | { 3 | "id": 1, 4 | "keyName": "SPREAD", 5 | "name": "SPREAD" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/SoftLayer/fixtures/__init__.py -------------------------------------------------------------------------------- /SoftLayer/fixtures/empty.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/SoftLayer/fixtures/empty.conf -------------------------------------------------------------------------------- /SoftLayer/fixtures/full.conf: -------------------------------------------------------------------------------- 1 | [softlayer] 2 | username=myusername 3 | api_key=myapi_key 4 | endpoint_url=myendpoint_url -------------------------------------------------------------------------------- /SoftLayer/fixtures/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3N...pa67 user@example.com -------------------------------------------------------------------------------- /SoftLayer/fixtures/no_options.conf: -------------------------------------------------------------------------------- 1 | [softlayer] -------------------------------------------------------------------------------- /SoftLayer/fixtures/realtest.com: -------------------------------------------------------------------------------- 1 | $ORIGIN realtest.com. 2 | $TTL 86400 3 | @ IN SOA ns1.softlayer.com. support.softlayer.com. ( 4 | 2014052300 ; Serial 5 | 7200 ; Refresh 6 | 600 ; Retry 7 | 1728000 ; Expire 8 | 43200) ; Minimum 9 | 10 | @ 86400 IN NS ns1.softlayer.com. 11 | @ 86400 IN NS ns2.softlayer.com. 12 | 13 | IN MX 10 test.realtest.com. 14 | testing 86400 IN A 127.0.0.1 15 | testing1 86400 IN A 12.12.0.1 16 | server2 IN A 1.0.3.4 17 | ftp IN CNAME server2 18 | dev.realtest.com IN TXT "This is just a test of the txt record" 19 | IN AAAA 2001:db8:10::1 20 | spf IN TXT "v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a -all" 21 | 22 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/sample_vs_template.conf: -------------------------------------------------------------------------------- 1 | hostname = myhost 2 | domain = example.com 3 | datacenter = dal05 4 | cpu = 4 5 | memory = 1024 6 | os = DEBIAN_7_64 7 | network = 100 8 | hourly = true 9 | monthly= false 10 | disk=50,100 -------------------------------------------------------------------------------- /SoftLayer/fixtures/soap/SoftLayer_Account_getObject.soap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SoftLayer Internal - Development Community 7 | 307608 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/soap/SoftLayer_Account_getVirtualGuests.soap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1 6 | 7 | 8 | 9 | 10 | 11 | 12 | cgallo.com 13 | KVM-Test 14 | 121401696 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/soap/SoftLayer_Virtual_Guest_getObject.soap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ibm.com 7 | KVM-Test 8 | 121401696 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/soap/test_objectMask.soap: -------------------------------------------------------------------------------- 1 | 2 | SoftLayer Internal - Development Community307608 -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/Employee_getObject.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | id 8 | 9 | 5555 10 | 11 | 12 | 13 | username 14 | 15 | testUser 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/expiredToken.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | faultCode 8 | 9 | SoftLayer_Exception_EncryptedToken_Expired 10 | 11 | 12 | 13 | faultString 14 | 15 | The token has expired. 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/invalidLogin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | faultCode 8 | 9 | SoftLayer_Exception_Public 10 | 11 | 12 | 13 | faultString 14 | 15 | Invalid username/password 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/refreshFailure.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/SoftLayer/fixtures/xmlrpc/refreshFailure.xml -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/refreshSuccess.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | REFRESHEDTOKENaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 9 | 10 | 11 | 300 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /SoftLayer/fixtures/xmlrpc/successLogin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | hash 8 | 9 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 10 | 11 | 12 | 13 | userId 14 | 15 | 1234 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SoftLayer/shell/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/SoftLayer/shell/__init__.py -------------------------------------------------------------------------------- /SoftLayer/shell/cmd_env.py: -------------------------------------------------------------------------------- 1 | """Print environment variables.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.CLI import environment 7 | from SoftLayer.CLI import formatting 8 | 9 | 10 | @click.command() 11 | @environment.pass_env 12 | def cli(env): 13 | """Print environment variables.""" 14 | filtered_vars = dict([(k, v) 15 | for k, v in env.vars.items() 16 | if not k.startswith('_')]) 17 | env.fout(formatting.iter_to_table(filtered_vars)) 18 | -------------------------------------------------------------------------------- /SoftLayer/shell/cmd_exit.py: -------------------------------------------------------------------------------- 1 | """Exit the shell.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | 6 | from SoftLayer.shell import core 7 | 8 | 9 | @click.command() 10 | def cli(): 11 | """Exit the shell.""" 12 | raise core.ShellExit() 13 | -------------------------------------------------------------------------------- /SoftLayer/shell/cmd_help.py: -------------------------------------------------------------------------------- 1 | """Print help text.""" 2 | # :license: MIT, see LICENSE for more details. 3 | 4 | import click 5 | from click import formatting 6 | 7 | from SoftLayer.CLI import core as cli_core 8 | from SoftLayer.CLI import environment 9 | from SoftLayer.shell import routes 10 | 11 | 12 | @click.command() 13 | @environment.pass_env 14 | @click.pass_context 15 | def cli(ctx, env): 16 | """Print shell help text.""" 17 | env.out("Welcome to the SoftLayer shell.") 18 | env.out("") 19 | 20 | formatter = formatting.HelpFormatter() 21 | commands = [] 22 | shell_commands = [] 23 | for name in cli_core.cli.list_commands(ctx): 24 | command = cli_core.cli.get_command(ctx, name) 25 | if command.short_help is None: 26 | command.short_help = command.help 27 | details = (name, command.short_help) 28 | if name in dict(routes.ALL_ROUTES): 29 | shell_commands.append(details) 30 | else: 31 | commands.append(details) 32 | 33 | with formatter.section('Shell Commands'): 34 | formatter.write_dl(shell_commands) 35 | 36 | with formatter.section('Commands'): 37 | formatter.write_dl(commands) 38 | 39 | for line in formatter.buffer: 40 | env.out(line, newline=False) 41 | -------------------------------------------------------------------------------- /SoftLayer/shell/routes.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.CLI.routes 3 | ~~~~~~~~~~~~~~~~~~~ 4 | Routes for shell-specific commands 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | 9 | ALL_ROUTES = [ 10 | ('exit', 'SoftLayer.shell.cmd_exit:cli'), 11 | ('shell-help', 'SoftLayer.shell.cmd_help:cli'), 12 | ('env', 'SoftLayer.shell.cmd_env:cli'), 13 | ] 14 | 15 | ALL_ALIASES = { 16 | '?': 'shell-help', 17 | 'help': 'shell-help', 18 | 'quit': 'exit', 19 | } 20 | -------------------------------------------------------------------------------- /SoftLayer/transports/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.transports 3 | ~~~~~~~~~~~~~~~~~~~~ 4 | XML-RPC transport layer that uses the requests library. 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | # Required imports to not break existing code. 9 | 10 | 11 | from .debug import DebugTransport 12 | from .fixture import FixtureTransport 13 | from .rest import RestTransport 14 | from .timing import TimingTransport 15 | from .transport import Request 16 | from .transport import SoftLayerListResult as SoftLayerListResult 17 | from .xmlrpc import XmlRpcTransport 18 | 19 | # transports.Request does have a lot of instance attributes. :( 20 | # pylint: disable=too-many-instance-attributes 21 | 22 | __all__ = [ 23 | 'Request', 24 | 'XmlRpcTransport', 25 | 'RestTransport', 26 | 'TimingTransport', 27 | 'DebugTransport', 28 | 'FixtureTransport', 29 | 'SoftLayerListResult' 30 | ] 31 | -------------------------------------------------------------------------------- /SoftLayer/transports/timing.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.transports.timing 3 | ~~~~~~~~~~~~~~~~~~~~ 4 | Timing transport, used when you want to know how long an API call took. 5 | 6 | :license: MIT, see LICENSE for more details. 7 | """ 8 | import time 9 | 10 | 11 | class TimingTransport(object): 12 | """Transport that records API call timings.""" 13 | 14 | def __init__(self, transport): 15 | self.transport = transport 16 | self.last_calls = [] 17 | 18 | def __call__(self, call): 19 | """See Client.call for documentation.""" 20 | start_time = time.time() 21 | 22 | result = self.transport(call) 23 | 24 | end_time = time.time() 25 | self.last_calls.append((call, start_time, end_time - start_time)) 26 | return result 27 | 28 | def get_last_calls(self): 29 | """Retrieves the last_calls property. 30 | 31 | This property will contain a list of tuples in the form 32 | (Request, initiated_utc_timestamp, execution_time) 33 | """ 34 | last_calls = self.last_calls 35 | self.last_calls = [] 36 | return last_calls 37 | 38 | @staticmethod 39 | def print_reproduceable(call): 40 | """Not Implemented""" 41 | return call.service 42 | -------------------------------------------------------------------------------- /checker_README.md: -------------------------------------------------------------------------------- 1 | ## SLCLI Checker 2 | 3 | Script to list all commands in order to compare the changes 4 | 5 | From the softlayer-python root directory, do the following after making changes. 6 | 7 | ``` 8 | pip install SoftLayer 9 | cd softlayer-python 10 | python checker.py 11 | ``` 12 | -------------------------------------------------------------------------------- /docs/_templates/manager_template.rst: -------------------------------------------------------------------------------- 1 | {{ objname }} 2 | {{ underline }} 3 | 4 | .. currentmodule:: {{ module }} 5 | 6 | .. autoclass:: {{ objname }} 7 | :members: 8 | :inherited-members: 9 | 10 | {% block methods %} 11 | .. automethod:: __init__ 12 | 13 | {% if methods %} 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | {% for item in methods %} 18 | ~{{ name }}.{{ item }} 19 | {%- endfor %} 20 | {% endif %} 21 | {% endblock %} 22 | 23 | {% block attributes %} 24 | {% if attributes %} 25 | .. rubric:: Attributes 26 | 27 | .. autosummary:: 28 | {% for item in attributes %} 29 | ~{{ name }}.{{ item }} 30 | {%- endfor %} 31 | {% endif %} 32 | {% endblock %} -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.BandwidthManager.rst: -------------------------------------------------------------------------------- 1 | BandwidthManager 2 | =================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: BandwidthManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~BandwidthManager.__init__ 19 | ~BandwidthManager.create_pool 20 | ~BandwidthManager.delete_pool 21 | ~BandwidthManager.edit_pool 22 | ~BandwidthManager.get_bandwidth_detail 23 | ~BandwidthManager.get_location_group 24 | ~BandwidthManager.resolve_ids 25 | 26 | 27 | 28 | 29 | 30 | .. rubric:: Attributes 31 | 32 | .. autosummary:: 33 | 34 | ~BandwidthManager.resolvers 35 | 36 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.CDNManager.rst: -------------------------------------------------------------------------------- 1 | CDNManager 2 | ============================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: CDNManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~CDNManager.__init__ 19 | ~CDNManager.add_origin 20 | ~CDNManager.create_cdn 21 | ~CDNManager.delete_cdn 22 | ~CDNManager.edit 23 | ~CDNManager.get_cache_key_query_rule 24 | ~CDNManager.get_cdn 25 | ~CDNManager.get_origins 26 | ~CDNManager.get_usage_metrics 27 | ~CDNManager.list_cdn 28 | ~CDNManager.purge_content 29 | ~CDNManager.remove_origin 30 | ~CDNManager.resolve_ids 31 | 32 | 33 | 34 | 35 | 36 | .. rubric:: Attributes 37 | 38 | .. autosummary:: 39 | 40 | ~CDNManager.end_date 41 | ~CDNManager.resolvers 42 | ~CDNManager.start_data 43 | 44 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.CapacityManager.rst: -------------------------------------------------------------------------------- 1 | CapacityManager 2 | ================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: CapacityManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~CapacityManager.__init__ 19 | ~CapacityManager.create 20 | ~CapacityManager.create_guest 21 | ~CapacityManager.get_available_routers 22 | ~CapacityManager.get_create_options 23 | ~CapacityManager.get_object 24 | ~CapacityManager.list 25 | ~CapacityManager.resolve_ids 26 | 27 | 28 | 29 | 30 | 31 | .. rubric:: Attributes 32 | 33 | .. autosummary:: 34 | 35 | ~CapacityManager.resolvers 36 | 37 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.DNSManager.rst: -------------------------------------------------------------------------------- 1 | DNSManager 2 | ============================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: DNSManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~DNSManager.__init__ 19 | ~DNSManager.create_record 20 | ~DNSManager.create_record_mx 21 | ~DNSManager.create_record_ptr 22 | ~DNSManager.create_record_srv 23 | ~DNSManager.create_zone 24 | ~DNSManager.delete_record 25 | ~DNSManager.delete_zone 26 | ~DNSManager.dump_zone 27 | ~DNSManager.edit_record 28 | ~DNSManager.edit_zone 29 | ~DNSManager.get_record 30 | ~DNSManager.get_records 31 | ~DNSManager.get_zone 32 | ~DNSManager.list_zones 33 | ~DNSManager.resolve_ids 34 | ~DNSManager.sync_host_record 35 | ~DNSManager.sync_ptr_record 36 | 37 | 38 | 39 | 40 | 41 | .. rubric:: Attributes 42 | 43 | .. autosummary:: 44 | 45 | ~DNSManager.resolvers 46 | 47 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.DedicatedHostManager.rst: -------------------------------------------------------------------------------- 1 | DedicatedHostManager 2 | ======================================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: DedicatedHostManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~DedicatedHostManager.__init__ 19 | ~DedicatedHostManager.cancel_guests 20 | ~DedicatedHostManager.cancel_host 21 | ~DedicatedHostManager.get_create_options 22 | ~DedicatedHostManager.get_host 23 | ~DedicatedHostManager.get_router_options 24 | ~DedicatedHostManager.list_guests 25 | ~DedicatedHostManager.list_instances 26 | ~DedicatedHostManager.place_order 27 | ~DedicatedHostManager.resolve_ids 28 | ~DedicatedHostManager.verify_order 29 | 30 | 31 | 32 | 33 | 34 | .. rubric:: Attributes 35 | 36 | .. autosummary:: 37 | 38 | ~DedicatedHostManager.resolvers 39 | 40 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.EventLogManager.rst: -------------------------------------------------------------------------------- 1 | EventLogManager 2 | ================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: EventLogManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~EventLogManager.__init__ 19 | ~EventLogManager.build_filter 20 | ~EventLogManager.get_event_log_types 21 | ~EventLogManager.get_event_logs 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.FirewallManager.rst: -------------------------------------------------------------------------------- 1 | FirewallManager 2 | ================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: FirewallManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~FirewallManager.__init__ 19 | ~FirewallManager.add_standard_firewall 20 | ~FirewallManager.add_vlan_firewall 21 | ~FirewallManager.cancel_firewall 22 | ~FirewallManager.edit_dedicated_fwl_rules 23 | ~FirewallManager.edit_standard_fwl_rules 24 | ~FirewallManager.get_dedicated_fwl_rules 25 | ~FirewallManager.get_dedicated_package 26 | ~FirewallManager.get_firewalls 27 | ~FirewallManager.get_firewalls_gatewalls 28 | ~FirewallManager.get_instance 29 | ~FirewallManager.get_standard_fwl_rules 30 | ~FirewallManager.get_standard_package 31 | ~FirewallManager.get_summary 32 | ~FirewallManager.resolve_ids 33 | 34 | 35 | 36 | 37 | 38 | .. rubric:: Attributes 39 | 40 | .. autosummary:: 41 | 42 | ~FirewallManager.resolvers 43 | 44 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.ImageManager.rst: -------------------------------------------------------------------------------- 1 | ImageManager 2 | =============================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: ImageManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~ImageManager.__init__ 19 | ~ImageManager.add_locations 20 | ~ImageManager.delete_image 21 | ~ImageManager.deny_share_image 22 | ~ImageManager.edit 23 | ~ImageManager.export_image_to_uri 24 | ~ImageManager.get_image 25 | ~ImageManager.get_locations_list 26 | ~ImageManager.get_storage_locations 27 | ~ImageManager.import_image_from_uri 28 | ~ImageManager.list_private_images 29 | ~ImageManager.list_public_images 30 | ~ImageManager.remove_locations 31 | ~ImageManager.resolve_ids 32 | ~ImageManager.share_image 33 | 34 | 35 | 36 | 37 | 38 | .. rubric:: Attributes 39 | 40 | .. autosummary:: 41 | 42 | ~ImageManager.resolvers 43 | 44 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.LicensesManager.rst: -------------------------------------------------------------------------------- 1 | LicensesManager 2 | ================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: LicensesManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~LicensesManager.__init__ 19 | ~LicensesManager.cancel_item 20 | ~LicensesManager.create 21 | ~LicensesManager.get_all_objects 22 | ~LicensesManager.get_create_options 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.MetadataManager.rst: -------------------------------------------------------------------------------- 1 | MetadataManager 2 | ================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: MetadataManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~MetadataManager.__init__ 19 | ~MetadataManager.get 20 | ~MetadataManager.private_network 21 | ~MetadataManager.public_network 22 | 23 | 24 | 25 | 26 | 27 | .. rubric:: Attributes 28 | 29 | .. autosummary:: 30 | 31 | ~MetadataManager.attribs 32 | 33 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.ObjectStorageManager.rst: -------------------------------------------------------------------------------- 1 | ObjectStorageManager 2 | ======================================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: ObjectStorageManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~ObjectStorageManager.__init__ 19 | ~ObjectStorageManager.create_credential 20 | ~ObjectStorageManager.delete_credential 21 | ~ObjectStorageManager.limit_credential 22 | ~ObjectStorageManager.list_accounts 23 | ~ObjectStorageManager.list_credential 24 | ~ObjectStorageManager.list_endpoints 25 | ~ObjectStorageManager.resolve_ids 26 | 27 | 28 | 29 | 30 | 31 | .. rubric:: Attributes 32 | 33 | .. autosummary:: 34 | 35 | ~ObjectStorageManager.resolvers 36 | 37 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.PlacementManager.rst: -------------------------------------------------------------------------------- 1 | PlacementManager 2 | =================================== 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: PlacementManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~PlacementManager.__init__ 19 | ~PlacementManager.create 20 | ~PlacementManager.delete 21 | ~PlacementManager.get_all_rules 22 | ~PlacementManager.get_backend_router_id_from_hostname 23 | ~PlacementManager.get_object 24 | ~PlacementManager.get_routers 25 | ~PlacementManager.get_rule_id_from_name 26 | ~PlacementManager.list 27 | ~PlacementManager.resolve_ids 28 | 29 | 30 | 31 | 32 | 33 | .. rubric:: Attributes 34 | 35 | .. autosummary:: 36 | 37 | ~PlacementManager.resolvers 38 | 39 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.SSLManager.rst: -------------------------------------------------------------------------------- 1 | SSLManager 2 | ============================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: SSLManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~SSLManager.__init__ 19 | ~SSLManager.add_certificate 20 | ~SSLManager.edit_certificate 21 | ~SSLManager.get_certificate 22 | ~SSLManager.list_certs 23 | ~SSLManager.remove_certificate 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.SearchManager.rst: -------------------------------------------------------------------------------- 1 | SearchManager 2 | ================================ 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: SearchManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~SearchManager.__init__ 19 | ~SearchManager.advanced 20 | ~SearchManager.get_object_types 21 | ~SearchManager.search 22 | ~SearchManager.search_hadrware_instances 23 | ~SearchManager.search_instances 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.SshKeyManager.rst: -------------------------------------------------------------------------------- 1 | SshKeyManager 2 | ================================ 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: SshKeyManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~SshKeyManager.__init__ 19 | ~SshKeyManager.add_key 20 | ~SshKeyManager.delete_key 21 | ~SshKeyManager.edit_key 22 | ~SshKeyManager.get_key 23 | ~SshKeyManager.list_keys 24 | ~SshKeyManager.resolve_ids 25 | 26 | 27 | 28 | 29 | 30 | .. rubric:: Attributes 31 | 32 | .. autosummary:: 33 | 34 | ~SshKeyManager.resolvers 35 | 36 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.TagManager.rst: -------------------------------------------------------------------------------- 1 | TagManager 2 | ============================= 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: TagManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~TagManager.__init__ 19 | ~TagManager.delete_tag 20 | ~TagManager.get_all_tag_types 21 | ~TagManager.get_attached_tags 22 | ~TagManager.get_resource_name 23 | ~TagManager.get_tag 24 | ~TagManager.get_tag_by_name 25 | ~TagManager.get_tag_references 26 | ~TagManager.get_unattached_tags 27 | ~TagManager.list_tags 28 | ~TagManager.reference_lookup 29 | ~TagManager.set_tags 30 | ~TagManager.taggable_by_type 31 | ~TagManager.type_to_service 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/api/managers/SoftLayer.managers.TicketManager.rst: -------------------------------------------------------------------------------- 1 | TicketManager 2 | ================================ 3 | 4 | .. currentmodule:: SoftLayer.managers 5 | 6 | .. autoclass:: TicketManager 7 | :members: 8 | :inherited-members: 9 | 10 | 11 | .. automethod:: __init__ 12 | 13 | 14 | .. rubric:: Methods 15 | 16 | .. autosummary:: 17 | 18 | ~TicketManager.__init__ 19 | ~TicketManager.attach_hardware 20 | ~TicketManager.attach_virtual_server 21 | ~TicketManager.create_ticket 22 | ~TicketManager.detach_hardware 23 | ~TicketManager.detach_virtual_server 24 | ~TicketManager.get_ticket 25 | ~TicketManager.list_subjects 26 | ~TicketManager.list_tickets 27 | ~TicketManager.resolve_ids 28 | ~TicketManager.update_ticket 29 | ~TicketManager.upload_attachment 30 | 31 | 32 | 33 | 34 | 35 | .. rubric:: Attributes 36 | 37 | .. autosummary:: 38 | 39 | ~TicketManager.resolvers 40 | 41 | -------------------------------------------------------------------------------- /docs/cli/bandwidth.rst: -------------------------------------------------------------------------------- 1 | .. _cli_bandwidth: 2 | 3 | Bandwidth Commands 4 | ================== 5 | 6 | 7 | .. click:: SoftLayer.CLI.bandwidth.pools:cli 8 | :prog: bandwidth pools 9 | :show-nested: 10 | 11 | .. click:: SoftLayer.CLI.bandwidth.pools_detail:cli 12 | :prog: bandwidth pools-detail 13 | :show-nested: 14 | 15 | .. click:: SoftLayer.CLI.bandwidth.summary:cli 16 | :prog: bandwidth summary 17 | :show-nested: 18 | 19 | .. click:: SoftLayer.CLI.bandwidth.pools_create:cli 20 | :prog: bandwidth pools-create 21 | :show-nested: 22 | 23 | .. click:: SoftLayer.CLI.bandwidth.pools_edit:cli 24 | :prog: bandwidth pools-edit 25 | :show-nested: 26 | 27 | .. click:: SoftLayer.CLI.bandwidth.pools_delete:cli 28 | :prog: bandwidth pools-delete 29 | :show-nested: 30 | -------------------------------------------------------------------------------- /docs/cli/config.rst: -------------------------------------------------------------------------------- 1 | .. _cli_config: 2 | 3 | Config 4 | ====== 5 | 6 | `Creating an IBMID apikey `_ 7 | `IBMid for services `_ 8 | 9 | `Creating a SoftLayer apikey `_ 10 | 11 | .. click:: SoftLayer.CLI.config.setup:cli 12 | :prog: config setup 13 | :show-nested: 14 | 15 | 16 | .. click:: SoftLayer.CLI.config.show:cli 17 | :prog: config show 18 | :show-nested: 19 | 20 | 21 | .. click:: SoftLayer.CLI.config.setup:cli 22 | :prog: setup 23 | :show-nested: 24 | -------------------------------------------------------------------------------- /docs/cli/dedicated.rst: -------------------------------------------------------------------------------- 1 | .. _cli_dedicated: 2 | 3 | Dedicated Host Commands 4 | ======================= 5 | 6 | 7 | .. click:: SoftLayer.CLI.dedicatedhost.list:cli 8 | :prog: dedicatedhost list 9 | :show-nested: 10 | 11 | .. click:: SoftLayer.CLI.dedicatedhost.create:cli 12 | :prog: dedicatedhost create 13 | :show-nested: 14 | 15 | .. click:: SoftLayer.CLI.dedicatedhost.create_options:cli 16 | :prog: dedicatedhost create-options 17 | :show-nested: 18 | 19 | .. click:: SoftLayer.CLI.dedicatedhost.detail:cli 20 | :prog: dedicatedhost detail 21 | :show-nested: 22 | 23 | .. click:: SoftLayer.CLI.dedicatedhost.cancel:cli 24 | :prog: dedicatedhost cancel 25 | :show-nested: 26 | 27 | .. click:: SoftLayer.CLI.dedicatedhost.cancel_guests:cli 28 | :prog: dedicatedhost cancel-guests 29 | :show-nested: 30 | 31 | .. click:: SoftLayer.CLI.dedicatedhost.list_guests:cli 32 | :prog: dedicatedhost list-guests 33 | :show-nested: 34 | 35 | .. click:: SoftLayer.CLI.dedicatedhost.list:cli 36 | :prog: virtual host-list 37 | :show-nested: 38 | 39 | .. click:: SoftLayer.CLI.dedicatedhost.create:cli 40 | :prog: virtual host-create 41 | :show-nested: 42 | -------------------------------------------------------------------------------- /docs/cli/dns.rst: -------------------------------------------------------------------------------- 1 | .. _cli_dns: 2 | 3 | DNS Management 4 | ============== 5 | 6 | 7 | .. click:: SoftLayer.CLI.dns.zone_import:cli 8 | :prog: dns import 9 | :show-nested: 10 | 11 | .. click:: SoftLayer.CLI.dns.record_add:cli 12 | :prog: dns record-add 13 | :show-nested: 14 | 15 | .. click:: SoftLayer.CLI.dns.record_edit:cli 16 | :prog: dns record-edit 17 | :show-nested: 18 | 19 | .. click:: SoftLayer.CLI.dns.record_list:cli 20 | :prog: dns record-list 21 | :show-nested: 22 | 23 | .. click:: SoftLayer.CLI.dns.record_remove:cli 24 | :prog: dns record-remove 25 | :show-nested: 26 | 27 | .. click:: SoftLayer.CLI.dns.zone_create:cli 28 | :prog: dns zone-create 29 | :show-nested: 30 | 31 | .. click:: SoftLayer.CLI.dns.zone_delete:cli 32 | :prog: dns zone-delete 33 | :show-nested: 34 | 35 | .. click:: SoftLayer.CLI.dns.zone_list:cli 36 | :prog: dns zone-list 37 | :show-nested: 38 | 39 | .. click:: SoftLayer.CLI.dns.zone_print:cli 40 | :prog: dns zone-print 41 | :show-nested: 42 | -------------------------------------------------------------------------------- /docs/cli/email.rst: -------------------------------------------------------------------------------- 1 | .. _cli_email: 2 | 3 | Email Commands 4 | ============== 5 | 6 | 7 | .. click:: SoftLayer.CLI.email.list:cli 8 | :prog: email list 9 | :show-nested: 10 | 11 | .. click:: SoftLayer.CLI.email.detail:cli 12 | :prog: email detail 13 | :show-nested: 14 | 15 | .. click:: SoftLayer.CLI.email.edit:cli 16 | :prog: email edit 17 | :show-nested: -------------------------------------------------------------------------------- /docs/cli/event_log.rst: -------------------------------------------------------------------------------- 1 | .. _cli_event_log: 2 | 3 | Event-Log Commands 4 | =================== 5 | 6 | 7 | .. click:: SoftLayer.CLI.event_log.get:cli 8 | :prog: event-log get 9 | :show-nested: 10 | 11 | There are usually quite a few events on an account, so be careful when using the `--limit -1` option. The command will automatically break requests out into smaller sub-requests, but this command may take a very long time to complete. It will however print out data as it comes in. 12 | 13 | .. click:: SoftLayer.CLI.event_log.types:cli 14 | :prog: event-log types 15 | :show-nested: 16 | 17 | 18 | Currently the types are as follows, more may be added in the future. 19 | :: 20 | 21 | :......................: 22 | : types : 23 | :......................: 24 | : Account : 25 | : CDN : 26 | : User : 27 | : Bare Metal Instance : 28 | : API Authentication : 29 | : Server : 30 | : CCI : 31 | : Image : 32 | : Bluemix LB : 33 | : Facility : 34 | : Cloud Object Storage : 35 | : Security Group : 36 | :......................: -------------------------------------------------------------------------------- /docs/cli/firewall.rst: -------------------------------------------------------------------------------- 1 | .. _cli_firewall: 2 | 3 | Firewall Management 4 | =================== 5 | 6 | .. click:: SoftLayer.CLI.firewall.add:cli 7 | :prog: firewall add 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.firewall.cancel:cli 11 | :prog: firewall cancel 12 | :show-nested: 13 | 14 | .. click:: SoftLayer.CLI.firewall.detail:cli 15 | :prog: firewall detail 16 | :show-nested: 17 | 18 | .. click:: SoftLayer.CLI.firewall.edit:cli 19 | :prog: firewall edit 20 | :show-nested: 21 | 22 | .. click:: SoftLayer.CLI.firewall.list:cli 23 | :prog: firewall list 24 | :show-nested: 25 | 26 | .. click:: SoftLayer.CLI.firewall.monitoring:cli 27 | :prog: firewall monitoring 28 | :show-nested: 29 | -------------------------------------------------------------------------------- /docs/cli/global_ip.rst: -------------------------------------------------------------------------------- 1 | .. _cli_global_ip: 2 | 3 | Global IP Addresses 4 | =================== 5 | 6 | .. click:: SoftLayer.CLI.globalip.assign:cli 7 | :prog: globalip assign 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.globalip.cancel:cli 11 | :prog: globalip cancel 12 | :show-nested: 13 | 14 | .. click:: SoftLayer.CLI.globalip.create:cli 15 | :prog: globalip create 16 | :show-nested: 17 | 18 | .. click:: SoftLayer.CLI.globalip.list:cli 19 | :prog: globalip list 20 | :show-nested: 21 | 22 | .. click:: SoftLayer.CLI.globalip.unassign:cli 23 | :prog: globalip unassign 24 | :show-nested: 25 | -------------------------------------------------------------------------------- /docs/cli/image.rst: -------------------------------------------------------------------------------- 1 | .. _cli_image: 2 | 3 | Disk Image Commands 4 | =================== 5 | 6 | .. click:: SoftLayer.CLI.image.delete:cli 7 | :prog: image delete 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.image.detail:cli 11 | :prog: image detail 12 | :show-nested: 13 | 14 | .. click:: SoftLayer.CLI.image.edit:cli 15 | :prog: image edit 16 | :show-nested: 17 | 18 | .. click:: SoftLayer.CLI.image.list:cli 19 | :prog: image list 20 | :show-nested: 21 | 22 | .. click:: SoftLayer.CLI.image.import:cli 23 | :prog: image import 24 | :show-nested: 25 | 26 | .. click:: SoftLayer.CLI.image.export:cli 27 | :prog: image export 28 | :show-nested: 29 | 30 | .. click:: SoftLayer.CLI.image.datacenter:cli 31 | :prog: image datacenter 32 | :show-nested: 33 | 34 | .. click:: SoftLayer.CLI.image.share:cli 35 | :prog: image share 36 | :show-nested: 37 | 38 | .. click:: SoftLayer.CLI.image.share_deny:cli 39 | :prog: image share-deny 40 | :show-nested: 41 | -------------------------------------------------------------------------------- /docs/cli/licenses.rst: -------------------------------------------------------------------------------- 1 | .. _cli_licenses: 2 | 3 | licenses Commands 4 | ================= 5 | 6 | .. click:: SoftLayer.CLI.licenses.create_options:cli 7 | :prog: licenses create-options 8 | 9 | .. click:: SoftLayer.CLI.licenses.create:cli 10 | :prog: licenses create 11 | :show-nested: 12 | 13 | .. click:: SoftLayer.CLI.licenses.cancel:cli 14 | :prog: licenses cancel 15 | :show-nested: -------------------------------------------------------------------------------- /docs/cli/nas.rst: -------------------------------------------------------------------------------- 1 | .. _cli_nas: 2 | 3 | NAS Commands 4 | ============ 5 | 6 | .. click:: SoftLayer.CLI.nas.list:cli 7 | :prog: nas list 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.nas.credentials:cli 11 | :prog: nas credentials 12 | :show-nested: -------------------------------------------------------------------------------- /docs/cli/object_storage.rst: -------------------------------------------------------------------------------- 1 | .. _cli_object_storage: 2 | 3 | Object Storage Commands 4 | ======================= 5 | 6 | 7 | .. click:: SoftLayer.CLI.object_storage.list_accounts:cli 8 | :prog: object-storage accounts 9 | :show-nested: 10 | 11 | .. click:: SoftLayer.CLI.object_storage.list_endpoints:cli 12 | :prog: object-storage endpoints 13 | :show-nested: 14 | 15 | .. click:: SoftLayer.CLI.object_storage.credential.list:cli 16 | :prog: object-storage credential list 17 | :show-nested: 18 | 19 | 20 | .. click:: SoftLayer.CLI.object_storage.credential.limit:cli 21 | :prog: object-storage credential limit 22 | :show-nested: 23 | 24 | .. click:: SoftLayer.CLI.object_storage.credential.delete:cli 25 | :prog: object-storage credential delete 26 | :show-nested: 27 | 28 | .. click:: SoftLayer.CLI.object_storage.credential.create:cli 29 | :prog: object-storage credential create 30 | :show-nested: 31 | 32 | .. click:: SoftLayer.CLI.object_storage.cancel:cli 33 | :prog: object-storage cancel 34 | :show-nested: 35 | -------------------------------------------------------------------------------- /docs/cli/reports.rst: -------------------------------------------------------------------------------- 1 | .. _cli_reports: 2 | 3 | 4 | Reports 5 | ======== 6 | 7 | 8 | There are a few report type commands in the SLCLI. 9 | 10 | .. click:: SoftLayer.CLI.summary:cli 11 | :prog: summary 12 | :show-nested: 13 | 14 | 15 | A list of datacenters, and how many servers, VSI, vlans, subnets and public_ips are in each. 16 | 17 | 18 | .. click:: SoftLayer.CLI.bandwidth.summary:cli 19 | :prog: report bandwidth 20 | :show-nested: 21 | 22 | 23 | 24 | .. click:: SoftLayer.CLI.report.dc_closures:cli 25 | :prog: report datacenter-closures 26 | :show-nested: 27 | 28 | 29 | Displays some basic information about the Servers and other resources that are in Datacenters scheduled to be 30 | decommissioned in the near future. 31 | See `IBM Cloud Datacenter Consolidation `_ for 32 | more information 33 | -------------------------------------------------------------------------------- /docs/cli/subnet.rst: -------------------------------------------------------------------------------- 1 | .. _cli_subnets: 2 | 3 | Subnets 4 | ======= 5 | 6 | .. click:: SoftLayer.CLI.subnet.cancel:cli 7 | :prog: subnet cancel 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.subnet.create:cli 11 | :prog: subnet create 12 | :show-nested: 13 | 14 | .. click:: SoftLayer.CLI.subnet.detail:cli 15 | :prog: subnet detail 16 | :show-nested: 17 | 18 | .. click:: SoftLayer.CLI.subnet.edit:cli 19 | :prog: subnet edit 20 | :show-nested: 21 | 22 | .. click:: SoftLayer.CLI.subnet.list:cli 23 | :prog: subnet list 24 | :show-nested: 25 | 26 | .. click:: SoftLayer.CLI.subnet.lookup:cli 27 | :prog: subnet lookup 28 | :show-nested: 29 | 30 | .. click:: SoftLayer.CLI.subnet.edit_ip:cli 31 | :prog: subnet edit-ip 32 | :show-nested: 33 | 34 | .. click:: SoftLayer.CLI.subnet.route:cli 35 | :prog: subnet route 36 | :show-nested: 37 | 38 | .. click:: SoftLayer.CLI.subnet.clear_route:cli 39 | :prog: subnet clear-route 40 | :show-nested: 41 | -------------------------------------------------------------------------------- /docs/cli/tags.rst: -------------------------------------------------------------------------------- 1 | .. _cli_tags: 2 | 3 | Tag Commands 4 | ============ 5 | 6 | These commands will allow you to interact with the **IMS** provier tagging service. The `IBM Global Search and Tagging API `_ can be used to interact with both the **GHOST** provider and **IMS** provider. The **GHOST** provider will handle tags for things outside of the Classic Infrastructure (aka SoftLayer) space. 7 | 8 | .. click:: SoftLayer.CLI.tags.list:cli 9 | :prog: tags list 10 | :show-nested: 11 | 12 | .. click:: SoftLayer.CLI.tags.set:cli 13 | :prog: tags set 14 | :show-nested: 15 | 16 | .. click:: SoftLayer.CLI.tags.details:cli 17 | :prog: tags details 18 | :show-nested: 19 | 20 | .. click:: SoftLayer.CLI.tags.delete:cli 21 | :prog: tags delete 22 | :show-nested: 23 | 24 | .. click:: SoftLayer.CLI.tags.taggable:cli 25 | :prog: tags taggable 26 | :show-nested: 27 | 28 | .. click:: SoftLayer.CLI.tags.cleanup:cli 29 | :prog: tags cleanup 30 | :show-nested: 31 | -------------------------------------------------------------------------------- /docs/cli/vlan.rst: -------------------------------------------------------------------------------- 1 | .. _cli_vlan: 2 | 3 | VLANs 4 | ===== 5 | 6 | .. click:: SoftLayer.CLI.vlan.create:cli 7 | :prog: vlan create 8 | :show-nested: 9 | 10 | .. click:: SoftLayer.CLI.vlan.create_options:cli 11 | :prog: vlan create-options 12 | :show-nested: 13 | 14 | .. click:: SoftLayer.CLI.vlan.detail:cli 15 | :prog: vlan detail 16 | :show-nested: 17 | 18 | .. click:: SoftLayer.CLI.vlan.edit:cli 19 | :prog: vlan edit 20 | :show-nested: 21 | 22 | .. click:: SoftLayer.CLI.vlan.list:cli 23 | :prog: vlan list 24 | :show-nested: 25 | 26 | .. click:: SoftLayer.CLI.vlan.cancel:cli 27 | :prog: vlan cancel 28 | :show-nested: 29 | -------------------------------------------------------------------------------- /docs/cli_directory.rst: -------------------------------------------------------------------------------- 1 | .. _cli_directory: 2 | 3 | Command Directory 4 | ================= 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :glob: 9 | 10 | cli/* 11 | -------------------------------------------------------------------------------- /docs/config_file.rst: -------------------------------------------------------------------------------- 1 | .. _config_file: 2 | 3 | 4 | Configuration File 5 | ================== 6 | The SoftLayer API bindings load your settings from a number of different 7 | locations. 8 | 9 | * Input directly into SoftLayer.create_client_from_env(...) 10 | * Enviorment variables (`SL_USERNAME`, `SL_API_KEY`) 11 | * Config file locations (`~/.softlayer`, `/etc/softlayer.conf`, `%USERPROFILE%\AppData\Roaming\softlayer`) 12 | * Or argument (`-C/path/to/config` or `--config=/path/to/config`) 13 | 14 | The configuration file is INI-based and requires the `softlayer` section to be 15 | present. The only required fields are `username` and `api_key`. You can 16 | optionally supply the `endpoint_url` as well. This file is created 17 | automatically by the `slcli setup` command detailed here: 18 | :ref:`config_setup`. 19 | 20 | *Config Example* 21 | :: 22 | 23 | [softlayer] 24 | username = username 25 | api_key = oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha 26 | endpoint_url = https://api.softlayer.com/xmlrpc/v3/ 27 | timeout = 40 28 | 29 | 30 | *Cloud.ibm.com Config Example* 31 | :: 32 | 33 | [softlayer] 34 | username = apikey 35 | api_key = 123cNyhzg45Ab6789ADyzwR_2LAagNVbySgY73tAQOz1 36 | endpoint_url = https://api.softlayer.com/rest/v3.1/ 37 | timeout = 40 -------------------------------------------------------------------------------- /docs/images/SoftLayer-Python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/docs/images/SoftLayer-Python.png -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx_rtd_theme==3.0.2 2 | sphinx==8.2.3 3 | sphinx-click==6.0.0 4 | click 5 | prettytable 6 | rich 7 | 8 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [tool:pytest] 2 | python_files = *_tests.py 3 | filterwarnings = 4 | ignore::DeprecationWarning 5 | ignore::PendingDeprecationWarning 6 | 7 | [wheel] 8 | universal=1 9 | -------------------------------------------------------------------------------- /slcli: -------------------------------------------------------------------------------- 1 | #!python 2 | # The above might need to be edited to your path to python3 3 | import re 4 | import sys 5 | 6 | from SoftLayer.CLI.core import main 7 | 8 | if __name__ == '__main__': 9 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 10 | # print("arvs[0] = %s" % sys.argv[0]) 11 | sys.exit(main()) -------------------------------------------------------------------------------- /snap/local/slcli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/snap/local/slcli.png -------------------------------------------------------------------------------- /tests/CLI/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/CLI/__init__.py -------------------------------------------------------------------------------- /tests/CLI/custom_types_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.tests.CLI.custom_types_tests 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | :license: MIT, see LICENSE for more details. 6 | """ 7 | 8 | import click 9 | 10 | from SoftLayer.CLI.custom_types import NetworkParamType 11 | from SoftLayer import testing 12 | 13 | 14 | class CustomTypesTests(testing.TestCase): 15 | 16 | def test_network_param_convert(self): 17 | param = NetworkParamType() 18 | (ip_address, cidr) = param.convert('10.0.0.0/24', None, None) 19 | self.assertEqual(ip_address, '10.0.0.0') 20 | self.assertEqual(cidr, 24) 21 | 22 | def test_network_param_convert_fails(self): 23 | param = NetworkParamType() 24 | self.assertRaises(click.exceptions.BadParameter, 25 | lambda: param.convert('10.0.0.0//24', None, None)) 26 | self.assertRaises(click.exceptions.BadParameter, 27 | lambda: param.convert('10.0.0.0', None, None)) 28 | self.assertRaises(click.exceptions.BadParameter, 29 | lambda: param.convert('what is it', None, None)) 30 | self.assertRaises(click.exceptions.BadParameter, 31 | lambda: param.convert('10.0.0.0/hi', None, None)) 32 | -------------------------------------------------------------------------------- /tests/CLI/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/CLI/modules/__init__.py -------------------------------------------------------------------------------- /tests/CLI/modules/search_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.tests.CLI.modules.search_tests 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | :license: MIT, see LICENSE for more details. 6 | """ 7 | 8 | from SoftLayer import testing 9 | 10 | 11 | class SearchTests(testing.TestCase): 12 | 13 | def test_find(self): 14 | result = self.run_command(['search', '--types']) 15 | self.assert_called_with("SoftLayer_Search", "getObjectTypes") 16 | self.assert_no_fail(result) 17 | 18 | def test_find_advanced(self): 19 | result = self.run_command(['search', 'hardware', '--advanced']) 20 | self.assert_called_with("SoftLayer_Search", "advancedSearch", args=('hardware',)) 21 | self.assert_no_fail(result) 22 | 23 | def test_no_options(self): 24 | result = self.run_command(['search']) 25 | self.assertEqual(result.exit_code, 2) 26 | 27 | def test_find_single_item(self): 28 | result = self.run_command(['search', 'test.com']) 29 | self.assert_no_fail(result) 30 | self.assert_called_with("SoftLayer_Search", "search", args=('test.com',)) 31 | -------------------------------------------------------------------------------- /tests/CLI/modules/ssl_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.tests.CLI.modules.ssl_tests 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | :license: MIT, see LICENSE for more details. 5 | """ 6 | from SoftLayer import testing 7 | 8 | import json 9 | from unittest import mock as mock 10 | 11 | 12 | class SslTests(testing.TestCase): 13 | def test_list(self): 14 | result = self.run_command(['ssl', 'list', '--status', 'all']) 15 | self.assert_no_fail(result) 16 | self.assertEqual(json.loads(result.output), [ 17 | { 18 | "id": 1234, 19 | "common_name": "cert", 20 | "days_until_expire": 0, 21 | "notes": None 22 | } 23 | ]) 24 | 25 | @mock.patch('SoftLayer.CLI.formatting.no_going_back') 26 | def test_remove(self, confirm_mock): 27 | confirm_mock.return_value = True 28 | result = self.run_command(['ssl', 'remove', '123456']) 29 | self.assert_no_fail(result) 30 | self.assertEqual(result.exit_code, 0) 31 | 32 | def test_download(self): 33 | result = self.run_command(['ssl', 'download', '123456']) 34 | self.assert_no_fail(result) 35 | self.assertEqual(result.exit_code, 0) 36 | -------------------------------------------------------------------------------- /tests/CLI/modules/summary_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.tests.CLI.modules.summary_tests 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | :license: MIT, see LICENSE for more details. 6 | """ 7 | from SoftLayer import testing 8 | 9 | import json 10 | 11 | 12 | class SummaryTests(testing.TestCase): 13 | 14 | def test_summary(self): 15 | result = self.run_command(['summary']) 16 | 17 | expected = [ 18 | { 19 | 'datacenter': 'dal00', 20 | 'subnets': 0, 21 | 'hardware': 1, 22 | 'public_ips': 6, 23 | 'virtual_servers': 1, 24 | 'vlans': 3 25 | } 26 | ] 27 | 28 | self.assert_no_fail(result) 29 | self.assertEqual(json.loads(result.output), expected) 30 | -------------------------------------------------------------------------------- /tests/CLI/modules/vs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/CLI/modules/vs/__init__.py -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/__init__.py -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.basicConfig(level=logging.DEBUG) 4 | -------------------------------------------------------------------------------- /tests/managers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/managers/__init__.py -------------------------------------------------------------------------------- /tests/managers/bandwidth_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | SoftLayer.tests.managers.bandwidth_tests 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | """ 6 | from SoftLayer.managers.bandwidth import BandwidthManager as BandwidthManager 7 | from SoftLayer import testing 8 | 9 | 10 | class BandwidthManagerTests(testing.TestCase): 11 | 12 | def set_up(self): 13 | self.manager = BandwidthManager(self.client) 14 | 15 | def test_get_location_group(self): 16 | self.manager.get_location_group() 17 | _filter = { 18 | "locationGroupTypeId": { 19 | "operation": 1 20 | } 21 | } 22 | self.assert_called_with('SoftLayer_Location_Group', 'getAllObjects', filter=_filter) 23 | 24 | def test_create_pool(self): 25 | self.manager.create_pool(name_pool='New region', id_location_group=2) 26 | self.assert_called_with('SoftLayer_Network_Bandwidth_Version1_Allotment', 'createObject') 27 | -------------------------------------------------------------------------------- /tests/managers/vs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/managers/vs/__init__.py -------------------------------------------------------------------------------- /tests/resources/attachment_upload: -------------------------------------------------------------------------------- 1 | ticket attached data -------------------------------------------------------------------------------- /tests/transports/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softlayer/softlayer-python/39ee130ba6d1edd7fcbcfa41de524a6a341f2db9/tests/transports/__init__.py -------------------------------------------------------------------------------- /tools/requirements.txt: -------------------------------------------------------------------------------- 1 | prettytable >= 2.5.0 2 | click >= 8.0.4 3 | requests >= 2.32.2 4 | prompt_toolkit >= 2 5 | pygments >= 2.0.0 6 | urllib3 >= 1.24 7 | rich == 14.0.0 8 | # only used for soap transport 9 | # softlayer-zeep >= 5.0.0 10 | -------------------------------------------------------------------------------- /tools/test-requirements.txt: -------------------------------------------------------------------------------- 1 | tox 2 | coveralls 3 | pytest 4 | pytest-cov 5 | mock 6 | sphinx 7 | prettytable >= 2.5.0 8 | click >= 8.0.4 9 | requests >= 2.32.2 10 | prompt_toolkit >= 2 11 | pygments >= 2.0.0 12 | urllib3 >= 1.24 13 | rich >= 12.3.0 14 | # softlayer-zeep >= 5.0.0 15 | --------------------------------------------------------------------------------