Git Product home page Git Product logo

pycsm's Introduction

CSM Python Client

Build Status Documentation Status CII Best Practices

This repository contains the IBM Python client for RESTful communication to an IBM Copy Services Manager server. The Python client enables full management and monitoring of the replication and the components necessary for replication in a Copy Services Manager environment.

The repository provides two options for implementations.

  • Clients - The client classes are session_client.py, hardware_client.py, and system_client.py. These classes are designed to automatically obtain and manage a token to CSM for communication. A client class can be instantiated and then used to call the methods that perform the desired actions.
  • Services - The service classes are located under session_service, hardware_service, and system_service and can be used if the caller wishes to manage the connection and token themselves. These are the same classes that are called from the client classes.

Python Compatibility

The content in this collection supports Python 3.6 and higher

Installation

Communication to the Copy Services Manager server uses the RESTful interface and thus does not require an installation of client code.
Clone the repository, and then add it to your PYTHONPATH directory. The Python client is then ready for import and use.

The pyCSM library can also be installed using pip.

pip install pyCSM

Command Documentation

All commands, their usage and their parameters are documented on read the docs.

Usage examples

See documentation for examples on read the docs.

The CSM RESTful API

Details on the CSM RESTful API used by this python library can be found in the Knowledgecenter for the product.

Contributing

To contribute to this library, please see CONTRIBUTING.md and submit a contributor license agreement for either an individual or corporation, to those listed as maintainers here.

See cla-individual.doc or cla-corporate.doc for templates of the contributor license agreement.

License

All source files must include a Copyright and License header.

#
# (c) Copyright contributors to the pyCSM project
#

This project is licensed under the Apache License 2.0. Click here to obtain a copy of the License.

It is a permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

The examples are provided for tutorial purposes only. A complete handling of error conditions has not been shown or attempted, and the programs have not been submitted to formal IBM testing. The programs are distributed on an 'AS IS' basis without any warranties either expressed or implied.

If you would like to see the detailed LICENSE click here.

pycsm's People

Contributors

blearandy avatar dblea0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dblea00 ajinkyaaa

pycsm's Issues

Event log times returned by pyCSM.services.system_service.system_service.get_log_events are all the time the function was called.

All event log entries have the same time, the time that the function was called. It looks like the created date and event number may also be repeated across multiple entries while the timestamp value does appear to be correct.

                "createddate": 1660057409749,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409749,
                "id": 100321,
                "inserts": " Backup VM_lbsvm29_CDM_LBSFS5200A",
                "msgid": "IWNR1026I",
                "msgtype": 0,
                "resultText": "IWNR1026I [Aug 9, 2022 8:03:30 AM] The Backup command in the VM_lbsvm29_CDM_LBSFS5200A session completed.",
                "session": "VM_lbsvm29_CDM_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660035605464,
                "user": "Server"
            },
            {
                "createddate": 1660057409749,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409749,
                "id": 100320,
                "inserts": " VM_lbsvm29_CDM_LBSFS5200A 2022-08-09 01:59:58 MST 1660035600",
                "msgid": "IWNR2800I",
                "msgtype": 0,
                "resultText": "IWNR2800I [Aug 9, 2022 8:03:30 AM] A recoverable backup of all volumes in session VM_lbsvm29_CDM_LBSFS5200A was created at 2022-08-09 01:59:58 MST with an ID of 1660035600.",
                "session": "VM_lbsvm29_CDM_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660035600001,
                "user": "Server"
            },
            {
                "createddate": 1660057409749,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409749,
                "id": 100319,
                "inserts": " Backup VM_lbsvm29_CDM_LBSFS5200A",
                "msgid": "IWNR1028I",
                "msgtype": 0,
                "resultText": "IWNR1028I [Aug 9, 2022 8:03:30 AM] The Backup command in the VM_lbsvm29_CDM_LBSFS5200A session was issued.",
                "session": "VM_lbsvm29_CDM_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660035600002,
                "user": "Server"
            },
            {
                "createddate": 1660057409749,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409749,
                "id": 100318,
                "inserts": " Backup VM_lbsvm29_CDM with retention 2 using policy sgc_demo_policy and schedule 1",
                "msgid": "IWNR2211I",
                "msgtype": 0,
                "resultText": "IWNR2211I [Aug 9, 2022 8:03:30 AM] The scheduled task Backup VM_lbsvm29_CDM with retention 2 using policy sgc_demo_policy and schedule 1 has started running.",
                "session": null,
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660035600000,
                "user": "Server"
            },
            {
                "createddate": 1660057409749,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409749,
                "id": 100317,
                "inserts": " 2022-08-07 01:00:05 MST VM_lbssoar_LBSFS5200A",
                "msgid": "IWNR2850W",
                "msgtype": 1,
                "resultText": "IWNR2850W [Aug 9, 2022 8:03:30 AM] The backup created at 2022-08-07 01:00:05 MST has expired on the hardware for session VM_lbssoar_LBSFS5200A.",
                "session": "VM_lbssoar_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660033795383,
                "user": "Server"
            },
            {
                "createddate": 1660057409750,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409750,
                "id": 100313,
                "inserts": " VM_lbssoar_LBSFS5200A 2022-08-09 01:00:00 MST 1660032000",
                "msgid": "IWNR2800I",
                "msgtype": 0,
                "resultText": "IWNR2800I [Aug 9, 2022 8:03:30 AM] A recoverable backup of all volumes in session VM_lbssoar_LBSFS5200A was created at 2022-08-09 01:00:00 MST with an ID of 1660032000.",
                "session": "VM_lbssoar_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660032000002,
                "user": "Server"
            },
            {
                "createddate": 1660057409750,
                "eventfilter": "com.ibm.csm.common.events.LogEvent",
                "eventnumber": 1660057409750,
                "id": 100312,
                "inserts": " Backup VM_lbssoar_LBSFS5200A",
                "msgid": "IWNR1028I",
                "msgtype": 0,
                "resultText": "IWNR1028I [Aug 9, 2022 8:03:30 AM] The Backup command in the VM_lbssoar_LBSFS5200A session was issued.",
                "session": "VM_lbssoar_LBSFS5200A",
                "time": "Tue Aug 09 08:03:29 MST 2022",
                "timestamp": 1660032000003,
                "user": "Server"
            },

service and client wait_for_state functions do not work - minor fixes

Tested on pyCSM version 1.0.1.

For the service the traceback is:
File "/usr/local/lib/python3.10/site-packages/pyCSM/clients/session_client.py", line 236, in wait_for_state result_dict = session_service.wait_for_state(self.base_url, self.tk, File "/usr/local/lib/python3.10/site-packages/pyCSM/services/session_service/session_service.py", line 276, in wait_for_state resp = get_session_info(url, tk, ses_name, verify=properties["verify"], cert=properties["cert"]) TypeError: get_session_info() got an unexpected keyword argument 'verify'

File "pyCSM/services/session_service/session_service.py", line 276, needs to change to:
resp = get_session_info(url, tk, ses_name)

For the client the traceback is:
File "/usr/local/lib/python3.10/site-packages/pyCSM/clients/session_client.py", line 239, in wait_for_state if resp.status_code == 401: AttributeError: 'bool' object has no attribute 'status_code'

File "pyCSM/clients/session_client.py", line 238, needs to change to:
resp = result_dict["session_info"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.