hpecp-python-library icon indicating copy to clipboard operation
hpecp-python-library copied to clipboard

Implement datatap module

Open snowch opened this issue 5 years ago • 3 comments

EPIC - some api examples here: https://github.com/bluedatainc/solutions/blob/master/APIs/v1_bluedata_apis_doc.md#10-create-a-cluster-datatap

snowch avatar Aug 20 '20 12:08 snowch

	# The datatap needs to be created as a tenant administrator, not as global admin
	cat > ~/.hpecp.conf <<-CAT_EOF
		[default]
		api_host = ${CTRL_PRV_IP}
		api_port = 8080
		use_ssl = ${INSTALL_WITH_SSL}
		verify_ssl = False
		warn_ssl = False
		[tenant2]
		tenant   = /api/v1/tenant/2
		username = ad_admin1
		password = pass123
	CAT_EOF
	cat >datatap.json<<-JSON_EOF
		{
		  "bdfs_root": {
		    "path_from_endpoint": "${MAPR_VMNT}"
		  },
		  "endpoint": {
		    "cluster_name": "${MAPR_CLUSTER_NAME}",
		    "ticket": "${MAPR_TCKT}",
		    "type": "mapr",
		    "secure": true,
		    "cldb": [
		      "${MAPR_CLUSTER1_HOSTS_PRV_IPS[0]}", "${MAPR_CLUSTER1_HOSTS_PRV_IPS[1]}"
		    ],
		    "ticket_type": "servicewithimpersonation",
		    "ticket_user": "${MAPR_USER}",
		    "mapr_tenant_volume": false,
		    "impersonation_enabled": true
		  },
		  "flags": {
		    "read_only": false
		  },
		  "label": {
		    "name": "${MAPR_DTAP_NAME}",
		    "description": "mapr standalone volume"
		  }
		}
	JSON_EOF
	cat datatap.json
	PROFILE=tenant2 hpecp httpclient post /api/v1/dataconn --json-file datatap.json

snowch avatar Aug 20 '20 12:08 snowch

POST /api/v1/dataconn/ HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 460
Accept-Encoding: gzip, deflate
REMOTE_ADDR: 192.168.1.249
Accept: */*
User-Agent: python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-1127.13.1.el7.x86_64
Connection: keep-alive
X-BDS-SESSION: /api/v2/session/dc67ddaa-f544-43f9-a774-18515b7d5c63
Content-Type: application/json
Authorization: /api/v2/session/dc67ddaa-f544-43f9-a774-18515b7d5c63

{
  "bdfs_root": {
    "path_from_endpoint": "/datatap-poc-pe"
  },
  "endpoint": {
    "kdc_data": [
      {
        "host": "kdc-host.jear.co",
        "port": 8888
      }
    ],
    "realm": "realm",
    "client_principal": "client-principal",
    "browse_only": false,
    "host": "remote-hdp265.jear.co",
    "keytab": "concourse.json",
    "service_id": "hdfs",
    "backup_host": "standby-hdp265.jear.co",
    "type": "hdfs",
    "port": "7777"
  },
  "flags": {
    "read_only": true
  },
  "label": {
    "name": "datatap-jear",
    "description": "datatap-jear"
  }
}

HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: *
Content-Length: 106
Content-Type: text/plain
Date: Thu, 20 Aug 2020 14:19:58 GMT
Server: HPE Ezmeral Container Platform 5.1

403 Forbidden: 
endpoint: Validation failed for proposed DataTap with the Kerberos credentials provided.

jear avatar Aug 20 '20 14:08 jear

List data:

{
  "_links": {
    "self": {
      "href": "/api/v1/dataconn"
    }
  },
  "_embedded": {
    "data_connectors": [
      {
        "_links": {
          "self": {
            "href": "/api/v1/dataconn/2"
          },
          "query": {
            "href": "/api/v1/dataconn/2{?query}",
            "templated": true
          }
        },
        "_embedded": {
          "label": {
            "_links": {
              "self": {
                "href": "/api/v1/dataconn/2?label"
              }
            },
            "name": "TenantStorage",
            "description": "Protected DataTap for a tenant-specific sandboxed storage space."
          },
          "endpoint": {
            "_links": {
              "self": {
                "href": "/api/v1/dataconn/2?endpoint"
              }
            },
            "type": "mapr",
            "cluster_name": "hcp.mapr.cluster",
            "cldb": [
              "ip-10-1-0-6.us-west-2.compute.internal"
            ],
            "secure": true,
            "ticket": "hcp-service-ticket",
            "ticket_type": "service",
            "ticket_user": "mapr",
            "mapr_tenant_volume": false,
            "impersonation_enabled": false
          },
          "bdfs_root": {
            "_links": {
              "self": {
                "href": "/api/v1/dataconn/2?bdfs_root"
              }
            },
            "path_from_endpoint": "/hcp/tenant-2/dco"
          },
          "flags": {
            "_links": {
              "self": {
                "href": "/api/v1/dataconn/2?flags"
              }
            },
            "read_only": false
          },
          "is_protected": true,
          "status": "created"
        }
      }
    ]
  }
}

snowch avatar Aug 20 '20 18:08 snowch