日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

數據地址

更新時間:

本文介紹如何使用SDK調用數據地址相關的方法。

創建數據地址

以下示例代碼用于創建OSS類型的數據地址。

重要

創建OSS類型的數據地址前需要先進行角色配置,并獲取到角色(rolename)。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import CreateAddressRequest, CreateAddressInfo, AddressDetail
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        # 填寫數據地址名稱。
        address_name = "exampleaddress"
        address_type = "oss"
        # 以下參數請根據實際值填寫。
        region_id = "oss-cn-beijing"
        bucket = "examplebucket"
        prefix = "***/"
        role_name = "rolename_xxxxx"

        client.create_address(userid, CreateAddressRequest(CreateAddressInfo(
            name=address_name,
            address_detail=AddressDetail(
                address_type=address_type,
                bucket=bucket,
                region_id=region_id,
                prefix=prefix,
                role=role_name,
            )
        )))
    except Exception as e:
        print(e)

以下示例代碼用于創建Oss Inventory類型的數據地址。

重要

創建Oss Inventory類型的數據地址前需要先進行角色配置, 并獲取到角色和清單角色 (rolename 和 invrolename)。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import CreateAddressRequest, CreateAddressInfo, AddressDetail
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        address_type = "ossinv"
        # 以下參數請根據實際值填寫。
        prefix = "***/"
        region_id = "oss-cn-beijing"
        bucket = "examplebucket"
        role_name = "rolename_xxxxx"
        inv_location = "oss"
        inv_bucket = "exampleinvbucket"
        inv_region_id = "oss-cn-beijing"
        inv_role = "invrolename_*******"
        inv_path = "***/manifest.json"

        client.create_address(userid, CreateAddressRequest(CreateAddressInfo(
            name=address_name,
            address_detail=AddressDetail(
                address_type=address_type,
                bucket=bucket,
                region_id=region_id,
                prefix=prefix,
                role=role_name,
                inv_role=inv_role,
                inv_location=inv_location,
                inv_bucket=inv_bucket,
                inv_path=inv_path,
                inv_region_id=inv_region_id
            )
        )))
    except Exception as e:
        print(e)

以下示例代碼用于創建S3類型的數據地址。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import CreateAddressRequest, CreateAddressInfo, AddressDetail
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        address_type = "s3"
        # 以下參數請根據實際值填寫。
        access_id = "***"
        access_secret = "******"
        domain = "s3.ap-southeast-1.amazonaws.com"
        bucket = "examplebucket"
        prefix = "***/"

        client.create_address(userid, CreateAddressRequest(CreateAddressInfo(
            name=address_name,
            address_detail=AddressDetail(
                address_type=address_type,
                access_id=access_id,
                access_secret=access_secret,
                bucket=bucket,
                domain=domain,
                prefix=prefix
            )
        )))
    except Exception as e:
        print(e)

以下示例代碼用于創建HTTP類型的數據地址。

重要

創建HTTP類型的數據地址前需要先進行角色配置,并獲取到清單角色 (invrolename)。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import CreateAddressRequest, CreateAddressInfo, AddressDetail
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        address_type = "http"
        # 以下參數請根據實際值填寫。
        inv_domain = "oss-cn-beijing.aliyuncs.com"
        inv_bucket = "exampleinvbucket"
        inv_location = "oss"
        inv_path = "dir/manifest.json"
        inv_role = "invrolename_*******"

        client.create_address(userid, CreateAddressRequest(CreateAddressInfo(
            name=address_name,
            address_detail=AddressDetail(
                address_type=address_type,
                inv_domain=inv_domain,
                inv_location=inv_location,
                inv_path=inv_path,
                inv_role=inv_role,
                inv_bucket=inv_bucket
            )
        )))
    except Exception as e:
        print(e)

以下示例代碼用于創建LocalFS類型的數據地址。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import CreateAddressRequest, CreateAddressInfo, AddressDetail
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        address_type = "local"
        # 以下參數請根據實際值填寫。
        prefix = "/***/"

        client.create_address(userid, CreateAddressRequest(CreateAddressInfo(
            name=address_name,
            address_detail=AddressDetail(
                address_type=address_type,
                prefix=prefix
            )
        )))
    except Exception as e:
        print(e)

獲取數據地址詳情

以下示例代碼用于獲取數據地址詳情信息。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        response = client.get_address(userid, address_name)
        print(response.body.import_address)
    except Exception as e:
        print(e)

正常返回示例

{
  "ImportAddress": {
    "Owner": "test_owner",
    "Name": "test_name",
    "AddressDetail": {
      "AddressType": "ossinv",
      "Bucket": "test_bucket",
      "Domain": "test_domain",
      "Prefix": "test_prefix",
      "AccessId": "test_access_id",
      "AccessSecret": "test_secret_key",
      "Role": "test_role",
      "InvDomain": "test_inv_domain",
      "InvBucket": "test_inv_bucket",
      "InvAccessId": "test_inv_access_id",
      "InvAccessSecret": "test_inv_secret_key",
      "InvPath": "manifest.json",
      "InvRole": "test_inv_role",
      "InvLocation": "oss",
      "AgentList": "agent1,agent2",
      "RegionId": "test_region_id",
      "InvRegionId": "test_inv_region_id"
    },
    "CreateTime": "2024-05-01T12:00:00.000Z",
    "ModifyTime": "2024-05-01T12:00:00.000Z",
    "VerifyTime": "2024-05-01T12:00:00.000Z",
    "Version": "test_id",
    "Tags": "K1:V1,K2:V2",
    "Status": "avaliable",
    "VerifyResult": {
      "HttpCode": "400",
      "ErrorCode": "InvalidArgument",
      "ErrorMsg": "Invalid argument."
    }
  }
}

校驗數據地址

以下示例代碼用于驗證指定的數據地址是否可用。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        response = client.verify_address(userid, address_name)
        print(response.body)
    except Exception as e:
        print(e)
               

正常返回地址可用示例

{
  "VerifyAddressResponse": {
    "Status": "available",
    "VerifyTime": "2024-05-01T12:00:00.000Z",
    "ErrorCode": "",
    "ErrorMessage": ""
  }
}

正常返回地址不可用示例

{
  "VerifyAddressResponse": {
    "Status": "unavailable",
    "VerifyTime": "2024-05-01T12:00:00.000Z",
    "ErrorCode": "400",
    "ErrorMessage": "Invalid argument."
  }
}

列舉數據地址

以下示例代碼用于列舉賬號下所有數據地址信息。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import ListAddressRequest
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        # 根據實際填寫marker, count。
        count = 1
        marker = ""
        response = client.list_address(userid, ListAddressRequest(
            marker=marker,
            count=count,
        ))
        for import_address in response.body.import_address_list.import_address:
            print(import_address)
    except Exception as e:
        print(e)

正常返回示例

{
  "ImportAddressList": {
    "Truncated": true,
    "NextMarker": "test_marker",
    "ImportAddress": [
      {
        "Owner": "test_owner",
        "Name": "test_name",
        "AddressDetail": {
          "AddressType": "ossinv",
          "Bucket": "test_bucket",
          "Domain": "test_domain",
          "Prefix": "test_prefix",
          "AccessId": "test_access_id",
          "AccessSecret": "test_secret_key",
          "Role": "test_role",
          "InvDomain": "test_inv_domain",
          "InvBucket": "test_inv_bucket",
          "InvAccessId": "test_inv_access_id",
          "InvAccessSecret": "test_inv_secret_key",
          "InvPath": "manifest.json",
          "InvRole": "test_inv_role",
          "InvLocation": "oss",
          "AgentList": "agent1,agent2",
          "RegionId": "test_region_id",
          "InvRegionId": "test_inv_region_id"
        },
        "CreateTime": "2024-05-01T12:00:00.000Z",
        "ModifyTime": "2024-05-01T12:00:00.000Z",
        "VerifyTime": "2024-05-01T12:00:00.000Z",
        "Version": "test_id",
        "Tags": "K1:V1,K2:V2",
        "Status": "avaliable",
        "VerifyResult": {
          "HttpCode": "400",
          "ErrorCode": "InvalidArgument",
          "ErrorMsg": "Invalid argument."
        }
      }
    ]
  }
}

更新數據地址

以下示例代碼用于更新指定數據地址關聯的代理。

重要

至少需要填寫一個代理名稱,否則更新失敗。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_hcs_mgw20240626.models import UpdateAddressRequest, UpdateAddressInfo
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        # 填寫代理名稱列表,以,分隔, 不可為空。
        agent_list = "exampleagent1,exampleagent2"
        client.update_address(userid, address_name, UpdateAddressRequest(UpdateAddressInfo(
            agent_list=agent_list
        )))
    except Exception as e:
        print(e)

刪除數據地址

以下示例代碼刪除指定數據地址。

import os

from alibabacloud_hcs_mgw20240626.client import Client
from alibabacloud_tea_openapi.models import Config

if __name__ == "__main__":
    try:
        # 填寫主賬號ID。
        userid = "11470***876***55"
        # 這里以北京區域為例。
        endpoint = "cn-beijing.mgw.aliyuncs.com"
        config = Config(
            endpoint=endpoint,
            access_key_id=os.environ.get("OSS_ACCESS_KEY_ID"),
            access_key_secret=os.environ.get("OSS_ACCESS_KEY_SECRET"),
        )
        client = Client(config)

        address_name = "exampleaddress"
        client.delete_address(userid, address_name)
    except Exception as e:
        print(e)        

后續步驟

數據地址創建完成后,您可以選擇繼續執行創建任務操作。詳情請參見任務