diff --git a/docs/obs_3rd_party/dotnet_sdk/ALL_META.TXT.json b/docs/obs_3rd_party/dotnet_sdk/ALL_META.TXT.json new file mode 100644 index 000000000..68dcf85dd --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/ALL_META.TXT.json @@ -0,0 +1,2003 @@ +[ + { + "dockw":"Developer Guide (.NET SDK)" + }, + { + "uri":"obs_25_0000.html", + "node_id":"obs_25_0000.xml", + "product_code":"obs", + "code":"1", + "des":"This section describes version compatibility and important notes about Object Storage Service (OBS) SDK for .NET.Recommended .NET versions: .NET Framework 3.5, 4.0, or 4.", + "doc_type":"sdk-dotnet-devg", + "kw":"Before You Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Before You Start", + "githuburl":"" + }, + { + "uri":"obs_25_0001.html", + "node_id":"obs_25_0001.xml", + "product_code":"obs", + "code":"2", + "des":"Latest version of OBS .NET SDK source code: Download", + "doc_type":"sdk-dotnet-devg", + "kw":"SDK Download Links,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"SDK Download Links", + "githuburl":"" + }, + { + "uri":"obs_25_0100.html", + "node_id":"obs_25_0100.xml", + "product_code":"obs", + "code":"3", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Quick Start", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Quick Start", + "githuburl":"" + }, + { + "uri":"obs_25_0103.html", + "node_id":"obs_25_0103.xml", + "product_code":"obs", + "code":"4", + "des":"Access keys consist of two parts: an access key ID (AK) and a secret access key (SK). OBS uses access keys to sign requests to make sure that only authorized accounts can", + "doc_type":"sdk-dotnet-devg", + "kw":"Creating an AK and SK,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Creating an AK and SK", + "githuburl":"" + }, + { + "uri":"obs_25_0105.html", + "node_id":"obs_25_0105.xml", + "product_code":"obs", + "code":"5", + "des":"Installing the OBS .NET SDK. The example here uses the latest version.", + "doc_type":"sdk-dotnet-devg", + "kw":"Installing the SDK,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Installing the SDK", + "githuburl":"" + }, + { + "uri":"obs_25_0106.html", + "node_id":"obs_25_0106.xml", + "product_code":"obs", + "code":"6", + "des":"You can click here to view the endpoints and regions enabled for OBS.The SDK allows you to pass endpoints with or without the protocol name. Suppose the endpoint you obta", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Endpoints,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Endpoints", + "githuburl":"" + }, + { + "uri":"obs_25_0107.html", + "node_id":"obs_25_0107.xml", + "product_code":"obs", + "code":"7", + "des":"Each time you want to send an HTTP/HTTPS request to OBS, you must create an instance of ObsClient. Sample code is as follows:For more information, see chapter \"Initializa", + "doc_type":"sdk-dotnet-devg", + "kw":"Initializing an Instance of ObsClient,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Initializing an Instance of ObsClient", + "githuburl":"" + }, + { + "uri":"obs_25_0108.html", + "node_id":"obs_25_0108.xml", + "product_code":"obs", + "code":"8", + "des":"A bucket is a global namespace of OBS and is a data container. It functions as a root directory of a file system and can store objects. The following code shows how to cr", + "doc_type":"sdk-dotnet-devg", + "kw":"Creating a Bucket,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Creating a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0109.html", + "node_id":"obs_25_0109.xml", + "product_code":"obs", + "code":"9", + "des":"This example uploads string Hello OBS to bucket bucketname as object objectname.The example code is as follows:For more information, see Object Upload Overview.", + "doc_type":"sdk-dotnet-devg", + "kw":"Uploading an Object,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Uploading an Object", + "githuburl":"" + }, + { + "uri":"obs_25_0110.html", + "node_id":"obs_25_0110.xml", + "product_code":"obs", + "code":"10", + "des":"This example downloads object objectname from bucket bucketname.The example code is as follows:For more information, see Object Download Overview.", + "doc_type":"sdk-dotnet-devg", + "kw":"Downloading an Object,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Downloading an Object", + "githuburl":"" + }, + { + "uri":"obs_25_0111.html", + "node_id":"obs_25_0111.xml", + "product_code":"obs", + "code":"11", + "des":"After objects are uploaded, you may want to view the objects contained in a bucket. Sample code is as follows:You can call ListObjectsResponse.ObsObjects to obtain the de", + "doc_type":"sdk-dotnet-devg", + "kw":"Listing Objects,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Listing Objects", + "githuburl":"" + }, + { + "uri":"obs_25_0112.html", + "node_id":"obs_25_0112.xml", + "product_code":"obs", + "code":"12", + "des":"This example deletes object objectname from bucket bucketname.The example code is as follows:This example only deletes a single object. To delete objects in a batch, trav", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting an Object,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting an Object", + "githuburl":"" + }, + { + "uri":"obs_25_0113.html", + "node_id":"obs_25_0113.xml", + "product_code":"obs", + "code":"13", + "des":"When you call an API using an instance of ObsClient, if no exception is thrown, the return value is valid, and a sub-class instance of ObsWebServiceResponse (SDK common r", + "doc_type":"sdk-dotnet-devg", + "kw":"General Examples of ObsClient,Quick Start,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"General Examples of ObsClient", + "githuburl":"" + }, + { + "uri":"obs_25_0200.html", + "node_id":"obs_25_0200.xml", + "product_code":"obs", + "code":"14", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Initialization", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Initialization", + "githuburl":"" + }, + { + "uri":"obs_25_0201.html", + "node_id":"obs_25_0201.xml", + "product_code":"obs", + "code":"15", + "des":"To use OBS, you need a valid pair of AK and SK for signature authentication.For details, see Creating an AK and SK.After obtaining the AK/SK pair, you can start initializ", + "doc_type":"sdk-dotnet-devg", + "kw":"Configuring the AK/SK,Initialization,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Configuring the AK/SK", + "githuburl":"" + }, + { + "uri":"obs_25_0202.html", + "node_id":"obs_25_0202.xml", + "product_code":"obs", + "code":"16", + "des":"ObsClient functions as the .NET client for accessing OBS. It offers callers a series of APIs for interaction with OBS and is used for managing and operating resources, su", + "doc_type":"sdk-dotnet-devg", + "kw":"Creating an Instance of ObsClient,Initialization,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Creating an Instance of ObsClient", + "githuburl":"" + }, + { + "uri":"obs_25_0203.html", + "node_id":"obs_25_0203.xml", + "product_code":"obs", + "code":"17", + "des":"When you call the ObsConfig configuration class to create an instance of ObsClient, you can configure the agent, timeout duration, maximum allowed number of connections, ", + "doc_type":"sdk-dotnet-devg", + "kw":"Configuring an Instance of ObsClient,Initialization,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Configuring an Instance of ObsClient", + "githuburl":"" + }, + { + "uri":"obs_25_0204.html", + "node_id":"obs_25_0204.xml", + "product_code":"obs", + "code":"18", + "des":"OBS .NET SDK provides the logging function, based on the Apache Log4net open library. You can add log configuration files to enable the logging function. The procedure is", + "doc_type":"sdk-dotnet-devg", + "kw":"Configuring SDK Logging,Initialization,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Configuring SDK Logging", + "githuburl":"" + }, + { + "uri":"obs_25_0300.html", + "node_id":"obs_25_0300.xml", + "product_code":"obs", + "code":"19", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Bucket Management", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Bucket Management", + "githuburl":"" + }, + { + "uri":"obs_25_0301.html", + "node_id":"obs_25_0301.xml", + "product_code":"obs", + "code":"20", + "des":"You can call ObsClient.CreateBucket to create a bucket.When creating a bucket, you can specify the ACL, storage class, and location for the bucket. OBS provides three sto", + "doc_type":"sdk-dotnet-devg", + "kw":"Creating a Bucket,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Creating a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0302.html", + "node_id":"obs_25_0302.xml", + "product_code":"obs", + "code":"21", + "des":"You can call ObsClient.ListBuckets to list buckets. Sample code is as follows:Obtained bucket names are listed in the lexicographical order.Set ListBucketsRequest.IsQuery", + "doc_type":"sdk-dotnet-devg", + "kw":"Listing Buckets,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Listing Buckets", + "githuburl":"" + }, + { + "uri":"obs_25_0303.html", + "node_id":"obs_25_0303.xml", + "product_code":"obs", + "code":"22", + "des":"You can call ObsClient.DeleteBucket to delete a bucket. Sample code is as follows:Only empty buckets (without objects and part fragments) can be deleted.Bucket deletion i", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting a Bucket,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0304.html", + "node_id":"obs_25_0304.xml", + "product_code":"obs", + "code":"23", + "des":"You can call ObsClient.HeadBucket to identify whether a bucket exists.This example checks whether bucket bucketname exists.The example code is as follows:If an exception ", + "doc_type":"sdk-dotnet-devg", + "kw":"Identifying Whether a Bucket Exists,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Identifying Whether a Bucket Exists", + "githuburl":"" + }, + { + "uri":"obs_25_0305.html", + "node_id":"obs_25_0305.xml", + "product_code":"obs", + "code":"24", + "des":"You can call ObsClient.GetBucketMetadata to obtain the metadata of a bucket.This example returns the metadata of bucket bucketname.The example code is as follows:To handl", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Bucket Metadata,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Bucket Metadata", + "githuburl":"" + }, + { + "uri":"obs_25_0306.html", + "node_id":"obs_25_0306.xml", + "product_code":"obs", + "code":"25", + "des":"Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over r", + "doc_type":"sdk-dotnet-devg", + "kw":"Managing Bucket ACLs,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Managing Bucket ACLs", + "githuburl":"" + }, + { + "uri":"obs_25_0307.html", + "node_id":"obs_25_0307.xml", + "product_code":"obs", + "code":"26", + "des":"Besides bucket ACLs, bucket owners can use bucket policies to centrally control access to buckets and objects in buckets.For more information, see Bucket Policies.You can", + "doc_type":"sdk-dotnet-devg", + "kw":"Management Bucket Policies,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Management Bucket Policies", + "githuburl":"" + }, + { + "uri":"obs_25_0308.html", + "node_id":"obs_25_0308.xml", + "product_code":"obs", + "code":"27", + "des":"You can call ObsClient.GetBucketLocation to obtain the location of a bucket.This example returns the region of bucket bucketname.The example code is as follows:When creat", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining a Bucket Location,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining a Bucket Location", + "githuburl":"" + }, + { + "uri":"obs_25_0309.html", + "node_id":"obs_25_0309.xml", + "product_code":"obs", + "code":"28", + "des":"The storage information about a bucket includes the used capacity of and the number of objects in the bucket.You can call ObsClient.GetBucketStorageInfo to obtain the buc", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Storage Information About a Bucket,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Storage Information About a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0310.html", + "node_id":"obs_25_0310.xml", + "product_code":"obs", + "code":"29", + "des":"You can call ObsClient.SetBucketQuota to set the bucket quota. Sample code is as follows:A bucket quota must be a non-negative integer expressed in bytes. The maximum val", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting or Obtaining a Bucket Quota,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting or Obtaining a Bucket Quota", + "githuburl":"" + }, + { + "uri":"obs_25_0311.html", + "node_id":"obs_25_0311.xml", + "product_code":"obs", + "code":"30", + "des":"OBS allows you to set storage classes for buckets. The storage class of an object defaults to be that of its residing bucket. Different storage classes meet different nee", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting or Obtaining the Storage Class of a Bucket,Bucket Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting or Obtaining the Storage Class of a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0400.html", + "node_id":"obs_25_0400.xml", + "product_code":"obs", + "code":"31", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Object Upload", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Object Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0401.html", + "node_id":"obs_25_0401.xml", + "product_code":"obs", + "code":"32", + "des":"In OBS, objects are basic data units that users can perform operations on. OBS .NET SDK provides abundant APIs for object upload in the following methods:Performing a Str", + "doc_type":"sdk-dotnet-devg", + "kw":"Object Upload Overview,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Object Upload Overview", + "githuburl":"" + }, + { + "uri":"obs_25_0402.html", + "node_id":"obs_25_0402.xml", + "product_code":"obs", + "code":"33", + "des":"Streaming upload uses System.IO.Stream as the data source of an object. You can call ObsClient.PutObject to upload the data streams to OBS. Sample code is as follows:To u", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Streaming Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Streaming Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0403.html", + "node_id":"obs_25_0403.xml", + "product_code":"obs", + "code":"34", + "des":"File-based upload uses local files as the data source of objects.This example uploads local file localfile to bucket bucketname as object objectname.The example code is a", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a File-Based Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a File-Based Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0404.html", + "node_id":"obs_25_0404.xml", + "product_code":"obs", + "code":"35", + "des":"You can call ObsClient.BeginPutObject and ObsClient.EndPutObject to upload an object asynchronously.This example asynchronously uploads local file localfile to bucket buc", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing an Asynchronous Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing an Asynchronous Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0405.html", + "node_id":"obs_25_0405.xml", + "product_code":"obs", + "code":"36", + "des":"You can call PutObjectRequest.UploadProgress to register a System.EventHandler callback function to obtain upload progress.This example uploads local file localfile to bu", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Upload Progress,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Upload Progress", + "githuburl":"" + }, + { + "uri":"obs_25_0406.html", + "node_id":"obs_25_0406.xml", + "product_code":"obs", + "code":"37", + "des":"There is no folder concept in OBS. All elements in buckets are objects. To create a folder in OBS is essentially to create an object whose size is 0 and whose name ends w", + "doc_type":"sdk-dotnet-devg", + "kw":"Creating a Folder,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Creating a Folder", + "githuburl":"" + }, + { + "uri":"obs_25_0407.html", + "node_id":"obs_25_0407.xml", + "product_code":"obs", + "code":"38", + "des":"You can set properties for an object when uploading it. Object properties include the MIME type, MD5 value (for verification), storage class, and customized metadata. You", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting Object Properties,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting Object Properties", + "githuburl":"" + }, + { + "uri":"obs_25_0408.html", + "node_id":"obs_25_0408.xml", + "product_code":"obs", + "code":"39", + "des":"To upload a large file, multipart upload is recommended. Multipart upload is applicable to many scenarios, including:Files to be uploaded are larger than 100 MB.The netwo", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Multipart Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Multipart Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0409.html", + "node_id":"obs_25_0409.xml", + "product_code":"obs", + "code":"40", + "des":"When uploading an object or initializing a multipart upload, you can directly set the expiration time for the object. Sample code is as follows:The previous mode specifie", + "doc_type":"sdk-dotnet-devg", + "kw":"Configuring Lifecycle Management,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Configuring Lifecycle Management", + "githuburl":"" + }, + { + "uri":"obs_25_0410.html", + "node_id":"obs_25_0410.xml", + "product_code":"obs", + "code":"41", + "des":"Appendable upload allows you to upload an object in appendable mode and then append data to the object. You can call ObsClient.AppendObject to perform an appendable uploa", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing an Appendable Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing an Appendable Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0411.html", + "node_id":"obs_25_0411.xml", + "product_code":"obs", + "code":"42", + "des":"As a special case of multipart upload, multipart copy implements multipart upload by copying the whole or part of an object in a bucket. You can call ObsClient.CopyPart t", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Multipart Copy,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Multipart Copy", + "githuburl":"" + }, + { + "uri":"obs_25_0412.html", + "node_id":"obs_25_0412.xml", + "product_code":"obs", + "code":"43", + "des":"Uploading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the upload process upon an upload failure, a", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Resumable Upload,Object Upload,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Resumable Upload", + "githuburl":"" + }, + { + "uri":"obs_25_0500.html", + "node_id":"obs_25_0500.xml", + "product_code":"obs", + "code":"44", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Object Download", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Object Download", + "githuburl":"" + }, + { + "uri":"obs_25_0501.html", + "node_id":"obs_25_0501.xml", + "product_code":"obs", + "code":"45", + "des":"OBS .NET SDK provides abundant APIs for downloading objects in the following modes:Performing a Streaming DownloadPerforming a Partial DownloadPerforming an Asynchronous ", + "doc_type":"sdk-dotnet-devg", + "kw":"Object Download Overview,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Object Download Overview", + "githuburl":"" + }, + { + "uri":"obs_25_0502.html", + "node_id":"obs_25_0502.xml", + "product_code":"obs", + "code":"46", + "des":"Sample code:GetObjectResponse.OutputStream (System.IO.Stream type) is the response stream in GetObjectResponse. You can obtain the object content to a local file or memor", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Streaming Download,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Streaming Download", + "githuburl":"" + }, + { + "uri":"obs_25_0503.html", + "node_id":"obs_25_0503.xml", + "product_code":"obs", + "code":"47", + "des":"When only partial data of an object is required, you can download data falling within a specific range.If the specified range is from 0 to 1,000, data from byte 0 to byte", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Partial Download,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Partial Download", + "githuburl":"" + }, + { + "uri":"obs_25_0504.html", + "node_id":"obs_25_0504.xml", + "product_code":"obs", + "code":"48", + "des":"You can call ObsClient.BeginGetObject and ObsClient.EndGetObject to download an object asynchronously.This example downloads object objectname from bucket bucketname asyn", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing an Asynchronous Download,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing an Asynchronous Download", + "githuburl":"" + }, + { + "uri":"obs_25_0505.html", + "node_id":"obs_25_0505.xml", + "product_code":"obs", + "code":"49", + "des":"You can call GetObjectRequest.DownloadProgress to register the System.EventHandler callback function to obtain download progress.This example downloads objectname from bu", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Download Progress,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Download Progress", + "githuburl":"" + }, + { + "uri":"obs_25_0506.html", + "node_id":"obs_25_0506.xml", + "product_code":"obs", + "code":"50", + "des":"When downloading an object, you can specify one or more conditions. Only when the conditions are met, the object will be downloaded. Otherwise, an exception indicating a ", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Conditioned Download,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Conditioned Download", + "githuburl":"" + }, + { + "uri":"obs_25_0507.html", + "node_id":"obs_25_0507.xml", + "product_code":"obs", + "code":"51", + "des":"When downloading an object, you can rewrite some HTTP/HTTPS response headers. The following table lists rewritable response headers.Sample code:// Initialize configuratio", + "doc_type":"sdk-dotnet-devg", + "kw":"Rewriting Response Headers,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Rewriting Response Headers", + "githuburl":"" + }, + { + "uri":"obs_25_0508.html", + "node_id":"obs_25_0508.xml", + "product_code":"obs", + "code":"52", + "des":"After an object is successfully downloaded, its custom data is returned.This example obtains the custom metadata of objectname in bucketname.The example code is as follow", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Custom Metadata,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Custom Metadata", + "githuburl":"" + }, + { + "uri":"obs_25_0509.html", + "node_id":"obs_25_0509.xml", + "product_code":"obs", + "code":"53", + "des":"Before you can download a Cold object, you must restore it. Cold objects can be restored in either of the following ways.To prolong the validity period of the Cold data r", + "doc_type":"sdk-dotnet-devg", + "kw":"Downloading a Cold Object,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Downloading a Cold Object", + "githuburl":"" + }, + { + "uri":"obs_25_0510.html", + "node_id":"obs_25_0510.xml", + "product_code":"obs", + "code":"54", + "des":"Downloading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the download process upon a download failu", + "doc_type":"sdk-dotnet-devg", + "kw":"Performing a Resumable Download,Object Download,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Performing a Resumable Download", + "githuburl":"" + }, + { + "uri":"obs_25_0600.html", + "node_id":"obs_25_0600.xml", + "product_code":"obs", + "code":"55", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Object Management", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Object Management", + "githuburl":"" + }, + { + "uri":"obs_25_0601.html", + "node_id":"obs_25_0601.xml", + "product_code":"obs", + "code":"56", + "des":"You can call ObsClient.GetObjectMetadata to obtain object properties, including the last modification time, version ID, and customized metadata. Sample code is as follows", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining Object Properties,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining Object Properties", + "githuburl":"" + }, + { + "uri":"obs_25_0602.html", + "node_id":"obs_25_0602.xml", + "product_code":"obs", + "code":"57", + "des":"Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over r", + "doc_type":"sdk-dotnet-devg", + "kw":"Managing Object ACLs,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Managing Object ACLs", + "githuburl":"" + }, + { + "uri":"obs_25_0603.html", + "node_id":"obs_25_0603.xml", + "product_code":"obs", + "code":"58", + "des":"You can call ObsClient.ListObjects to list objects in a bucket.The following table describes the parameters involved in this API.The following sample code shows how to li", + "doc_type":"sdk-dotnet-devg", + "kw":"Listing Objects,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Listing Objects", + "githuburl":"" + }, + { + "uri":"obs_25_0604.html", + "node_id":"obs_25_0604.xml", + "product_code":"obs", + "code":"59", + "des":"Exercise caution when performing this operation. If the versioning function is disabled for the bucket where the object is located, the object cannot be restored after be", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting Objects,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting Objects", + "githuburl":"" + }, + { + "uri":"obs_25_0605.html", + "node_id":"obs_25_0605.xml", + "product_code":"obs", + "code":"60", + "des":"The object copy operation can create a copy for an existing object in OBS.You can call ObsClient.CopyObject to copy an object. When copying an object, you can specify pro", + "doc_type":"sdk-dotnet-devg", + "kw":"Copying an Object,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Copying an Object", + "githuburl":"" + }, + { + "uri":"obs_25_0606.html", + "node_id":"obs_25_0606.xml", + "product_code":"obs", + "code":"61", + "des":"You can call ObsClient.HeadObject to check whether a specified object exists.The example code is as follows:If an exception is thrown and the returned HTTP status code is", + "doc_type":"sdk-dotnet-devg", + "kw":"HEAD Object,Object Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"HEAD Object", + "githuburl":"" + }, + { + "uri":"obs_25_0700.html", + "node_id":"obs_25_0700.xml", + "product_code":"obs", + "code":"62", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Temporarily Authorized Access", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Temporarily Authorized Access", + "githuburl":"" + }, + { + "uri":"obs_25_0701.html", + "node_id":"obs_25_0701.xml", + "product_code":"obs", + "code":"63", + "des":"ObsClient allows you to create a URL whose Query parameters are carried with authentication information by specifying the AK and SK, HTTP method, and request parameters. ", + "doc_type":"sdk-dotnet-devg", + "kw":"Using a Temporary URL for Authorized Access,Temporarily Authorized Access,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Using a Temporary URL for Authorized Access", + "githuburl":"" + }, + { + "uri":"obs_25_0800.html", + "node_id":"obs_25_0800.xml", + "product_code":"obs", + "code":"64", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Versioning Management", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Versioning Management", + "githuburl":"" + }, + { + "uri":"obs_25_0801.html", + "node_id":"obs_25_0801.xml", + "product_code":"obs", + "code":"65", + "des":"You can use versioning to store multiple versions of an object in a bucket.When versioning is enabled for a bucket, OBS keeps multiple versions of an object in the bucket", + "doc_type":"sdk-dotnet-devg", + "kw":"Versioning Overview,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Versioning Overview", + "githuburl":"" + }, + { + "uri":"obs_25_0802.html", + "node_id":"obs_25_0802.xml", + "product_code":"obs", + "code":"66", + "des":"You can call ObsClient.SetBucketVersioning to set the versioning status for a bucket. OBS supports two versioning statuses.Sample code:", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting Versioning Status for a Bucket,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting Versioning Status for a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0803.html", + "node_id":"obs_25_0803.xml", + "product_code":"obs", + "code":"67", + "des":"You can call ObsClient.GetBucketVersioning to view the versioning status of a bucket.This example obtains the versioning status of bucket bucketname.The example code is a", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing Versioning Status of a Bucket,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing Versioning Status of a Bucket", + "githuburl":"" + }, + { + "uri":"obs_25_0804.html", + "node_id":"obs_25_0804.xml", + "product_code":"obs", + "code":"68", + "des":"You can call ObsClient.GetObject to obtain an object version by specifying the version ID (VersionId).This example downloads object objectname from bucket bucketname by s", + "doc_type":"sdk-dotnet-devg", + "kw":"Obtaining a Versioning Object,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Obtaining a Versioning Object", + "githuburl":"" + }, + { + "uri":"obs_25_0805.html", + "node_id":"obs_25_0805.xml", + "product_code":"obs", + "code":"69", + "des":"You can call ObsClient.CopyObject to copy an object version by specifying the version ID (SourceVersionId).This example specifies SourceVersionId to copy sourceobjectname", + "doc_type":"sdk-dotnet-devg", + "kw":"Copying a Versioning Object,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Copying a Versioning Object", + "githuburl":"" + }, + { + "uri":"obs_25_0806.html", + "node_id":"obs_25_0806.xml", + "product_code":"obs", + "code":"70", + "des":"You can call ObsClient.RestoreObject to restore a Cold object version by specifying VersionId.This example specifies versionId to restore Cold object destobjectname in de", + "doc_type":"sdk-dotnet-devg", + "kw":"Restoring a Specific Cold Object Version,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Restoring a Specific Cold Object Version", + "githuburl":"" + }, + { + "uri":"obs_25_0807.html", + "node_id":"obs_25_0807.xml", + "product_code":"obs", + "code":"71", + "des":"You can call ObsClient.ListVersions to list versioning objects.The following table describes the parameters involved in this API.If the value of VersionIdMarker is not a ", + "doc_type":"sdk-dotnet-devg", + "kw":"Listing Versioning Objects,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Listing Versioning Objects", + "githuburl":"" + }, + { + "uri":"obs_25_0808.html", + "node_id":"obs_25_0808.xml", + "product_code":"obs", + "code":"72", + "des":"You can call ObsClient.SetObjectAcl to pass the version ID (VersionId) to set an ACL for an object version. Sample code is as follows:The owner or grantee ID needed in th", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting or Obtaining a Versioning Object ACL,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting or Obtaining a Versioning Object ACL", + "githuburl":"" + }, + { + "uri":"obs_25_0809.html", + "node_id":"obs_25_0809.xml", + "product_code":"obs", + "code":"73", + "des":"You can call ObsClient.DeleteObject to pass a version ID (VersionId) to delete an object version.This example deletes object objectname from bucket bucketname by specifyi", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting Versioning Objects,Versioning Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting Versioning Objects", + "githuburl":"" + }, + { + "uri":"obs_25_0900.html", + "node_id":"obs_25_0900.xml", + "product_code":"obs", + "code":"74", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Lifecycle Management", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Lifecycle Management", + "githuburl":"" + }, + { + "uri":"obs_25_0901.html", + "node_id":"obs_25_0901.xml", + "product_code":"obs", + "code":"75", + "des":"OBS allows you to set lifecycle rules for buckets to automatically transition the storage class of an object and delete expired objects, to effectively use storage featur", + "doc_type":"sdk-dotnet-devg", + "kw":"Lifecycle Management Overview,Lifecycle Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Lifecycle Management Overview", + "githuburl":"" + }, + { + "uri":"obs_25_0902.html", + "node_id":"obs_25_0902.xml", + "product_code":"obs", + "code":"76", + "des":"You can call ObsClient.SetBucketLifecycle to set lifecycle rules.Sample code:// Initialize configuration parameters.\nObsConfig config = new ObsConfig();\nconfig.Endpoint =", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting Lifecycle Rules,Lifecycle Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting Lifecycle Rules", + "githuburl":"" + }, + { + "uri":"obs_25_0903.html", + "node_id":"obs_25_0903.xml", + "product_code":"obs", + "code":"77", + "des":"You can call ObsClient.GetBucketLifecycle to view lifecycle rules.This example views the lifecycle configuration of bucket bucketname.The example code is as follows:To ha", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing Lifecycle Rules,Lifecycle Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing Lifecycle Rules", + "githuburl":"" + }, + { + "uri":"obs_25_0904.html", + "node_id":"obs_25_0904.xml", + "product_code":"obs", + "code":"78", + "des":"You can call ObsClient.DeleteBucketLifecycle to delete lifecycle rules.This example deletes the lifecycle configuration of bucket bucketname.The example code is as follow", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting Lifecycle Rules,Lifecycle Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting Lifecycle Rules", + "githuburl":"" + }, + { + "uri":"obs_25_1000.html", + "node_id":"obs_25_1000.xml", + "product_code":"obs", + "code":"79", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"CORS", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"CORS", + "githuburl":"" + }, + { + "uri":"obs_25_1001.html", + "node_id":"obs_25_1001.xml", + "product_code":"obs", + "code":"80", + "des":"Cross-origin access refers to access between different domains. Restricting cross-origin access is a browser policy for security purposes, that is, the same-origin policy", + "doc_type":"sdk-dotnet-devg", + "kw":"CORS Overview,CORS,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"CORS Overview", + "githuburl":"" + }, + { + "uri":"obs_25_1002.html", + "node_id":"obs_25_1002.xml", + "product_code":"obs", + "code":"81", + "des":"You can call ObsClient.SetBucketCors to set CORS rules for a bucket. If the bucket is configured with CORS rules, the newly set ones will overwrite the existing ones.This", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting CORS Rules,CORS,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting CORS Rules", + "githuburl":"" + }, + { + "uri":"obs_25_1003.html", + "node_id":"obs_25_1003.xml", + "product_code":"obs", + "code":"82", + "des":"You can call ObsClient.GetBucketCors to view CORS rules of a bucket.This example views the CORS rule of bucket bucketname.The example code is as follows:To handle the err", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing CORS Rules,CORS,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing CORS Rules", + "githuburl":"" + }, + { + "uri":"obs_25_1004.html", + "node_id":"obs_25_1004.xml", + "product_code":"obs", + "code":"83", + "des":"You can call ObsClient.DeleteBucketCors to delete CORS rules of a bucket.This example deletes the CORS rule of bucket bucketname.The example code is as follows:To handle ", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting CORS Rules,CORS,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting CORS Rules", + "githuburl":"" + }, + { + "uri":"obs_25_1100.html", + "node_id":"obs_25_1100.xml", + "product_code":"obs", + "code":"84", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Access Logging", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Access Logging", + "githuburl":"" + }, + { + "uri":"obs_25_1101.html", + "node_id":"obs_25_1101.xml", + "product_code":"obs", + "code":"85", + "des":"OBS allows you to configure access logging for buckets. After the configuration, access to buckets will be recorded in the format of logs. These logs will be saved in spe", + "doc_type":"sdk-dotnet-devg", + "kw":"Logging Overview,Access Logging,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Logging Overview", + "githuburl":"" + }, + { + "uri":"obs_25_1102.html", + "node_id":"obs_25_1102.xml", + "product_code":"obs", + "code":"86", + "des":"You can call ObsClient.SetBucketLogging to enable bucket loggingThe source bucket and target bucket of logging must be in the same region.If the bucket is in the OBS Warm", + "doc_type":"sdk-dotnet-devg", + "kw":"Enabling Bucket Logging,Access Logging,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Enabling Bucket Logging", + "githuburl":"" + }, + { + "uri":"obs_25_1103.html", + "node_id":"obs_25_1103.xml", + "product_code":"obs", + "code":"87", + "des":"You can call ObsClient.GetBucketLogging to view the logging configuration of a bucket.This example views the logging configuration of bucket bucketname.The example code i", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing Bucket Logging,Access Logging,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing Bucket Logging", + "githuburl":"" + }, + { + "uri":"obs_25_1104.html", + "node_id":"obs_25_1104.xml", + "product_code":"obs", + "code":"88", + "des":"To disable logging for a bucket is to call ObsClient.SetBucketLogging to delete the logging configuration.This example disables logging for bucket bucketname.The example ", + "doc_type":"sdk-dotnet-devg", + "kw":"Disabling Bucket Logging,Access Logging,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Disabling Bucket Logging", + "githuburl":"" + }, + { + "uri":"obs_25_1200.html", + "node_id":"obs_25_1200.xml", + "product_code":"obs", + "code":"89", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Static Website Hosting", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Static Website Hosting", + "githuburl":"" + }, + { + "uri":"obs_25_1201.html", + "node_id":"obs_25_1201.xml", + "product_code":"obs", + "code":"90", + "des":"Static websites typically only contain static web pages and some scripts that can run on clients (such as JavaScript and Flash). In contrast, dynamic websites depend on s", + "doc_type":"sdk-dotnet-devg", + "kw":"Static Website Hosting Overview,Static Website Hosting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Static Website Hosting Overview", + "githuburl":"" + }, + { + "uri":"obs_25_1202.html", + "node_id":"obs_25_1202.xml", + "product_code":"obs", + "code":"91", + "des":"You can perform the following to implement website file hosting:Sample code:You can use https://bucketname.your-endpoint/test.html in a browser to access files hosted usi", + "doc_type":"sdk-dotnet-devg", + "kw":"Website File Hosting,Static Website Hosting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Website File Hosting", + "githuburl":"" + }, + { + "uri":"obs_25_1203.html", + "node_id":"obs_25_1203.xml", + "product_code":"obs", + "code":"92", + "des":"You can call ObsClient.SetBucketWebsite to set website hosting on a bucket.Sample code:Sample code:Sample code:", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting Website Hosting,Static Website Hosting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting Website Hosting", + "githuburl":"" + }, + { + "uri":"obs_25_1204.html", + "node_id":"obs_25_1204.xml", + "product_code":"obs", + "code":"93", + "des":"You can call ObsClient.GetBucketWebsite to view the hosting settings of a bucket.This example views the hosting configuration of bucket bucketname.The example code is as ", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing Website Hosting Settings,Static Website Hosting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing Website Hosting Settings", + "githuburl":"" + }, + { + "uri":"obs_25_1205.html", + "node_id":"obs_25_1205.xml", + "product_code":"obs", + "code":"94", + "des":"You can call ObsClient.DeleteBucketWebsite to delete the hosting settings of a bucket.This example deletes the hosting configuration of bucket bucketname.The example code", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting Website Hosting Settings,Static Website Hosting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting Website Hosting Settings", + "githuburl":"" + }, + { + "uri":"obs_25_1300.html", + "node_id":"obs_25_1300.xml", + "product_code":"obs", + "code":"95", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Tag Management", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Tag Management", + "githuburl":"" + }, + { + "uri":"obs_25_1301.html", + "node_id":"obs_25_1301.xml", + "product_code":"obs", + "code":"96", + "des":"Tags are used to identify and classify OBS buckets.", + "doc_type":"sdk-dotnet-devg", + "kw":"Tagging Overview,Tag Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Tagging Overview", + "githuburl":"" + }, + { + "uri":"obs_25_1302.html", + "node_id":"obs_25_1302.xml", + "product_code":"obs", + "code":"97", + "des":"You can call ObsClient.SetBucketTagging to set bucket tags. Sample code is as follows:A bucket can have up to 10 tags.The key and value pair of a tag can be composed of U", + "doc_type":"sdk-dotnet-devg", + "kw":"Setting Bucket Tags,Tag Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Setting Bucket Tags", + "githuburl":"" + }, + { + "uri":"obs_25_1303.html", + "node_id":"obs_25_1303.xml", + "product_code":"obs", + "code":"98", + "des":"You can call ObsClient.GetBucketTagging to view bucket tags. The following code shows how to view bucket tags.", + "doc_type":"sdk-dotnet-devg", + "kw":"Viewing Bucket Tags,Tag Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Viewing Bucket Tags", + "githuburl":"" + }, + { + "uri":"obs_25_1304.html", + "node_id":"obs_25_1304.xml", + "product_code":"obs", + "code":"99", + "des":"You can call ObsClient.DeleteBucketTagging to delete bucket tags. Sample code is as follows:", + "doc_type":"sdk-dotnet-devg", + "kw":"Deleting Bucket Tags,Tag Management,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Deleting Bucket Tags", + "githuburl":"" + }, + { + "uri":"obs_25_1500.html", + "node_id":"obs_25_1500.xml", + "product_code":"obs", + "code":"100", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Server-Side Encryption", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Server-Side Encryption", + "githuburl":"" + }, + { + "uri":"obs_25_1501.html", + "node_id":"obs_25_1501.xml", + "product_code":"obs", + "code":"101", + "des":"OBS supports server-side encryption.", + "doc_type":"sdk-dotnet-devg", + "kw":"Server-Side Encryption Overview,Server-Side Encryption,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Server-Side Encryption Overview", + "githuburl":"" + }, + { + "uri":"obs_25_1502.html", + "node_id":"obs_25_1502.xml", + "product_code":"obs", + "code":"102", + "des":"The following table lists APIs related to server-side encryption:", + "doc_type":"sdk-dotnet-devg", + "kw":"Encryption Description,Server-Side Encryption,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Encryption Description", + "githuburl":"" + }, + { + "uri":"obs_25_1503.html", + "node_id":"obs_25_1503.xml", + "product_code":"obs", + "code":"103", + "des":"Sample code:Sample code:", + "doc_type":"sdk-dotnet-devg", + "kw":"Example of Encryption,Server-Side Encryption,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Example of Encryption", + "githuburl":"" + }, + { + "uri":"obs_25_1600.html", + "node_id":"obs_25_1600.xml", + "product_code":"obs", + "code":"104", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Troubleshooting", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Troubleshooting", + "githuburl":"" + }, + { + "uri":"obs_25_1601.html", + "node_id":"obs_25_1601.xml", + "product_code":"obs", + "code":"105", + "des":"If the OBS server encounters an error when processing a request, a response containing the error code and error description is returned. The following table lists details", + "doc_type":"sdk-dotnet-devg", + "kw":"OBS Server-Side Error Codes,Troubleshooting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"OBS Server-Side Error Codes", + "githuburl":"" + }, + { + "uri":"obs_25_1602.html", + "node_id":"obs_25_1602.xml", + "product_code":"obs", + "code":"106", + "des":"Log files of OBS .NET SDK are saved in the path, usually the save directory of executable files of the project, specified in configuration file Log4Net.config.When curren", + "doc_type":"sdk-dotnet-devg", + "kw":"Log Analysis,Troubleshooting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Log Analysis", + "githuburl":"" + }, + { + "uri":"obs_25_1606.html", + "node_id":"obs_25_1606.xml", + "product_code":"obs", + "code":"107", + "des":"SDK custom exceptions (ObsException) are thrown by ObsClient. Exceptions are usually OBS server-side errors, including OBS error codes and error information and aim to he", + "doc_type":"sdk-dotnet-devg", + "kw":"SDK Custom Exceptions,Troubleshooting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"SDK Custom Exceptions", + "githuburl":"" + }, + { + "uri":"obs_25_1605.html", + "node_id":"obs_25_1605.xml", + "product_code":"obs", + "code":"108", + "des":"After you call an API in an instance of ObsClient, a sub-class of ObsWebServiceResponse will be returned.It includes HTTP/HTTPS response headers.This example obtains requ", + "doc_type":"sdk-dotnet-devg", + "kw":"SDK Common Response Headers,Troubleshooting,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"SDK Common Response Headers", + "githuburl":"" + }, + { + "uri":"obs_25_1700.html", + "node_id":"obs_25_1700.xml", + "product_code":"obs", + "code":"109", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"FAQ", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"FAQ", + "githuburl":"" + }, + { + "uri":"en-us_topic_0000001831623237.html", + "node_id":"en-us_topic_0000001831623237.xml", + "product_code":"obs", + "code":"110", + "des":"Symptom: The process occasionally hangs when you invoke .NET SDK methods.Solution: Add \"using\" before the method.See the example below.", + "doc_type":"sdk-dotnet-devg", + "kw":"What Do I Do If the Process Hangs Occasionally?,FAQ,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"What Do I Do If the Process Hangs Occasionally?", + "githuburl":"" + }, + { + "uri":"obs_25_1802.html", + "node_id":"obs_25_1802.xml", + "product_code":"obs", + "code":"111", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"sdk-dotnet-devg", + "kw":"Change History,Developer Guide (.NET SDK)", + "search_title":"", + "metedata":[ + { + "prodname":"obs", + "documenttype":"sdk-dotnet-devg" + } + ], + "title":"Change History", + "githuburl":"" + } +] \ No newline at end of file diff --git a/docs/obs_3rd_party/dotnet_sdk/CLASS.TXT.json b/docs/obs_3rd_party/dotnet_sdk/CLASS.TXT.json new file mode 100644 index 000000000..14cb21267 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/CLASS.TXT.json @@ -0,0 +1,1001 @@ +[ + { + "desc":"This section describes version compatibility and important notes about Object Storage Service (OBS) SDK for .NET.Recommended .NET versions: .NET Framework 3.5, 4.0, or 4.", + "product_code":"obs", + "title":"Before You Start", + "uri":"obs_25_0000.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"1" + }, + { + "desc":"Latest version of OBS .NET SDK source code: Download", + "product_code":"obs", + "title":"SDK Download Links", + "uri":"obs_25_0001.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"2" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Quick Start", + "uri":"obs_25_0100.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"3" + }, + { + "desc":"Access keys consist of two parts: an access key ID (AK) and a secret access key (SK). OBS uses access keys to sign requests to make sure that only authorized accounts can", + "product_code":"obs", + "title":"Creating an AK and SK", + "uri":"obs_25_0103.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"4" + }, + { + "desc":"Installing the OBS .NET SDK. The example here uses the latest version.", + "product_code":"obs", + "title":"Installing the SDK", + "uri":"obs_25_0105.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"5" + }, + { + "desc":"You can click here to view the endpoints and regions enabled for OBS.The SDK allows you to pass endpoints with or without the protocol name. Suppose the endpoint you obta", + "product_code":"obs", + "title":"Obtaining Endpoints", + "uri":"obs_25_0106.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"6" + }, + { + "desc":"Each time you want to send an HTTP/HTTPS request to OBS, you must create an instance of ObsClient. Sample code is as follows:For more information, see chapter \"Initializa", + "product_code":"obs", + "title":"Initializing an Instance of ObsClient", + "uri":"obs_25_0107.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"7" + }, + { + "desc":"A bucket is a global namespace of OBS and is a data container. It functions as a root directory of a file system and can store objects. The following code shows how to cr", + "product_code":"obs", + "title":"Creating a Bucket", + "uri":"obs_25_0108.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"8" + }, + { + "desc":"This example uploads string Hello OBS to bucket bucketname as object objectname.The example code is as follows:For more information, see Object Upload Overview.", + "product_code":"obs", + "title":"Uploading an Object", + "uri":"obs_25_0109.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"9" + }, + { + "desc":"This example downloads object objectname from bucket bucketname.The example code is as follows:For more information, see Object Download Overview.", + "product_code":"obs", + "title":"Downloading an Object", + "uri":"obs_25_0110.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"10" + }, + { + "desc":"After objects are uploaded, you may want to view the objects contained in a bucket. Sample code is as follows:You can call ListObjectsResponse.ObsObjects to obtain the de", + "product_code":"obs", + "title":"Listing Objects", + "uri":"obs_25_0111.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"11" + }, + { + "desc":"This example deletes object objectname from bucket bucketname.The example code is as follows:This example only deletes a single object. To delete objects in a batch, trav", + "product_code":"obs", + "title":"Deleting an Object", + "uri":"obs_25_0112.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"12" + }, + { + "desc":"When you call an API using an instance of ObsClient, if no exception is thrown, the return value is valid, and a sub-class instance of ObsWebServiceResponse (SDK common r", + "product_code":"obs", + "title":"General Examples of ObsClient", + "uri":"obs_25_0113.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"3", + "code":"13" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Initialization", + "uri":"obs_25_0200.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"14" + }, + { + "desc":"To use OBS, you need a valid pair of AK and SK for signature authentication.For details, see Creating an AK and SK.After obtaining the AK/SK pair, you can start initializ", + "product_code":"obs", + "title":"Configuring the AK/SK", + "uri":"obs_25_0201.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"14", + "code":"15" + }, + { + "desc":"ObsClient functions as the .NET client for accessing OBS. It offers callers a series of APIs for interaction with OBS and is used for managing and operating resources, su", + "product_code":"obs", + "title":"Creating an Instance of ObsClient", + "uri":"obs_25_0202.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"14", + "code":"16" + }, + { + "desc":"When you call the ObsConfig configuration class to create an instance of ObsClient, you can configure the agent, timeout duration, maximum allowed number of connections, ", + "product_code":"obs", + "title":"Configuring an Instance of ObsClient", + "uri":"obs_25_0203.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"14", + "code":"17" + }, + { + "desc":"OBS .NET SDK provides the logging function, based on the Apache Log4net open library. You can add log configuration files to enable the logging function. The procedure is", + "product_code":"obs", + "title":"Configuring SDK Logging", + "uri":"obs_25_0204.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"14", + "code":"18" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Bucket Management", + "uri":"obs_25_0300.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"19" + }, + { + "desc":"You can call ObsClient.CreateBucket to create a bucket.When creating a bucket, you can specify the ACL, storage class, and location for the bucket. OBS provides three sto", + "product_code":"obs", + "title":"Creating a Bucket", + "uri":"obs_25_0301.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"20" + }, + { + "desc":"You can call ObsClient.ListBuckets to list buckets. Sample code is as follows:Obtained bucket names are listed in the lexicographical order.Set ListBucketsRequest.IsQuery", + "product_code":"obs", + "title":"Listing Buckets", + "uri":"obs_25_0302.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"21" + }, + { + "desc":"You can call ObsClient.DeleteBucket to delete a bucket. Sample code is as follows:Only empty buckets (without objects and part fragments) can be deleted.Bucket deletion i", + "product_code":"obs", + "title":"Deleting a Bucket", + "uri":"obs_25_0303.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"22" + }, + { + "desc":"You can call ObsClient.HeadBucket to identify whether a bucket exists.This example checks whether bucket bucketname exists.The example code is as follows:If an exception ", + "product_code":"obs", + "title":"Identifying Whether a Bucket Exists", + "uri":"obs_25_0304.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"23" + }, + { + "desc":"You can call ObsClient.GetBucketMetadata to obtain the metadata of a bucket.This example returns the metadata of bucket bucketname.The example code is as follows:To handl", + "product_code":"obs", + "title":"Obtaining Bucket Metadata", + "uri":"obs_25_0305.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"24" + }, + { + "desc":"Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over r", + "product_code":"obs", + "title":"Managing Bucket ACLs", + "uri":"obs_25_0306.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"25" + }, + { + "desc":"Besides bucket ACLs, bucket owners can use bucket policies to centrally control access to buckets and objects in buckets.For more information, see Bucket Policies.You can", + "product_code":"obs", + "title":"Management Bucket Policies", + "uri":"obs_25_0307.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"26" + }, + { + "desc":"You can call ObsClient.GetBucketLocation to obtain the location of a bucket.This example returns the region of bucket bucketname.The example code is as follows:When creat", + "product_code":"obs", + "title":"Obtaining a Bucket Location", + "uri":"obs_25_0308.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"27" + }, + { + "desc":"The storage information about a bucket includes the used capacity of and the number of objects in the bucket.You can call ObsClient.GetBucketStorageInfo to obtain the buc", + "product_code":"obs", + "title":"Obtaining Storage Information About a Bucket", + "uri":"obs_25_0309.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"28" + }, + { + "desc":"You can call ObsClient.SetBucketQuota to set the bucket quota. Sample code is as follows:A bucket quota must be a non-negative integer expressed in bytes. The maximum val", + "product_code":"obs", + "title":"Setting or Obtaining a Bucket Quota", + "uri":"obs_25_0310.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"29" + }, + { + "desc":"OBS allows you to set storage classes for buckets. The storage class of an object defaults to be that of its residing bucket. Different storage classes meet different nee", + "product_code":"obs", + "title":"Setting or Obtaining the Storage Class of a Bucket", + "uri":"obs_25_0311.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"19", + "code":"30" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Object Upload", + "uri":"obs_25_0400.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"31" + }, + { + "desc":"In OBS, objects are basic data units that users can perform operations on. OBS .NET SDK provides abundant APIs for object upload in the following methods:Performing a Str", + "product_code":"obs", + "title":"Object Upload Overview", + "uri":"obs_25_0401.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"32" + }, + { + "desc":"Streaming upload uses System.IO.Stream as the data source of an object. You can call ObsClient.PutObject to upload the data streams to OBS. Sample code is as follows:To u", + "product_code":"obs", + "title":"Performing a Streaming Upload", + "uri":"obs_25_0402.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"33" + }, + { + "desc":"File-based upload uses local files as the data source of objects.This example uploads local file localfile to bucket bucketname as object objectname.The example code is a", + "product_code":"obs", + "title":"Performing a File-Based Upload", + "uri":"obs_25_0403.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"34" + }, + { + "desc":"You can call ObsClient.BeginPutObject and ObsClient.EndPutObject to upload an object asynchronously.This example asynchronously uploads local file localfile to bucket buc", + "product_code":"obs", + "title":"Performing an Asynchronous Upload", + "uri":"obs_25_0404.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"35" + }, + { + "desc":"You can call PutObjectRequest.UploadProgress to register a System.EventHandler callback function to obtain upload progress.This example uploads local file localfile to bu", + "product_code":"obs", + "title":"Obtaining Upload Progress", + "uri":"obs_25_0405.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"36" + }, + { + "desc":"There is no folder concept in OBS. All elements in buckets are objects. To create a folder in OBS is essentially to create an object whose size is 0 and whose name ends w", + "product_code":"obs", + "title":"Creating a Folder", + "uri":"obs_25_0406.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"37" + }, + { + "desc":"You can set properties for an object when uploading it. Object properties include the MIME type, MD5 value (for verification), storage class, and customized metadata. You", + "product_code":"obs", + "title":"Setting Object Properties", + "uri":"obs_25_0407.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"38" + }, + { + "desc":"To upload a large file, multipart upload is recommended. Multipart upload is applicable to many scenarios, including:Files to be uploaded are larger than 100 MB.The netwo", + "product_code":"obs", + "title":"Performing a Multipart Upload", + "uri":"obs_25_0408.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"39" + }, + { + "desc":"When uploading an object or initializing a multipart upload, you can directly set the expiration time for the object. Sample code is as follows:The previous mode specifie", + "product_code":"obs", + "title":"Configuring Lifecycle Management", + "uri":"obs_25_0409.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"40" + }, + { + "desc":"Appendable upload allows you to upload an object in appendable mode and then append data to the object. You can call ObsClient.AppendObject to perform an appendable uploa", + "product_code":"obs", + "title":"Performing an Appendable Upload", + "uri":"obs_25_0410.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"41" + }, + { + "desc":"As a special case of multipart upload, multipart copy implements multipart upload by copying the whole or part of an object in a bucket. You can call ObsClient.CopyPart t", + "product_code":"obs", + "title":"Performing a Multipart Copy", + "uri":"obs_25_0411.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"42" + }, + { + "desc":"Uploading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the upload process upon an upload failure, a", + "product_code":"obs", + "title":"Performing a Resumable Upload", + "uri":"obs_25_0412.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"31", + "code":"43" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Object Download", + "uri":"obs_25_0500.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"44" + }, + { + "desc":"OBS .NET SDK provides abundant APIs for downloading objects in the following modes:Performing a Streaming DownloadPerforming a Partial DownloadPerforming an Asynchronous ", + "product_code":"obs", + "title":"Object Download Overview", + "uri":"obs_25_0501.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"45" + }, + { + "desc":"Sample code:GetObjectResponse.OutputStream (System.IO.Stream type) is the response stream in GetObjectResponse. You can obtain the object content to a local file or memor", + "product_code":"obs", + "title":"Performing a Streaming Download", + "uri":"obs_25_0502.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"46" + }, + { + "desc":"When only partial data of an object is required, you can download data falling within a specific range.If the specified range is from 0 to 1,000, data from byte 0 to byte", + "product_code":"obs", + "title":"Performing a Partial Download", + "uri":"obs_25_0503.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"47" + }, + { + "desc":"You can call ObsClient.BeginGetObject and ObsClient.EndGetObject to download an object asynchronously.This example downloads object objectname from bucket bucketname asyn", + "product_code":"obs", + "title":"Performing an Asynchronous Download", + "uri":"obs_25_0504.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"48" + }, + { + "desc":"You can call GetObjectRequest.DownloadProgress to register the System.EventHandler callback function to obtain download progress.This example downloads objectname from bu", + "product_code":"obs", + "title":"Obtaining Download Progress", + "uri":"obs_25_0505.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"49" + }, + { + "desc":"When downloading an object, you can specify one or more conditions. Only when the conditions are met, the object will be downloaded. Otherwise, an exception indicating a ", + "product_code":"obs", + "title":"Performing a Conditioned Download", + "uri":"obs_25_0506.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"50" + }, + { + "desc":"When downloading an object, you can rewrite some HTTP/HTTPS response headers. The following table lists rewritable response headers.Sample code:// Initialize configuratio", + "product_code":"obs", + "title":"Rewriting Response Headers", + "uri":"obs_25_0507.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"51" + }, + { + "desc":"After an object is successfully downloaded, its custom data is returned.This example obtains the custom metadata of objectname in bucketname.The example code is as follow", + "product_code":"obs", + "title":"Obtaining Custom Metadata", + "uri":"obs_25_0508.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"52" + }, + { + "desc":"Before you can download a Cold object, you must restore it. Cold objects can be restored in either of the following ways.To prolong the validity period of the Cold data r", + "product_code":"obs", + "title":"Downloading a Cold Object", + "uri":"obs_25_0509.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"53" + }, + { + "desc":"Downloading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the download process upon a download failu", + "product_code":"obs", + "title":"Performing a Resumable Download", + "uri":"obs_25_0510.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"44", + "code":"54" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Object Management", + "uri":"obs_25_0600.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"55" + }, + { + "desc":"You can call ObsClient.GetObjectMetadata to obtain object properties, including the last modification time, version ID, and customized metadata. Sample code is as follows", + "product_code":"obs", + "title":"Obtaining Object Properties", + "uri":"obs_25_0601.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"56" + }, + { + "desc":"Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over r", + "product_code":"obs", + "title":"Managing Object ACLs", + "uri":"obs_25_0602.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"57" + }, + { + "desc":"You can call ObsClient.ListObjects to list objects in a bucket.The following table describes the parameters involved in this API.The following sample code shows how to li", + "product_code":"obs", + "title":"Listing Objects", + "uri":"obs_25_0603.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"58" + }, + { + "desc":"Exercise caution when performing this operation. If the versioning function is disabled for the bucket where the object is located, the object cannot be restored after be", + "product_code":"obs", + "title":"Deleting Objects", + "uri":"obs_25_0604.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"59" + }, + { + "desc":"The object copy operation can create a copy for an existing object in OBS.You can call ObsClient.CopyObject to copy an object. When copying an object, you can specify pro", + "product_code":"obs", + "title":"Copying an Object", + "uri":"obs_25_0605.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"60" + }, + { + "desc":"You can call ObsClient.HeadObject to check whether a specified object exists.The example code is as follows:If an exception is thrown and the returned HTTP status code is", + "product_code":"obs", + "title":"HEAD Object", + "uri":"obs_25_0606.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"55", + "code":"61" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Temporarily Authorized Access", + "uri":"obs_25_0700.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"62" + }, + { + "desc":"ObsClient allows you to create a URL whose Query parameters are carried with authentication information by specifying the AK and SK, HTTP method, and request parameters. ", + "product_code":"obs", + "title":"Using a Temporary URL for Authorized Access", + "uri":"obs_25_0701.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"62", + "code":"63" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Versioning Management", + "uri":"obs_25_0800.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"64" + }, + { + "desc":"You can use versioning to store multiple versions of an object in a bucket.When versioning is enabled for a bucket, OBS keeps multiple versions of an object in the bucket", + "product_code":"obs", + "title":"Versioning Overview", + "uri":"obs_25_0801.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"65" + }, + { + "desc":"You can call ObsClient.SetBucketVersioning to set the versioning status for a bucket. OBS supports two versioning statuses.Sample code:", + "product_code":"obs", + "title":"Setting Versioning Status for a Bucket", + "uri":"obs_25_0802.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"66" + }, + { + "desc":"You can call ObsClient.GetBucketVersioning to view the versioning status of a bucket.This example obtains the versioning status of bucket bucketname.The example code is a", + "product_code":"obs", + "title":"Viewing Versioning Status of a Bucket", + "uri":"obs_25_0803.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"67" + }, + { + "desc":"You can call ObsClient.GetObject to obtain an object version by specifying the version ID (VersionId).This example downloads object objectname from bucket bucketname by s", + "product_code":"obs", + "title":"Obtaining a Versioning Object", + "uri":"obs_25_0804.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"68" + }, + { + "desc":"You can call ObsClient.CopyObject to copy an object version by specifying the version ID (SourceVersionId).This example specifies SourceVersionId to copy sourceobjectname", + "product_code":"obs", + "title":"Copying a Versioning Object", + "uri":"obs_25_0805.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"69" + }, + { + "desc":"You can call ObsClient.RestoreObject to restore a Cold object version by specifying VersionId.This example specifies versionId to restore Cold object destobjectname in de", + "product_code":"obs", + "title":"Restoring a Specific Cold Object Version", + "uri":"obs_25_0806.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"70" + }, + { + "desc":"You can call ObsClient.ListVersions to list versioning objects.The following table describes the parameters involved in this API.If the value of VersionIdMarker is not a ", + "product_code":"obs", + "title":"Listing Versioning Objects", + "uri":"obs_25_0807.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"71" + }, + { + "desc":"You can call ObsClient.SetObjectAcl to pass the version ID (VersionId) to set an ACL for an object version. Sample code is as follows:The owner or grantee ID needed in th", + "product_code":"obs", + "title":"Setting or Obtaining a Versioning Object ACL", + "uri":"obs_25_0808.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"72" + }, + { + "desc":"You can call ObsClient.DeleteObject to pass a version ID (VersionId) to delete an object version.This example deletes object objectname from bucket bucketname by specifyi", + "product_code":"obs", + "title":"Deleting Versioning Objects", + "uri":"obs_25_0809.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"64", + "code":"73" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Lifecycle Management", + "uri":"obs_25_0900.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"74" + }, + { + "desc":"OBS allows you to set lifecycle rules for buckets to automatically transition the storage class of an object and delete expired objects, to effectively use storage featur", + "product_code":"obs", + "title":"Lifecycle Management Overview", + "uri":"obs_25_0901.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"74", + "code":"75" + }, + { + "desc":"You can call ObsClient.SetBucketLifecycle to set lifecycle rules.Sample code:// Initialize configuration parameters.\nObsConfig config = new ObsConfig();\nconfig.Endpoint =", + "product_code":"obs", + "title":"Setting Lifecycle Rules", + "uri":"obs_25_0902.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"74", + "code":"76" + }, + { + "desc":"You can call ObsClient.GetBucketLifecycle to view lifecycle rules.This example views the lifecycle configuration of bucket bucketname.The example code is as follows:To ha", + "product_code":"obs", + "title":"Viewing Lifecycle Rules", + "uri":"obs_25_0903.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"74", + "code":"77" + }, + { + "desc":"You can call ObsClient.DeleteBucketLifecycle to delete lifecycle rules.This example deletes the lifecycle configuration of bucket bucketname.The example code is as follow", + "product_code":"obs", + "title":"Deleting Lifecycle Rules", + "uri":"obs_25_0904.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"74", + "code":"78" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"CORS", + "uri":"obs_25_1000.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"79" + }, + { + "desc":"Cross-origin access refers to access between different domains. Restricting cross-origin access is a browser policy for security purposes, that is, the same-origin policy", + "product_code":"obs", + "title":"CORS Overview", + "uri":"obs_25_1001.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"79", + "code":"80" + }, + { + "desc":"You can call ObsClient.SetBucketCors to set CORS rules for a bucket. If the bucket is configured with CORS rules, the newly set ones will overwrite the existing ones.This", + "product_code":"obs", + "title":"Setting CORS Rules", + "uri":"obs_25_1002.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"79", + "code":"81" + }, + { + "desc":"You can call ObsClient.GetBucketCors to view CORS rules of a bucket.This example views the CORS rule of bucket bucketname.The example code is as follows:To handle the err", + "product_code":"obs", + "title":"Viewing CORS Rules", + "uri":"obs_25_1003.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"79", + "code":"82" + }, + { + "desc":"You can call ObsClient.DeleteBucketCors to delete CORS rules of a bucket.This example deletes the CORS rule of bucket bucketname.The example code is as follows:To handle ", + "product_code":"obs", + "title":"Deleting CORS Rules", + "uri":"obs_25_1004.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"79", + "code":"83" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Access Logging", + "uri":"obs_25_1100.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"84" + }, + { + "desc":"OBS allows you to configure access logging for buckets. After the configuration, access to buckets will be recorded in the format of logs. These logs will be saved in spe", + "product_code":"obs", + "title":"Logging Overview", + "uri":"obs_25_1101.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"84", + "code":"85" + }, + { + "desc":"You can call ObsClient.SetBucketLogging to enable bucket loggingThe source bucket and target bucket of logging must be in the same region.If the bucket is in the OBS Warm", + "product_code":"obs", + "title":"Enabling Bucket Logging", + "uri":"obs_25_1102.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"84", + "code":"86" + }, + { + "desc":"You can call ObsClient.GetBucketLogging to view the logging configuration of a bucket.This example views the logging configuration of bucket bucketname.The example code i", + "product_code":"obs", + "title":"Viewing Bucket Logging", + "uri":"obs_25_1103.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"84", + "code":"87" + }, + { + "desc":"To disable logging for a bucket is to call ObsClient.SetBucketLogging to delete the logging configuration.This example disables logging for bucket bucketname.The example ", + "product_code":"obs", + "title":"Disabling Bucket Logging", + "uri":"obs_25_1104.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"84", + "code":"88" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Static Website Hosting", + "uri":"obs_25_1200.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"89" + }, + { + "desc":"Static websites typically only contain static web pages and some scripts that can run on clients (such as JavaScript and Flash). In contrast, dynamic websites depend on s", + "product_code":"obs", + "title":"Static Website Hosting Overview", + "uri":"obs_25_1201.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"89", + "code":"90" + }, + { + "desc":"You can perform the following to implement website file hosting:Sample code:You can use https://bucketname.your-endpoint/test.html in a browser to access files hosted usi", + "product_code":"obs", + "title":"Website File Hosting", + "uri":"obs_25_1202.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"89", + "code":"91" + }, + { + "desc":"You can call ObsClient.SetBucketWebsite to set website hosting on a bucket.Sample code:Sample code:Sample code:", + "product_code":"obs", + "title":"Setting Website Hosting", + "uri":"obs_25_1203.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"89", + "code":"92" + }, + { + "desc":"You can call ObsClient.GetBucketWebsite to view the hosting settings of a bucket.This example views the hosting configuration of bucket bucketname.The example code is as ", + "product_code":"obs", + "title":"Viewing Website Hosting Settings", + "uri":"obs_25_1204.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"89", + "code":"93" + }, + { + "desc":"You can call ObsClient.DeleteBucketWebsite to delete the hosting settings of a bucket.This example deletes the hosting configuration of bucket bucketname.The example code", + "product_code":"obs", + "title":"Deleting Website Hosting Settings", + "uri":"obs_25_1205.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"89", + "code":"94" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Tag Management", + "uri":"obs_25_1300.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"95" + }, + { + "desc":"Tags are used to identify and classify OBS buckets.", + "product_code":"obs", + "title":"Tagging Overview", + "uri":"obs_25_1301.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"95", + "code":"96" + }, + { + "desc":"You can call ObsClient.SetBucketTagging to set bucket tags. Sample code is as follows:A bucket can have up to 10 tags.The key and value pair of a tag can be composed of U", + "product_code":"obs", + "title":"Setting Bucket Tags", + "uri":"obs_25_1302.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"95", + "code":"97" + }, + { + "desc":"You can call ObsClient.GetBucketTagging to view bucket tags. The following code shows how to view bucket tags.", + "product_code":"obs", + "title":"Viewing Bucket Tags", + "uri":"obs_25_1303.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"95", + "code":"98" + }, + { + "desc":"You can call ObsClient.DeleteBucketTagging to delete bucket tags. Sample code is as follows:", + "product_code":"obs", + "title":"Deleting Bucket Tags", + "uri":"obs_25_1304.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"95", + "code":"99" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Server-Side Encryption", + "uri":"obs_25_1500.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"100" + }, + { + "desc":"OBS supports server-side encryption.", + "product_code":"obs", + "title":"Server-Side Encryption Overview", + "uri":"obs_25_1501.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"100", + "code":"101" + }, + { + "desc":"The following table lists APIs related to server-side encryption:", + "product_code":"obs", + "title":"Encryption Description", + "uri":"obs_25_1502.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"100", + "code":"102" + }, + { + "desc":"Sample code:Sample code:", + "product_code":"obs", + "title":"Example of Encryption", + "uri":"obs_25_1503.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"100", + "code":"103" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Troubleshooting", + "uri":"obs_25_1600.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"104" + }, + { + "desc":"If the OBS server encounters an error when processing a request, a response containing the error code and error description is returned. The following table lists details", + "product_code":"obs", + "title":"OBS Server-Side Error Codes", + "uri":"obs_25_1601.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"104", + "code":"105" + }, + { + "desc":"Log files of OBS .NET SDK are saved in the path, usually the save directory of executable files of the project, specified in configuration file Log4Net.config.When curren", + "product_code":"obs", + "title":"Log Analysis", + "uri":"obs_25_1602.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"104", + "code":"106" + }, + { + "desc":"SDK custom exceptions (ObsException) are thrown by ObsClient. Exceptions are usually OBS server-side errors, including OBS error codes and error information and aim to he", + "product_code":"obs", + "title":"SDK Custom Exceptions", + "uri":"obs_25_1606.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"104", + "code":"107" + }, + { + "desc":"After you call an API in an instance of ObsClient, a sub-class of ObsWebServiceResponse will be returned.It includes HTTP/HTTPS response headers.This example obtains requ", + "product_code":"obs", + "title":"SDK Common Response Headers", + "uri":"obs_25_1605.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"104", + "code":"108" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"FAQ", + "uri":"obs_25_1700.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"109" + }, + { + "desc":"Symptom: The process occasionally hangs when you invoke .NET SDK methods.Solution: Add \"using\" before the method.See the example below.", + "product_code":"obs", + "title":"What Do I Do If the Process Hangs Occasionally?", + "uri":"en-us_topic_0000001831623237.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"109", + "code":"110" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"obs", + "title":"Change History", + "uri":"obs_25_1802.html", + "doc_type":"sdk-dotnet-devg", + "p_code":"", + "code":"111" + } +] \ No newline at end of file diff --git a/docs/obs_3rd_party/dotnet_sdk/PARAMETERS.txt b/docs/obs_3rd_party/dotnet_sdk/PARAMETERS.txt new file mode 100644 index 000000000..6da8d5f07 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/PARAMETERS.txt @@ -0,0 +1,3 @@ +version="" +language="en-us" +type="" \ No newline at end of file diff --git a/docs/obs_3rd_party/dotnet_sdk/en-us_topic_0000001831623237.html b/docs/obs_3rd_party/dotnet_sdk/en-us_topic_0000001831623237.html new file mode 100644 index 000000000..29e8b3477 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/en-us_topic_0000001831623237.html @@ -0,0 +1,45 @@ + + +

What Do I Do If the Process Hangs Occasionally?

+

Symptom: The process occasionally hangs when you invoke .NET SDK methods.

+

Solution: Add "using" before the method.

+

See the example below.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+try
+{
+    GetObjectMetadataRequest request = new GetObjectMetadataRequest();
+    // Specify a bucket name.
+    request.BucketName = "bucketname";
+    // Specify an object (example/objectname is an example here).
+    request.ObjectKey = "example/objectname";
+    // Obtain the object metadata.
+    using (GetObjectMetadataResponse response = client.GetObjectMetadata(request)) {
+       Console.WriteLine("Get object metadata response: {0}", response.StatusCode);
+       // Obtain the ETag of the object.
+       Console.WriteLine("Object etag {0}:  ", response.ETag);
+       // Obtain the object version ID.
+       Console.WriteLine("Object versionId {0}:  ", response.VersionId);
+       // Obtain the length of the object data, in bytes.
+       Console.WriteLine("Object contentLength {0}:  ", response.ContentLength);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("Message: {0}", ex.Message);
+}  
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0000.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0000.html new file mode 100644 index 000000000..43595e561 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0000.html @@ -0,0 +1,10 @@ + + +

Before You Start

+

This section describes version compatibility and important notes about Object Storage Service (OBS) SDK for .NET.

+

Compatibility

+
+

Important Notes

+
+
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0001.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0001.html new file mode 100644 index 000000000..988dc21eb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0001.html @@ -0,0 +1,8 @@ + + +

SDK Download Links

+

SDK Source Codes

+
+
+
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0100.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0100.html new file mode 100644 index 000000000..d18188fdd --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0100.html @@ -0,0 +1,29 @@ + + +

Quick Start

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0103.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0103.html new file mode 100644 index 000000000..3317eff2e --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0103.html @@ -0,0 +1,20 @@ + + +

Creating an AK and SK

+

Access keys consist of two parts: an access key ID (AK) and a secret access key (SK). OBS uses access keys to sign requests to make sure that only authorized accounts can access specified OBS resources. Detailed explanations about AK and SK are as follows:

+ +

The procedure is as follows:

+
  1. Log in to OBS Console.
  2. In the upper right corner of the page, hover the cursor over the username and choose My Credentials.
  3. On the My Credentials page, select Access Keys in the navigation pane on the left.
  4. On the Access Keys page, click Create Access Key.
  5. In the Create Access Key dialog box that is displayed, enter the password and verification code.
    • If you have not bound an email address or mobile number, you need to enter only the login password.
    • If you have bound an email address and a mobile number, you can select the verification by either email or mobile phone.
    +
    +
  6. Click OK.
  7. In the Download Access Key dialog box that is displayed, click OK to save the access keys to your browser's default download path.
  8. Open the downloaded credentials.csv file to obtain the access keys (AK and SK).
+
  • A user can create a maximum of two valid access keys.
  • Keep the access key properly. If you click Cancel in the dialog box, the access keys will not be downloaded, and cannot be obtained later. You can re-create access keys if you need to use them.
+
+ +
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0105.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0105.html new file mode 100644 index 000000000..5630e8766 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0105.html @@ -0,0 +1,13 @@ + + +

Installing the SDK

+

+

Installing the OBS .NET SDK. The example here uses the latest version.

+
  1. Download the OBS .NET SDK development package. For details, see SDK Download Links.
  2. Decompress the development package to obtain folder demo (sample code) and file Log4Net.config (log configuration file). Start Visual Studio, open the project solution, and open the esdk_obs_.net.sln or esdk_obs_.net_core.sln file in the directory based on the project framework. Set the solution to Release and generate a solution. You can find esdk_obs_.net.dll and log4net.dll files in bin/Release in the decompression directory.
  3. Start Visual Studio and choose FILE > New > Project > Templates > Visual C# > Console Application to create a Console Application project.
  4. Right-click the new project and choose References > Add Reference and import file esdk_obs_.net.dll.
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0106.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0106.html new file mode 100644 index 000000000..b592a3206 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0106.html @@ -0,0 +1,13 @@ + + +

Obtaining Endpoints

+
+

The SDK allows you to pass endpoints with or without the protocol name. Suppose the endpoint you obtained is your-endpoint. The endpoint passed when initializing an instance of ObsClient can be http://your-endpoint, https://your-endpoint, or your-endpoint.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0107.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0107.html new file mode 100644 index 000000000..94dc97d39 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0107.html @@ -0,0 +1,24 @@ + + +

Initializing an Instance of ObsClient

+

Each time you want to send an HTTP/HTTPS request to OBS, you must create an instance of ObsClient. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Use the instance to access OBS.
+

For more information, see chapter "Initialization."

+

For details about logging configuration, see Configuring SDK Logging.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0108.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0108.html new file mode 100644 index 000000000..86609242d --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0108.html @@ -0,0 +1,17 @@ + + +

Creating a Bucket

+

A bucket is a global namespace of OBS and is a data container. It functions as a root directory of a file system and can store objects. The following code shows how to create a bucket:

+
CreateBucketRequest request = new CreateBucketRequest();
+request.BucketName = "bucketname";
+client.CreateBucket(request);
+
  • Bucket names are globally unique. Ensure that the bucket you create is named differently from any other bucket.
  • A bucket name must comply with the following rules:
    • Contains 3 to 63 characters, chosen from lowercase letters, digits, hyphens (-), and periods (.), and starts with a digit or letter.
    • Cannot be an IP address or similar.
    • Cannot start or end with a hyphen (-) or period (.)
    • Cannot contain two consecutive periods (.), for example, my..bucket.
    • Cannot contain periods (.) and hyphens (-) adjacent to each other, for example, my-.bucket or my.-bucket.
    +
  • If you create buckets of the same name, no error will be reported and the bucket properties comply with those set in the first creation request.
  • For more information, see Creating a Bucket.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0109.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0109.html new file mode 100644 index 000000000..9f019b126 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0109.html @@ -0,0 +1,21 @@ + + +

Uploading an Object

+

This example uploads string Hello OBS to bucket bucketname as object objectname.

+

The example code is as follows:

+
PutObjectRequest request = new PutObjectRequest
+{
+    BucketName = "bucketname",
+    ObjectKey = "objectname",
+    InputStream = new MemoryStream(Encoding.UTF8.GetBytes("Hello OBS"))
+};
+client.PutObject(request);
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0110.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0110.html new file mode 100644 index 000000000..e63096a8d --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0110.html @@ -0,0 +1,28 @@ + + +

Downloading an Object

+

This example downloads object objectname from bucket bucketname.

+

The example code is as follows:

+
GetObjectRequest request = new GetObjectRequest()
+{
+    BucketName = "bucketname",
+    ObjectKey = "objectname",
+};
+using (GetObjectResponse response = client.GetObject(request))
+{
+    //Save the object locally. 
+    string dest = "savepath";
+    if (!File.Exists(dest))
+    {
+        response.WriteResponseStreamToFile(dest);
+    }
+}
+

For more information, see Object Download Overview.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0111.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0111.html new file mode 100644 index 000000000..a079e2d88 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0111.html @@ -0,0 +1,20 @@ + + +

Listing Objects

+

After objects are uploaded, you may want to view the objects contained in a bucket. Sample code is as follows:

+
ListObjectsRequest request = new ListObjectsRequest();
+request.BucketName = "bucketname";
+ListObjectsResponse response = client.ListObjects(request);
+foreach (ObsObject Object in response.ObsObjects)
+{
+    Console.WriteLine("ObjectKey={0}, Size={1}", Object.ObjectKey, Object.Size);
+}
+
  • You can call ListObjectsResponse.ObsObjects to obtain the descriptions of all objects.
  • In the previous sample code, 1000 objects will be listed, by default.
  • For more information, see Listing Objects.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0112.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0112.html new file mode 100644 index 000000000..b0cb5eed1 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0112.html @@ -0,0 +1,20 @@ + + +

Deleting an Object

+

This example deletes object objectname from bucket bucketname.

+

The example code is as follows:

+
DeleteObjectRequest request = new DeleteObjectRequest()
+{
+    BucketName = "bucketname",
+    ObjectKey = "objectname",
+};
+client.DeleteObject(request);
+
  • This example only deletes a single object. To delete objects in a batch, traverse objects and list to-be-deleted objects on your own.
  • For details about deletion, see Deleting Objects.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0113.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0113.html new file mode 100644 index 000000000..db7360aed --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0113.html @@ -0,0 +1,69 @@ + + +

General Examples of ObsClient

+

When you call an API using an instance of ObsClient, if no exception is thrown, the return value is valid, and a sub-class instance of ObsWebServiceResponse (SDK common response headers) is returned. If any exception is thrown, the operation failed, and you can obtain the exception details from the returned instance of ObsException. ObsClient supports synchronous and asynchronous API callings. Examples are as follows:

+

Synchronous Call

Sample code:

+
+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Call the API for creating a bucket in synchronous mode.
+try
+{
+    CreateBucketRequest request = new CreateBucketRequest
+    {
+        BucketName = "bucketname",
+    };
+    CreateBucketResponse response = client.CreateBucket(request);
+
+    Console.WriteLine("Create bucket response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

Asynchronous Call

Sample code:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Call the API for creating a bucket in asynchronous mode.
+CreateBucketRequest request = new CreateBucketRequest
+{
+    BucketName = "bucketname",
+};
+client.BeginCreateBucket(request, delegate(IAsyncResult ar){
+   try
+   {
+        CreateBucketResponse response = client.EndCreateBucket(ar);
+        Console.WriteLine("Create bucket response: {0}", response.StatusCode);
+    }
+    catch (ObsException ex)
+    {
+        Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+        Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+    }
+}, null);
+Console.ReadKey();
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0200.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0200.html new file mode 100644 index 000000000..fed41de00 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0200.html @@ -0,0 +1,17 @@ + + +

Initialization

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0201.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0201.html new file mode 100644 index 000000000..c94b75393 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0201.html @@ -0,0 +1,15 @@ + + +

Configuring the AK/SK

+

To use OBS, you need a valid pair of AK and SK for signature authentication.

+

+

For details, see Creating an AK and SK.

+

After obtaining the AK/SK pair, you can start initialization by taking these steps:

+ +
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0202.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0202.html new file mode 100644 index 000000000..f5665fd2a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0202.html @@ -0,0 +1,46 @@ + + +

Creating an Instance of ObsClient

+

ObsClient functions as the .NET client for accessing OBS. It offers callers a series of APIs for interaction with OBS and is used for managing and operating resources, such as buckets and objects, stored in OBS. To use OBS .NET SDK to send a request to OBS, you need to initialize an instance of ObsClient and modify the default configurations in ObsConfig based on needs.

+

+ + +
// Create an instance of ObsConfig.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Use the instance to access OBS.
+
  • The project can contain one or more instances of ObsClient.
+
  • ObsClient is thread-safe and can be simultaneously used by multiple threads.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0203.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0203.html new file mode 100644 index 000000000..72d917cce --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0203.html @@ -0,0 +1,144 @@ + + +

Configuring an Instance of ObsClient

+

When you call the ObsConfig configuration class to create an instance of ObsClient, you can configure the agent, timeout duration, maximum allowed number of connections, and some other parameters listed in the following table.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Recommended Value

+

Endpoint

+

Endpoint for accessing OBS, which contains the protocol type, domain name (or IP address), and port number. For example, https://your-endpoint:443. For security purposes, you are advised to use HTTPS.

+

N/A

+

Timeout

+

Timeout duration for synchronous callings, in ms. The default value is -1, which indicates no timeout limitations.

+

N/A

+

ReadWriteTimeout

+

Timeout duration for transmitting data at the Socket layer, in ms. The default value is 60000.

+

[10000, 60000]

+

AsyncSocketTimeout

+

Timeout duration for asynchronous callings, in ms. The default value is -1, which indicates no timeout limitations.

+

N/A

+

MaxIdleTime

+

Allowed connection idle time, in ms. If a connection exceeds the specified value, the connection will be closed. The default value is 30000.

+

Default

+

ConnectionLimit

+

Maximum number of concurrently opened HTTP connections. The default value is 1000.

+

Default

+

MaxErrorRetry

+

Maximum number of retry attempts (caused by abnormal requests, 500 errors, and 503 errors). The default value is 3.

+

[1, 5]

+

ReceiveBufferSize

+

Size of the socket reception buffer. The default value is 8192.

+

[8192, 65536]

+

SecurityProtocolType

+

Encryption protocol type when HTTPS is used.

+

N/A

+

ProxyHost

+

Host address of the proxy server.

+

N/A

+

ProxyPort

+

Port ID of the proxy server.

+

N/A

+

ProxyUserName

+

User name used for connecting to the proxy server.

+

N/A

+

ProxyPassword

+

Password used for connecting to the proxy server.

+

N/A

+

ProxyDomain

+

Domain to which the proxy belongs

+

N/A

+

ValidateCertificate

+

Whether to verify the server certificate. The default value is false.

+

N/A

+

BufferSize

+

Read or write cache size used for uploading an object to the socket stream, in bytes. The default value is 8192.

+

Default

+

KeepAlive

+

Whether to use persistent connections to access OBS. The default value is true.

+

N/A

+
+
+
  • Parameters whose recommended value is N/A need to be set based on your needs.
  • If the network is unstable, you are advised to set larger values for Timeout AsyncSocketTimeout, and ReadWriteTimeout.
  • If the value of Endpoint does not contain any protocol, HTTPS is used by default.
  • For the sake of high DNS resolution performance and OBS reliability, you can set Endpoint only to the domain name of OBS, instead of the IP address.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0204.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0204.html new file mode 100644 index 000000000..02a44b9af --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0204.html @@ -0,0 +1,14 @@ + + +

Configuring SDK Logging

+

OBS .NET SDK provides the logging function, based on the Apache Log4net open library. You can add log configuration files to enable the logging function. The procedure is as follows:

+
  1. Add a reference to log4net.dll in the project.
  2. Copy configuration file Log4Net.config to Debug or Release under directory bin of the project, to ensure that the configuration file and the project's executable files are in the same directory.
  3. Modify log levels in file Log4Net.config based on needs.
+
  • Without these operations, the logging function is in the disabled state and no logs will be generated.
  • For details about SDK logs, see Log Analysis.
  • The save path of log files defaults to be that of the project's executable files and can be changed in Log4Net.config.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0300.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0300.html new file mode 100644 index 000000000..9b6de0fb2 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0300.html @@ -0,0 +1,31 @@ + + +

Bucket Management

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0301.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0301.html new file mode 100644 index 000000000..1aa874c9a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0301.html @@ -0,0 +1,72 @@ + + +

Creating a Bucket

+

You can call ObsClient.CreateBucket to create a bucket.

+

Creating a Bucket with Parameters Specified

When creating a bucket, you can specify the ACL, storage class, and location for the bucket. OBS provides three storage classes for buckets. For details, see Setting or Obtaining the Storage Class of a Bucket. Sample code is as follows:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Create a bucket.
+try
+{
+    CreateBucketRequest request = new CreateBucketRequest
+    {
+        BucketName = "bucketname",
+        // Set the bucket location.
+        Location = "bucketLocation",
+// Set the storage class to Cold.
+        StorageClass = StorageClassEnum.Cold,
+        // Set the ACL for the bucket to public read (the default state is private).
+        CannedAcl = CannedAclEnum.Private
+    };
+    CreateBucketResponse response = client.CreateBucket(request);
+    Console.WriteLine("Create bucket response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
  • Bucket names are globally unique. Ensure that the bucket you create is named differently from any other bucket.
  • A bucket name must comply with the following rules:
    • Contains 3 to 63 characters, chosen from lowercase letters, digits, hyphens (-), and periods (.), and starts with a digit or letter.
    • Cannot be an IP address or similar.
    • Cannot start or end with a hyphen (-) or period (.)
    • Cannot contain two consecutive periods (.), for example, my..bucket.
    • Cannot contain periods (.) and hyphens (-) adjacent to each other, for example, my-.bucket or my.-bucket.
    +
  • If you create buckets of the same name in a region, no error will be reported and the bucket properties comply with those set in the first creation request.
  • The bucket created in the previous example is of the default ACL (private), in the OBS Standard storage class, and in the default region.
+
+

Creating a Bucket Directly

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Create a bucket.
+try
+{
+    CreateBucketRequest request = new CreateBucketRequest
+    {
+        BucketName = "bucketname",
+    };
+    CreateBucketResponse response = client.CreateBucket(request);
+    Console.WriteLine("Create bucket response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0302.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0302.html new file mode 100644 index 000000000..704e1ea7f --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0302.html @@ -0,0 +1,42 @@ + + +

Listing Buckets

+

You can call ObsClient.ListBuckets to list buckets. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// List buckets.
+try
+{
+    ListBucketsRequest request = new ListBucketsRequest();
+    ListBucketsResponse response = client.ListBuckets(request);
+    request.IsQueryLocation = true;
+    foreach (ObsBucket bucket in response.Buckets)
+    {
+        Console.WriteLine("Bucket name is : {0}", bucket.BucketName);
+        Console.WriteLine("Bucket creationDate is : {0}", bucket.CreationDate);
+        Console.WriteLine("Bucket location is : {0}", bucket.Location);
+        Console.WriteLine("\n");
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
  • Obtained bucket names are listed in the lexicographical order.
  • Set ListBucketsRequest.IsQueryLocation to true and then you can query the bucket location when listing buckets.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0303.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0303.html new file mode 100644 index 000000000..df3eb75a1 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0303.html @@ -0,0 +1,37 @@ + + +

Deleting a Bucket

+

You can call ObsClient.DeleteBucket to delete a bucket. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Delete a bucket.
+try
+{
+    DeleteBucketRequest request = new DeleteBucketRequest
+    {
+        BucketName = "bucketname",
+    };
+    DeleteBucketResponse response = client.DeleteBucket(request);
+    Console.WriteLine("Delete bucket response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • Only empty buckets (without objects and part fragments) can be deleted.
  • Bucket deletion is a non-idempotence operation and an error will be reported if the to-be-deleted bucket does not exist.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0304.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0304.html new file mode 100644 index 000000000..6dbfe933c --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0304.html @@ -0,0 +1,38 @@ + + +

Identifying Whether a Bucket Exists

+

You can call ObsClient.HeadBucket to identify whether a bucket exists.

+

This example checks whether bucket bucketname exists.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config
+// Identify whether a bucket exists.
+try
+{
+    HeadBucketRequest request = new HeadBucketRequest
+    {
+        BucketName = "bucketname",
+    };
+    bool exists = client.HeadBucket(request);
+    Console.WriteLine("Bucket exists: {0}", exists);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("StatusCode: {0}", ex.StatusCode);
+}
+

If an exception is thrown and the returned HTTP status code is 404, the bucket does not exist.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0305.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0305.html new file mode 100644 index 000000000..576f30f62 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0305.html @@ -0,0 +1,43 @@ + + +

Obtaining Bucket Metadata

+

You can call ObsClient.GetBucketMetadata to obtain the metadata of a bucket.

+

This example returns the metadata of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the bucket metadata.
+try
+{
+    List<string> headers = new List<string>();
+    headers.Add("x-obs-header");
+    GetBucketMetadataRequest request = new GetBucketMetadataRequest
+    {
+        BucketName = "bucketname",
+        Origin = "http://www.a.com",
+        AccessControlRequestHeaders = headers,
+    };
+    GetBucketMetadataResponse response = client.GetBucketMetadata(request);
+    Console.WriteLine("StorageClass: {0}", response.StorageClass);
+    Console.WriteLine("Location: {0}", response.Location);
+}
+catch (ObsException ex)
+{
+  Console.WriteLine("StatusCode: {0}", ex.StatusCode);
+} 
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0306.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0306.html new file mode 100644 index 000000000..ea60d239e --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0306.html @@ -0,0 +1,264 @@ + + +

Managing Bucket ACLs

+

Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over resources when a bucket or object is created. That is, the bucket creator has full control over the bucket, and the object uploader has full control over the object. Other accounts do not have the permissions to access resources. If resource owners want to grant other accounts the read and write permissions on resources, they can use ACLs. ACLs grant permissions to accounts. After an account is granted permissions, both the account and its IAM users can access the resources.

+

A bucket ACL can be configured in any of the following ways:

+
  1. Specify a pre-defined ACL when creating a bucket.
  2. Call ObsClient.SetBucketAcl to specify a pre-defined ACL.
  3. Call ObsClient.SetBucketAcl to specify a user-defined ACL.
+

+

The following table lists the five permission types supported by OBS.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

Permission

+

Description

+

Value in OBS .NET SDK

+

READ

+

A grantee with this permission for a bucket can obtain the list of objects in the bucket and the metadata of the bucket.

+

A grantee with this permission for an object can obtain the object content and metadata.

+

PermissionEnum.Read

+

WRITE

+

A grantee with this permission for a bucket can upload, overwrite, and delete any object in the bucket.

+

Such permission for an object is not applicable.

+

PermissionEnum.Write

+

READ_ACP

+

A grantee with this permission can obtain the ACL of a bucket or object.

+

A bucket or object owner has this permission permanently.

+

PermissionEnum.ReadAcp

+

WRITE_ACP

+

A grantee with this permission can update the ACL of a bucket or object.

+

A bucket or object owner has this permission permanently.

+

A grantee with this permission can modify the access control policy and thus the grantee obtains full access permissions.

+

PermissionEnum.WriteAcp

+

FULL_CONTROL

+

A grantee with this permission for a bucket has READ, WRITE, READ_ACP, and WRITE_ACP permissions for the bucket.

+

A grantee with this permission for an object has READ, WRITE, READ_ACP, and WRITE_ACP permissions for the object.

+

PermissionEnum.FullControl

+
+
+

There are five access control policies pre-defined in OBS, as described in the following table:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

Policy

+

Description

+

Value in OBS .NET SDK

+

private

+

The owner of a bucket or object has the FULL_CONTROL permission for the bucket or object. Other users have no permission to access the bucket or object.

+

CannedAclEnum.Private

+

public-read

+

If this permission is set for a bucket, everyone can obtain the list of objects, multipart uploads, and object versions in the bucket, as well as metadata of the bucket.

+

If this permission is set for an object, everyone can obtain the content and metadata of the object.

+

CannedAclEnum.PublicRead

+

public-read-write

+

If this permission is set for a bucket, everyone can obtain the object list in the bucket, multipart uploads in the bucket, metadata of the bucket; upload objects; delete objects; initialize multipart uploads; upload parts; combine parts; copy parts; and abort multipart uploads.

+

If this permission is set for an object, everyone can obtain the content and metadata of the object.

+

CannedAclEnum.PublicReadWrite

+

public-read-delivered

+

If this permission is set for a bucket, everyone can obtain the object list, multipart uploads, and bucket metadata in the bucket, and obtain the content and metadata of the objects in the bucket.

+

This permission cannot be set for objects.

+

CannedAclEnum.PublicReadDelivered

+

public-read-write-delivered

+

If this permission is set for a bucket, everyone can obtain the object list in the bucket, multipart uploads in the bucket, metadata of the bucket; upload objects; delete objects; initialize multipart uploads; upload parts; combine parts; copy parts; abort multipart uploads; and obtain content and metadata of objects in the bucket.

+

This permission cannot be set for objects.

+

CannedAclEnum.PublicReadWriteDelivered

+
+
+

Specifying a Pre-defined ACL During Bucket Creation

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Create a bucket.
+try
+{
+    CreateBucketRequest request = new CreateBucketRequest
+    {
+        BucketName = "bucketname",
+        // Set the bucket ACL to public read and write.
+        CannedAcl = CannedAclEnum.PublicReadWrite,
+    };
+    CreateBucketResponse response = client.CreateBucket(request);
+    Console.WriteLine("StatusCode: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Setting a Pre-defined ACL for a Bucket

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Set the bucket ACL.
+try
+{
+    SetBucketAclRequest request = new SetBucketAclRequest
+    {
+        BucketName = "bucketname",
+        // Set the bucket ACL to be private.
+        CannedAcl = CannedAclEnum.Private
+    };
+    SetBucketAclResponse response = client.SetBucketAcl(request);
+    Console.WriteLine("Set bucket acl response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Setting a User-defined Bucket ACL

The following code shows how to set a user-defined ACL for a bucket:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Set the bucket ACL.
+try
+{
+    //Set the bucket owner.
+    Owner owner = new Owner
+    {
+        Id = "ownerid",//ID of the domain to which the owner belongs
+    };
+    AccessControlList acl = new AccessControlList();
+    acl.Owner = owner ;
+
+    Grant item = new Grant()
+    {
+        Grantee = new GroupGrantee()
+        {
+            GroupGranteeType = GroupGranteeEnum.AllUsers
+        },
+        Permission = PermissionEnum.FullControl
+    };
+
+    IList<Grant> grants = new List<Grant>();
+    grants.Add(item);
+    acl.Grants = grants;
+
+    SetBucketAclRequest request = new SetBucketAclRequest()
+    {
+        BucketName = "bucketname",
+        AccessControlList = acl
+    };
+    
+    SetBucketAclResponse response = client.SetBucketAcl(request);
+    Console.WriteLine("Set bucket acl response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

The owner or grantee ID needed in the ACL indicates the account ID, which can be viewed on the My Credentials page of OBS Console.

+
+
+

Obtaining a Bucket ACL

You can call ObsClient.GetBucketAcl to obtain the bucket ACL. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Obtain the bucket ACL.
+try
+{
+    GetBucketAclRequest request = new GetBucketAclRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketAclResponse response = client.GetBucketAcl(request);
+    Console.WriteLine("Get bucket acl response: {0}", response.StatusCode);
+    foreach(Grant grant in response.AccessControlList.Grants)
+    {
+        if(grant.Grantee is CanonicalGrantee)
+        {
+              Console.WriteLine("Grantee id: {0}", (grant.Grantee as CanonicalGrantee).Id);
+        }else if(grant.Grantee is GroupGrantee)
+        {
+              Console.WriteLine("Grantee type: {0}", (grant.Grantee as GroupGrantee).GroupGranteeType);
+        }
+              Console.WriteLine("Grant permission: {0}", grant.Permission);
+        }
+    }
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0307.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0307.html new file mode 100644 index 000000000..8ec6a044a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0307.html @@ -0,0 +1,91 @@ + + +

Management Bucket Policies

+

Besides bucket ACLs, bucket owners can use bucket policies to centrally control access to buckets and objects in buckets.

+

For more information, see Bucket Policies.

+

Setting a Bucket Policy

You can call ObsClient.SetBucketPolicy to set a bucket policy. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    SetBucketPolicyRequest request = new SetBucketPolicyRequest
+    {
+        BucketName = "bucketname",
+        Policy = "your policy",
+    };
+    SetBucketPolicyResponse response = client.SetBucketPolicy(request);
+    Console.WriteLine("Set bucket policy response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

For details about the format (JSON character string) of bucket policies, see the Object Storage Service API Reference.

+
+
+

Obtaining a Bucket Policy

You can call ObsClient.GetBucketPolicy to obtain a bucket policy. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    GetBucketPolicyRequest request = new GetBucketPolicyRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketPolicyResponse response = client.GetBucketPolicy(request);
+    Console.WriteLine("Get bucket policy response: {0}", response.StatusCode);
+    Console.WriteLine("Policy: {0}", response.Policy);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Deleting a Bucket Policy

You can call ObsClient.DeleteBucketPolicy to delete a bucket policy. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    DeleteBucketPolicyRequest request = new DeleteBucketPolicyRequest
+    {
+        BucketName = "bucketname",
+    };
+    DeleteBucketPolicyResponse response = client.DeleteBucketPolicy(request);
+    Console.WriteLine("Delete bucket policy response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0308.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0308.html new file mode 100644 index 000000000..1052074a8 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0308.html @@ -0,0 +1,40 @@ + + +

Obtaining a Bucket Location

+

You can call ObsClient.GetBucketLocation to obtain the location of a bucket.

+

This example returns the region of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the bucket location.
+try
+{
+    GetBucketLocationRequest request = new GetBucketLocationRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketLocationResponse response = client.GetBucketLocation(request);
+    Console.WriteLine("Get bucket location response: {0}", response.StatusCode);
+    Console.WriteLine("Location: {0}", response.Location);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

When creating a bucket, you can specify its location. For details, see Creating a Bucket.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0309.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0309.html new file mode 100644 index 000000000..13d2815d4 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0309.html @@ -0,0 +1,42 @@ + + +

Obtaining Storage Information About a Bucket

+

The storage information about a bucket includes the used capacity of and the number of objects in the bucket.

+

You can call ObsClient.GetBucketStorageInfo to obtain the bucket storage information.

+

This example returns the storage information of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the storage information about a bucket.
+try
+{
+    GetBucketStorageInfoRequest request = new GetBucketStorageInfoRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketStorageInfoResponse response = client.GetBucketStorageInfo(request);
+    Console.WriteLine("Get bucket storageinfo response: {0}", response.StatusCode);
+    Console.WriteLine("ObjectNumber: {0}", response.ObjectNumber);
+    Console.WriteLine("Size: {0}", response.Size);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0310.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0310.html new file mode 100644 index 000000000..3bb9462e4 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0310.html @@ -0,0 +1,66 @@ + + +

Setting or Obtaining a Bucket Quota

+

Setting a Bucket Quota

You can call ObsClient.SetBucketQuota to set the bucket quota. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the bucket quota.
+try
+{
+    SetBucketQuotaRequest request = new SetBucketQuotaRequest
+    {
+        BucketName = "bucketname",
+        StorageQuota = 0L,
+    };
+    SetBucketQuotaResponse response = client.SetBucketQuota(request);
+    Console.WriteLine("Set bucket quota response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

A bucket quota must be a non-negative integer expressed in bytes. The maximum value is 263 - 1.

+
+
+

Obtaining the Bucket Quota

You can call ObsClient.GetBucketQuota to obtain the bucket quota. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the bucket quota.
+try
+{
+    GetBucketQuotaRequest request = new GetBucketQuotaRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketQuotaResponse response = client.GetBucketQuota(request);
+    Console.WriteLine("Get bucket quota response: {0}", response.StatusCode);
+    Console.WriteLine("StorageQuota: {0}", response.StorageQuota);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0311.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0311.html new file mode 100644 index 000000000..ac469a2bb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0311.html @@ -0,0 +1,106 @@ + + +

Setting or Obtaining the Storage Class of a Bucket

+

OBS allows you to set storage classes for buckets. The storage class of an object defaults to be that of its residing bucket. Different storage classes meet different needs for storage performance and costs. There are three types of storage class for buckets, as described in the following table:

+ +
+ + + + + + + + + + + + + + + + + + + + + +

Storage Class

+

Description

+

Value in OBS .NET SDK

+

OBS Standard

+

Features low access latency and high throughput and is applicable to storing frequently-accessed (multiple times per month) hotspot or small objects (< 1 MB) requiring quick response.

+

StorageClassEnum.Standard

+

OBS Warm

+

Is applicable to storing semi-frequently accessed (less than 12 times a year) data requiring quick response.

+

StorageClassEnum.Warm

+

OBS Cold

+

Is applicable to archiving rarely-accessed (once a year) data.

+

StorageClassEnum.Cold

+

Intelligent Tiering

+

Is designed to optimize storage costs by automatically moving data to a more economical access tier when data access patterns change. This storage class is ideal for data with constantly changing or unpredictable access patterns.

+

StorageClassEnum.INTELLIGENTTIERING

+
+
+

For more information, see Bucket Storage Classes.

+

Setting the Storage Class for a Bucket

You can call ObsClient.SetBucketStoragePolicy to set the storage class for a bucket. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the storage class for a bucket.
+try
+{
+    SetBucketStoragePolicyRequest request = new SetBucketStoragePolicyRequest
+    {
+        BucketName = "bucketname",
+        StorageClass = StorageClassEnum.Cold,
+    };
+    SetBucketStoragePolicyResponse response = client.SetBucketStoragePolicy(request);
+    Console.WriteLine("Set bucket storage policy response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Obtaining the Storage Class of a Bucket

You can call ObsClient.GetBucketStoragePolicy to obtain the storage class. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the storage class of a bucket.
+try
+{
+    GetBucketStoragePolicyRequest request = new GetBucketStoragePolicyRequest()
+    {
+        BucketName = "bucketName",
+    };
+    GetBucketStoragePolicyResponse response = client.GetBucketStoragePolicy(request);
+    Console.WriteLine("Get bucket storage policy response: {0}", response.StatusCode);
+    Console.WriteLine("StorageClass: {0}", response.StorageClass);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0400.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0400.html new file mode 100644 index 000000000..6d4c6cee8 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0400.html @@ -0,0 +1,33 @@ + + +

Object Upload

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0401.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0401.html new file mode 100644 index 000000000..271d2f883 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0401.html @@ -0,0 +1,14 @@ + + +

Object Upload Overview

+

In OBS, objects are basic data units that users can perform operations on. OBS .NET SDK provides abundant APIs for object upload in the following methods:

+ +

The SDK supports the upload of objects whose size ranges from 0 KB to 5 GB. If a file is smaller than 5 GB, streaming upload, appendable upload, and file-based upload are applicable. If the file is larger than 5 GB, multipart upload (whose part size is smaller than 5 GB) is suitable.

+

If you grant anonymous users the read permission for an object during the upload, anonymous users can access the object through a URL after the upload is complete. The object URL is in the format of https://bucket name.domain name/directory levels/object name. If the object resides in the root directory of the bucket, its URL does not contain directory levels.

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0402.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0402.html new file mode 100644 index 000000000..3ac5d7040 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0402.html @@ -0,0 +1,41 @@ + + +

Performing a Streaming Upload

+

Streaming upload uses System.IO.Stream as the data source of an object. You can call ObsClient.PutObject to upload the data streams to OBS. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a stream.
+try
+{
+    String str = "Hello OBS";
+    Stream stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(str));
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        InputStream = stream,
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • To upload a large file, you are advised to use multipart upload.
  • The content to be uploaded cannot exceed 5 GB.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0403.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0403.html new file mode 100644 index 000000000..bdc741159 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0403.html @@ -0,0 +1,41 @@ + + +

Performing a File-Based Upload

+

File-based upload uses local files as the data source of objects.

+

This example uploads local file localfile to bucket bucketname as object objectname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",  //Name of the bucket for storing the file to be uploaded
+        ObjectKey = "objectname",   //Name of the file to be uploaded (The file name is the complete path of the file in the bucket, for example, folder/test.txt. The path does not contain the bucket name.)
+        FilePath = "localfile",//Path of the local file to be uploaded, in which the file name must be specified
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • The content to be uploaded cannot exceed 5 GB.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0404.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0404.html new file mode 100644 index 000000000..528d451ce --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0404.html @@ -0,0 +1,50 @@ + + +

Performing an Asynchronous Upload

+

You can call ObsClient.BeginPutObject and ObsClient.EndPutObject to upload an object asynchronously.

+

This example asynchronously uploads local file localfile to bucket bucketname as object objectname.

+

Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file in asynchronous mode.
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file to be uploaded. The file name must be specified.
+    };
+    client.BeginPutObject(request, delegate(IAsyncResult ar){
+        try
+        {
+            PutObjectResponse response = client.EndPutObject(ar);
+            Console.WriteLine("put object response: {0}", response.StatusCode);
+        }
+        catch (ObsException ex)
+        {
+             Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+             Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+        }
+    }, null);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("Message: {0}", ex.Message);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0405.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0405.html new file mode 100644 index 000000000..bc6ee108b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0405.html @@ -0,0 +1,53 @@ + + +

Obtaining Upload Progress

+

You can call PutObjectRequest.UploadProgress to register a System.EventHandler callback function to obtain upload progress.

+

This example uploads local file localfile to bucket bucketname as object objectname and uses System.EventHandler to monitor the upload progress.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file uploaded. The file name must be specified.
+    };
+    // Represent the progress by showing how many bytes have been uploaded.
+    request.ProgressType = ProgressTypeEnum.ByBytes;
+    // Refresh the upload progress each time 1 MB data is uploaded.
+    request.ProgressInterval = 1024 * 1024;
+
+    // Register the upload progress callback function. 
+    request.UploadProgress += delegate(object sender, TransferStatus status){
+        // Obtain the average upload rate.
+        Console.WriteLine("AverageSpeed: {0}", status.AverageSpeed / 1024  + "KB/S");
+        // Obtain the upload progress in percentage.
+        Console.WriteLine("TransferPercentage: {0}", status.TransferPercentage);
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • You can query the upload progress when uploading an object in streaming, file-based, asynchronous, resumable, or appendable mode, or uploading a part.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0406.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0406.html new file mode 100644 index 000000000..e369e985a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0406.html @@ -0,0 +1,38 @@ + + +

Creating a Folder

+

There is no folder concept in OBS. All elements in buckets are objects. To create a folder in OBS is essentially to create an object whose size is 0 and whose name ends with a slash (/). Such objects have no difference from other objects and can be downloaded and deleted, except that they are displayed as folders in OBS Console.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Create a folder.
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "dir/",
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • To create a folder in OBS is to create an object whose size is 0 and whose name ends with a slash (/), in essential.
  • To create a multi-level folder, you only need to create the folder with the last level. For example, if you want to create a folder named src1/src2/src3/, create it directly, no matter whether the src1/ and src1/src2/ folders exist.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0407.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0407.html new file mode 100644 index 000000000..0b5ad8004 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0407.html @@ -0,0 +1,177 @@ + + +

Setting Object Properties

+

You can set properties for an object when uploading it. Object properties include the MIME type, MD5 value (for verification), storage class, and customized metadata. You can set properties for an object that is being uploaded in streaming, file-based, or multipart mode or when copying the object.

+

+

The following table describes object properties.

+ +
+ + + + + + + + + + + + + + + + + + + + + +

Property Name

+

Description

+

Default Value

+

Content-Type

+

Indicates the MIME type of the object, which defines the type and network code of the object as well as in which mode and coding will the browser read the object.

+

binary/octet-stream

+

Content-MD5

+

Indicates the base64-encoded digest of the object data. It is provided to the OBS server to verify data integrity.

+

N/A

+

Storage class

+

Indicates the storage class of the object. Different storage classes meet different needs for storage performance and costs. The value defaults to be the same as the object's residing bucket and can be changed.

+

N/A

+

Customized metadata

+

Indicates the user-defined description of the object. It is used to facilitate the customized management on the object.

+

N/A

+
+
+

Setting the MIME Type for an Object

You can call PutObjectRequest.ContentType to set the MIME type for an object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",//Path of the local file to upload. The path must contain the file name.
+        ContentType = "image/jpeg",//MIME type of the object
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

If the MIME type is not specified, the SDK will automatically identify the MIME type according to the name suffix of the uploaded object. For example, if the name suffix of an object is .xml (.html), the object will be identified as an application/xml (text/html) file.

+
+

Setting the MD5 Value for an Object

You can call PutObjectRequest.ContentMd5 to set the MD5 value for an object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file uploaded. The file name must be specified.
+        ContentMd5 = "your md5 which should be encoded by base64"
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
  • The MD5 value of an object must be a base64-encoded digest.
  • The OBS server will compare this MD5 value with the MD5 value obtained by object data calculation. If the two values are not the same, the upload fails with HTTP status code 400 returned.
  • If the MD5 value is not specified, the OBS server will skip MD5 value verification.
+
+

Setting the Storage Class for an Object

You can call PutObjectRequest.StorageClass to set the storage class for an object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file uploaded. The file name must be specified.
+        StorageClass = StorageClassEnum.Warm,//Object storage class
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
  • If you have not set the storage class for an object, the storage class of the object will be the same as that of its residing bucket.
  • OBS provides objects with three storage classes which are consistent with those provided for buckets.
  • Before downloading a Cold object, you must restore it first.
+
+

Customizing Metadata for an Object

You can call PutObjectRequest.Metadata to customize metadata for an object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Upload a file.
+try
+{
+    PutObjectRequest request = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file uploaded. The file name must be specified.
+    };
+    request.Metadata.Add("meta1", "value1");
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
  • An object can have multiple pieces of metadata. The total metadata size cannot exceed 8 KB.
  • The customized object metadata can be obtained by using ObsClient.GetObjectMetadata. For details, see Obtaining Object Properties.
  • When you call ObsClient.GetObject to download an object, its customized metadata will also be downloaded.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0408.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0408.html new file mode 100644 index 000000000..6a22d5b63 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0408.html @@ -0,0 +1,373 @@ + + +

Performing a Multipart Upload

+

To upload a large file, multipart upload is recommended. Multipart upload is applicable to many scenarios, including:

+ +

+

Multipart upload consists of three phases:

+
  1. Initialize a multipart upload (ObsClient.InitiateMultipartUpload).
  2. Upload parts one by one or concurrently (ObsClient.UploadPart).
  3. Combine parts (ObsClient.CompleteMultipartUpload) or abort the multipart upload (ObsClient.AbortMultipartUpload).
+

Initiating a Multipart Upload

Before using a multipart upload, you need to first initiate it. This operation will return an upload ID (globally unique identifier) created by the OBS server to identify the multipart upload. You can use this upload ID to initiate related operations, such as aborting a multipart upload, listing multipart uploads, and listing uploaded parts.

+

+

You can call ObsClient.InitiateMultipartUpload to initiate a multipart upload.

+
  • Call InitiateMultipartUploadRequest to specify the name and owning bucket of the uploaded object.
  • In InitiateMultipartUploadRequest, you can specify the MIME type, storage class, and customized metadata for the object.
  • The upload ID of the multipart upload returned by InitiateMultipartUploadResponse.UploadId will be used in follow-up operations.
+
+
+

Uploading Parts

After initiating a multipart upload, you can specify the object name and upload ID to upload a part. Each upload part has a part number (ranging from 1 to 10000). For parts with the same upload ID, their part numbers are unique and identify their relative location in the object. If you use the same part number to upload two parts, the latter one uploaded will overwrite the former one. Except for the last uploaded part whose size ranges from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. Parts can be uploaded in random order, or even through different processes or machines. OBS will combine them into the final object based on their part numbers.

+

+

You can call ObsClient.UploadPart to upload a part.

+
  • Except the part last uploaded, other parts must be larger than 100 KB. Part sizes will not be verified during upload because which one is last uploaded is not identified until parts are combined.
  • OBS will return ETags (MD5 values) of the received parts to users.
  • Part numbers range from 1 to 10000. If a part number exceeds this range, OBS will return error 400 Bad Request.
  • The minimum part size supported by an OBS 3.0 bucket is 100 KB, and the minimum part size supported by an OBS 2.0 bucket is 5 MB. You are advised to perform multipart upload to OBS 3.0 buckets.
+
+
+

Combining Parts

After all parts are uploaded, call the API for combining parts to generate the object. Before this operation, valid part numbers and ETags of all parts must be sent to OBS. After receiving this information, OBS verifies the validity of each part one by one. After all parts pass the verification, OBS combines these parts to form the final object.

+

+

You can call ObsClient.CompleteMultipartUpload to combine parts.

+

Part numbers can be inconsecutive.

+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    // 1. Initialize a multipart upload.
+    InitiateMultipartUploadRequest initiateRequest = new InitiateMultipartUploadRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname"
+    };
+
+    InitiateMultipartUploadResponse initResponse = client.InitiateMultipartUpload(initiateRequest);
+    Console.WriteLine("InitiateMultipartUpload status: {0}", initResponse.StatusCode);
+    Console.WriteLine("InitiateMultipartUpload UploadId: {0}", initResponse.UploadId);
+
+    // 2. Upload parts.
+        string filePath = "localfile";// Path of the local file uploaded. The file name must be specified.
+    long contentLength = new FileInfo(filePath).Length;
+    long partSize = 15 * (long)Math.Pow(2, 20); // The part size is 15 MB.
+    List<UploadPartResponse> uploadResponses = new List<UploadPartResponse>();
+    long filePosition = 0;
+    for (int i = 1; filePosition < contentLength; i++)
+    {
+        UploadPartRequest uploadRequest = new UploadPartRequest
+        {
+            BucketName = "bucketname",
+            ObjectKey = "objectname",
+            UploadId = initResponse.UploadId,
+            PartNumber = i,
+            PartSize = partSize,
+            Offset = filePosition,
+            FilePath = filePath
+        };
+        uploadResponses.Add(client.UploadPart(uploadRequest));
+        Console.WriteLine("UploadPart count: {0}", uploadResponses.Count);
+        filePosition += partSize;
+    }
+
+    // 3. Combine parts.
+
+    CompleteMultipartUploadRequest completeRequest = new CompleteMultipartUploadRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        UploadId = initResponse.UploadId,
+    };
+    completeRequest.AddPartETags(uploadResponses);
+    CompleteMultipartUploadResponse completeUploadResponse = client.CompleteMultipartUpload(completeRequest);
+    Console.WriteLine("CompleteMultipartUpload status: {0}", completeUploadResponse.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("Exception:{0}", ex.ErrorCode);
+    Console.WriteLine("Exception Message:{0}", ex.ErrorMessage);
+}
+
+

Aborting a Multipart Upload

After a multipart upload is aborted, you cannot use its upload ID to perform any operation and the uploaded parts will be deleted by OBS.

+

When an object is being uploaded in multi-part mode or an object fails to be uploaded, parts are generated in the bucket. These parts occupy your storage space. You can cancel the multi-part uploading task to delete unnecessary parts, thereby saving the storage space.

+

You can call ObsClient.AbortMultipartUpload to abort a multipart upload. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Abort a multipart upload.
+try
+{
+    AbortMultipartUploadRequest request = new AbortMultipartUploadRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        UploadId = "uploadId",//ID of the multipart upload to be aborted
+    };
+    AbortMultipartUploadResponse response = client.AbortMultipartUpload(request);
+    Console.WriteLine("Abort multipart upload response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing Uploaded Parts

You can call ObsClient.ListParts to list successfully uploaded parts of a multipart upload.

+

+

The following table describes the parameters involved in this API.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

Bucket name

+

ListPartsRequest.BucketName

+

ObjectKey

+

Object name

+

ListPartsRequest.ObjectKey

+

UploadId

+

Upload ID, which globally identifies a multipart upload. The value is in the returned result of InitiateMultipartUpload.

+

ListPartsRequest.UploadId

+

MaxParts

+

Maximum number of parts that can be listed per page.

+

ListPartsRequest.MaxParts

+

PartNumberMarker

+

Part number after which listing parts begins. Only parts whose part numbers are larger than this value will be listed.

+

ListPartsRequest.PartNumberMarker

+
+
+ +
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Simple listing
+try
+{
+    ListPartsRequest request = new ListPartsRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.UploadId = "uploadId";
+    ListPartsResponse response = client.ListParts(request);
+    Console.WriteLine("List parts response: {0}", response.StatusCode);
+    foreach (PartDetail part in response.Parts)
+    {
+        Console.WriteLine("PartNumber: " + part.PartNumber);
+        Console.WriteLine("Size: " + part.Size);
+        Console.WriteLine("ETag: " + part.ETag);
+        Console.WriteLine("LastModified: " + part.LastModified);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

Information about a maximum of 1000 parts can be listed each time. If an upload of the specific upload ID contains more than 1000 parts and ListPartsResult.isTruncated is true in the returned result, not all parts are listed. In such cases, you can use ListPartsRespon.NextPartNumberMarker to obtain the start position for next listing.

+
+ +

The following sample code lists more than 1,000 parts:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// List all parts.
+try
+{
+    ListPartsRequest request = new ListPartsRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.UploadId = "uploadId";
+    ListPartsResponse response;
+    do
+    {
+        response = client.ListParts(request);
+        Console.WriteLine("List parts response: {0}", response.StatusCode);
+        foreach (PartDetail part in response.Parts)
+        {
+            Console.WriteLine("PartNumber: " + part.PartNumber);
+            Console.WriteLine("Size: " + part.Size);
+            Console.WriteLine("ETag: " + part.ETag);
+            Console.WriteLine("LastModified: " + part.LastModified);
+        }
+        request.PartNumberMarker = response.NextPartNumberMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing Multipart Uploads

You can call ObsClient.ListMultipartUploads to list multipart uploads. The following table describes related parameters.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

Bucket name

+

ListMultipartUploadsRequest.BucketName

+

Prefix

+

Prefix that the object names in the multipart uploads to be listed must contain

+

ListMultipartUploadsRequest.Prefix

+

Delimiter

+

Character used to group object names involved in multipart uploads. If the object name contains the Delimiter parameter, the character string from the first character to the first delimiter in the object name is grouped under a single result element, CommonPrefix. (If a prefix is specified in the request, the prefix must be removed from the object name.)

+

ListMultipartUploadsRequest.Delimiter

+

MaxUploads

+

Maximum number of multipart uploads listed in the response body. The value ranges from 1 to 1000. If the value exceeds 1000, only 1,000 multipart uploads are returned.

+

ListMultipartUploadsRequest.MaxUploads

+

KeyMarker

+

Object name to start with when listing multipart uploads

+

ListMultipartUploadsRequest.KeyMarker

+

UploadIdMarker

+

Upload ID after which the multipart upload listing begins. It is effective only when used with KeyMarker so that multipart uploads after UploadIdMarker of KeyMarker will be listed.

+

ListMultipartUploadsRequest.UploadIdMarker

+
+
+ +
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List multipart uploads in simple mode.
+try
+{
+    ListMultipartUploadsRequest listMultipartUploadsRequest = new ListMultipartUploadsRequest();
+    listMultipartUploadsRequest.BucketName = "bucketname";
+    ListMultipartUploadsResponse listMultipartUploadsResponse = client.ListMultipartUploads(listMultipartUploadsRequest);
+    Console.WriteLine("ListMultipartUploadsResponse status code: " + listMultipartUploadsResponse.StatusCode);
+    foreach (MultipartUpload upload in listMultipartUploadsResponse.MultipartUploads)
+    {
+        Console.WriteLine("ObjectKey {0}: " , upload.ObjectKey);
+        Console.WriteLine("Initiated {0}: " , upload.Initiated);
+        Console.WriteLine("\n");
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • Information about a maximum of 1000 multipart uploads can be listed each time. If a bucket contains more than 1000 multipart uploads and ListMultipartUploadsResponse.isTruncated is true, not all uploads are listed. In such cases, you can use ListMultipartUploadsResponse.NextKeyMarker and ListMultipartUploadsResponse.NextUploadIdMarker to obtain the start position for next listing.
  • If you want to obtain all multipart uploads in a bucket, you can list them in paging mode.
+
+ +
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List all multipart uploads.
+try
+{
+    ListMultipartUploadsRequest request = new ListMultipartUploadsRequest();
+    request.BucketName = "bucketname";
+    ListMultipartUploadsResponse response;
+    do
+    {
+        response = client.ListMultipartUploads(request);
+        Console.WriteLine("ListMultipartUploadsResponse status code: " + response.StatusCode);
+        foreach (MultipartUpload upload in response.MultipartUploads)
+        {
+            Console.WriteLine("ObjectKey {0}: " , upload.ObjectKey);
+            Console.WriteLine("Initiated {0}: " , upload.Initiated);
+            Console.WriteLine("\n");
+        }
+        request.KeyMarker = response.NextKeyMarker;
+        request.UploadIdMarker = response.NextUploadIdMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0409.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0409.html new file mode 100644 index 000000000..f62c9d077 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0409.html @@ -0,0 +1,52 @@ + + +

Configuring Lifecycle Management

+

When uploading an object or initializing a multipart upload, you can directly set the expiration time for the object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+try
+{
+    PutObjectRequest request = new PutObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        FilePath = "localfile",// Path of the local file uploaded. The file name must be specified.
+        Expires = 30 // When uploading an object, set the object to expire after 30 days.
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+
+    InitiateMultipartUploadRequest initiateRequest = new InitiateMultipartUploadRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        // When initializing a multipart upload, set the object to expire 60 days after combination.
+        Expires = 60
+    };
+
+    InitiateMultipartUploadResponse initResponse = client.InitiateMultipartUpload(initiateRequest);
+    Console.WriteLine("InitiateMultipartUpload status: {0}", initResponse.StatusCode);
+    Console.WriteLine("InitiateMultipartUpload UploadId: {0}", initResponse.UploadId);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • The previous mode specifies the time duration in days after which an object will expire. The OBS server automatically clears expired objects.
  • The object expiration time set in the preceding method takes precedence over the bucket lifecycle rule.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0410.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0410.html new file mode 100644 index 000000000..6fa69fe1f --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0410.html @@ -0,0 +1,49 @@ + + +

Performing an Appendable Upload

+

Appendable upload allows you to upload an object in appendable mode and then append data to the object. You can call ObsClient.AppendObject to perform an appendable upload. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    // Upload an object in appendable mode.
+    AppendObjectRequest request = new AppendObjectRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectkey";
+    request.InputStream = new MemoryStream(Encoding.UTF8.GetBytes("Hello OBS"));
+
+    AppendObjectResponse response = client.AppendObject(request);
+
+    // Append data to the object.
+    request.Position = response.NextPosition;
+    request.InputStream = new MemoryStream(Encoding.UTF8.GetBytes("Hello OBS Again"));
+    response = client.AppendObject(request);
+    Console.WriteLine("NextPosition:{0}", response.NextPosition);
+    Console.WriteLine("ETag:{0}", response.ETag);
+
+    // Use the API for obtaining object properties to get the start position for next appending.
+    GetObjectMetadataResponse metadataResponse = client.GetObjectMetadata("bucketname", "objectkey");
+    Console.WriteLine("NextPosition from metadata:{0}", metadataResponse.NextPosition);
+
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • Objects uploaded using ObsClient.PutObject, referred to as normal objects, can overwrite objects uploaded using ObsClient.AppendObject, referred to as appendable objects. Data cannot be appended to an appendable object once the object has been overwritten by a normal object.
  • When you upload an object for the first time in append mode, an exception will be reported (HTTP status code 409) if an object of the same name exists.
  • The ETag returned for each append upload is the ETag for the uploaded content, rather than that of the whole object.
  • Data appended each time can be up to 5 GB, and 10000 times of appendable uploads can be performed on a single object.
  • After an appendable upload is successful, you can use AppendObjectResponse.NextPosition or call ObsClient.GetObjectMetadata to get the start position for next appending.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0411.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0411.html new file mode 100644 index 000000000..4c8c3b5a4 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0411.html @@ -0,0 +1,40 @@ + + +

Performing a Multipart Copy

+

As a special case of multipart upload, multipart copy implements multipart upload by copying the whole or part of an object in a bucket. You can call ObsClient.CopyPart to copy parts.

+

This example copies object sourceobjectname from bucket sourcebucketname to bucket destbucketname as object destobjectname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Copy parts.
+try
+{
+    CopyPartRequest request = new CopyPartRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.UploadId = "uploadId";
+    request.PartNumber = 1;
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    CopyPartResponse response = client.CopyPart(request);
+    Console.WriteLine("Copy part response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0412.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0412.html new file mode 100644 index 000000000..448708d23 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0412.html @@ -0,0 +1,170 @@ + + +

Performing a Resumable Upload

+

Uploading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the upload process upon an upload failure, and the restarted upload process may still suffer from the unstable network. To resolve such issues, you can use the API for resumable upload, whose working principle is to divide the to-be-uploaded file into multiple parts and upload them separately. The upload result of each part is recorded in a checkpoint file in real time. Only when all parts are successfully uploaded, the result indicating a successful upload is returned. Otherwise, an exception is thrown to remind you of calling the API again for re-uploading. Based on the upload status of each part recorded in the checkpoint file, the re-uploading will upload the parts failed to be uploaded previously, instead of uploading all parts. By virtue of this, resources are saved and efficiency is improved.

+

+

You can call ObsClient.UploadFile to perform a resumable upload. The following table describes the parameters involved in this API.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

(Mandatory) Bucket name

+

UploadFileRequest.BucketName

+

ObjectKey

+

(Mandatory) Object name

+

UploadFileRequest.ObjectKey

+

UploadFile

+

(Mandatory) Path to the local file to be uploaded

+

UploadFileRequest.UploadFile

+

UploadPartSize

+

Part size, in bytes. The value ranges from 5 MB (default) to 5 GB.

+

UploadFileRequest.UploadPartSize

+

EnableCheckpoint

+

Whether to enable the resumable upload mode. The default value is false, which indicates that this mode is disabled.

+

UploadFileRequest.EnableCheckpoint

+

CheckpointFile

+

File used to record the upload progress. This parameter is effective only in the resumable upload mode. If the value is null, the file is in the same directory as the local file to be uploaded.

+

UploadFileRequest.CheckpointFile

+

Metadata

+

Customized metadata of the object

+

UploadFileRequest.Metadata

+

EnableCheckSum

+

Whether to verify the content of the to-be-uploaded file. This parameter is effective only in the resumable upload mode. The default value is false, which indicates that the content will not be verified.

+

UploadFileRequest.EnableCheckSum

+

TaskNum

+

Maximum number of parts that can be concurrently uploaded. The default value is 1.

+

UploadFileRequest.TaskNum

+

UploadProgress

+

Upload progress callback function

+

UploadFileRequest.UploadProgress

+

ProgressType

+

Mode for representing the upload progress

+

UploadFileRequest.ProgressType

+

ProgressInterval

+

Interval for refreshing the upload progress

+

UploadFileRequest.ProgressInterval

+

UploadEventHandler

+

Upload event callback function

+

UploadFileRequest.UploadEventHandler

+
+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Perform a resumable upload.
+try
+{
+    UploadFileRequest request = new UploadFileRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        // Specify the local file to be uploaded.
+        UploadFile = "localpath",
+        // Set the part size to 10 MB.
+        UploadPartSize = 10 * 1024 * 1024,
+        // Enable the resumable download mode.
+        EnableCheckpoint = true,
+    };
+    // Represent the progress by showing how many bytes have been uploaded.
+    request.ProgressType = ProgressTypeEnum.ByBytes;
+    // Refresh the upload progress each time 1 MB data is uploaded.
+    request.ProgressInterval = 1024 * 1024;
+
+    // Register the upload progress callback function. 
+    request.UploadProgress += delegate(object sender, TransferStatus status){
+        // Obtain the average upload rate.
+        Console.WriteLine("AverageSpeed: {0}", status.AverageSpeed / 1024  + "KB/S");
+        // Obtain the upload progress in percentage.
+        Console.WriteLine("TransferPercentage: {0}", status.TransferPercentage);
+    };
+    
+    // Register the upload event callback function. 
+    request.UploadEventHandler += delegate(object sender, ResumableUploadEvent e){       
+        // Obtain the upload events.
+        Console.WriteLine("EventType: {0}", e.EventType);
+    };
+     
+    CompleteMultipartUploadResponse response = client.UploadFile(request);
+    Console.WriteLine("Upload File response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • The API for resumable upload, which is implemented based on multipart upload, is an encapsulated and enhanced version of multipart upload.
  • This API saves resources and improves efficiency upon the re-upload, and speeds up the upload process by concurrently uploading parts. Because this API is transparent to users, users are free from concerns about internal service details, such as the creation and deletion of checkpoint files, division of objects, and concurrent upload of parts.
+
  • The default value of the EnableCheckpoint parameter is false, which indicates that the resumable upload mode is disabled. In such cases, the API for resumable upload degrades to the simple encapsulation of multipart upload, and no checkpoint file will be generated.
  • The CheckpointFile and EnableCheckSum parameters are valid only when EnableCheckpoint is true.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0500.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0500.html new file mode 100644 index 000000000..606891605 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0500.html @@ -0,0 +1,29 @@ + + +

Object Download

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0501.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0501.html new file mode 100644 index 000000000..d466987af --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0501.html @@ -0,0 +1,13 @@ + + +

Object Download Overview

+

OBS .NET SDK provides abundant APIs for downloading objects in the following modes:

+ +

You can call ObsClient.GetObject to download an object.

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0502.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0502.html new file mode 100644 index 000000000..6d6f5ac4b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0502.html @@ -0,0 +1,48 @@ + + +

Performing a Streaming Download

+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object.
+try
+{
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+    };
+    using (GetObjectResponse response = client.GetObject(request))
+    {
+        string dest = "savepath";
+        if (!File.Exists(dest))
+        {
+           // Write the data streams into the file.
+            response.WriteResponseStreamToFile(dest);
+        }
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

GetObjectResponse.OutputStream (System.IO.Stream type) is the response stream in GetObjectResponse. You can obtain the object content to a local file or memory via GetObjectResponse.OutputStream. Alternatively, you can call GetObjectResponse.WriteResponseStreamToFile provided by OBS .NET SDK to download the object content to a local file.

+
+

Object response streams obtained by GetObjectResponse.OutputStream must be closed explicitly using a GetObjectResponse.OutputStream.Close() call. Otherwise, resource leakage may occur.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0503.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0503.html new file mode 100644 index 000000000..c0b87d7e5 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0503.html @@ -0,0 +1,48 @@ + + +

Performing a Partial Download

+

When only partial data of an object is required, you can download data falling within a specific range.

+

If the specified range is from 0 to 1,000, data from byte 0 to byte 1,000, 1,001 bytes in total, are returned. If the specified range is invalid, the entire object will be returned.

+

This example downloads the content of objectname in bucketname from byte 10 to byte 200.

+

The sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object.
+try
+{
+    ByteRange byteRange = new ByteRange(10, 200);
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        ByteRange = byteRange,
+    };
+    using (GetObjectResponse response = client.GetObject(request))
+    {
+        string dest = "savepath";
+        if (!File.Exists(dest))
+        {
+            response.WriteResponseStreamToFile(dest);
+        }
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0504.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0504.html new file mode 100644 index 000000000..eb51d5bc3 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0504.html @@ -0,0 +1,58 @@ + + +

Performing an Asynchronous Download

+

You can call ObsClient.BeginGetObject and ObsClient.EndGetObject to download an object asynchronously.

+

This example downloads object objectname from bucket bucketname asynchronously.

+

Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object in asynchronous mode.
+try
+{
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+    };
+    client.BeginGetObject(request, delegate(IAsyncResult ar){
+        try
+        {
+            using (GetObjectResponse response = client.EndGetObject(ar))
+            {
+                string dest = "savepath";
+                if (!File.Exists(dest))
+                {
+                    // Write the data streams into the file.
+                    response.WriteResponseStreamToFile(dest);
+                }
+                Console.WriteLine("Get object response: {0}", response.StatusCode);
+             }
+        }
+        catch (ObsException ex)
+        {
+            Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+            Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+        }
+    }, null);
+    
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("Message: {0}", ex.Message);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0505.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0505.html new file mode 100644 index 000000000..afe91ae15 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0505.html @@ -0,0 +1,60 @@ + + +

Obtaining Download Progress

+

You can call GetObjectRequest.DownloadProgress to register the System.EventHandler callback function to obtain download progress.

+

This example downloads objectname from bucketname and uses System.EventHandler to monitor the download progress.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object.
+try
+{
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+    };
+    // Represent the progress by showing how many bytes have been downloaded.
+    request.ProgressType = ProgressTypeEnum.ByBytes;
+    // Refresh the download progress each time 1 MB data is downloaded.
+    request.ProgressInterval = 1024 * 1024;
+
+    // Register the download progress callback function. 
+    request.DownloadProgress += delegate(object sender, TransferStatus status){
+        // Obtain the average download rate.
+        Console.WriteLine("AverageSpeed: {0}", status.AverageSpeed / 1024  + "KB/S");
+        // Obtain the download progress in percentage.
+        Console.WriteLine("TransferPercentage: {0}", status.TransferPercentage);
+    };
+    using (GetObjectResponse response = client.GetObject(request))
+    {
+        string dest = "savepath";
+        if (!File.Exists(dest))
+        {
+           // Write the data streams into the file.
+            response.WriteResponseStreamToFile(dest);
+        }
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+    }
+ }
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • You can obtain the download progress when downloading an object in streaming, partial, asynchronous, or resumable mode.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0506.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0506.html new file mode 100644 index 000000000..bfd7df1d8 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0506.html @@ -0,0 +1,90 @@ + + +

Performing a Conditioned Download

+

When downloading an object, you can specify one or more conditions. Only when the conditions are met, the object will be downloaded. Otherwise, an exception indicating a download failure will be thrown.

+

+

You can set the following conditions:

+ +
+ + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

If-Modified-Since

+

Returns the object if it has been modified since the specified time; otherwise, an error is returned.

+

GetObjectRequest.IfModifiedSince

+

If-Unmodified-Since

+

Returns the object if it has not been modified since the specified time; otherwise, an error is returned.

+

GetObjectRequest.IfUnmodifiedSince

+

If-Match

+

Returns the source object if its ETag is the same as the one specified by this parameter; otherwise, an exception is thrown.

+

GetObjectRequest.IfMatch

+

If-None-Match

+

Returns the source object if its ETag is different from the one specified by this parameter; otherwise, an exception is thrown.

+

GetObjectRequest.IfNoneMatch

+
+
+
  • The ETag of an object is the MD5 check value of the object.
  • If the download request includes IfUnmodifiedSince or IfMatch and the specified condition is not met, an exception will be thrown with HTTP status code 412 Precondition Failed returned.
  • If the download request includes IfModifiedSince or IfNoneMatch and the specified condition is not met, an exception will be thrown with HTTP status code 304 Not Modified returned.
+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object in conditioned mode.
+try
+{
+    DateTime datetime = new DateTime(2018, 3, 10, 12, 00, 00);
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        IfModifiedSince = datetime,
+    };
+    using (GetObjectResponse response = client.GetObject(request))
+    {
+        string dest = "savepath";
+        if (!File.Exists(dest))
+        {
+            response.WriteResponseStreamToFile(dest);
+        }
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0507.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0507.html new file mode 100644 index 000000000..2088338b9 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0507.html @@ -0,0 +1,96 @@ + + +

Rewriting Response Headers

+

When downloading an object, you can rewrite some HTTP/HTTPS response headers. The following table lists rewritable response headers.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

ContentType

+

Rewrites Content-Type in HTTP/HTTPS responses.

+

GetObjectRequest.ResponseHeaderOverrides.ContentType

+

ContentLanguage

+

Rewrites Content-Language in HTTP/HTTPS responses.

+

GetObjectRequest.ResponseHeaderOverrides.ContentLanguage

+

Expires

+

Rewrites Expires in HTTP/HTTPS responses.

+

ObjectRepleaceMetadata.Expires

+

CacheControl

+

Rewrites Cache-Control in HTTP/HTTPS responses.

+

GetObjectRequest.ResponseHeaderOverrides.CacheControl

+

ContentDisposition

+

Rewrites Content-Disposition in HTTP/HTTPS responses.

+

GetObjectRequest.ResponseHeaderOverrides.ContentDisposition

+

ContentEncoding

+

Rewrites Content-Encoding in HTTP/HTTPS responses.

+

GetObjectRequest.ResponseHeaderOverrides.ContentEncoding

+
+
+
Sample code:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Rewrite response headers when downloading an object.
+try
+{
+    ResponseHeaderOverrides responseHeaderOverrides = new ResponseHeaderOverrides();
+    responseHeaderOverrides.ContentType = "image/jpeg";
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        ResponseHeaderOverrides = responseHeaderOverrides,
+    };
+    GetObjectResponse response = client.GetObject(request);
+    Console.WriteLine("Get object response: {0}", response.StatusCode);
+    Console.WriteLine("ContentType: {0}", response.ContentType);
+    response.Dispose();
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0508.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0508.html new file mode 100644 index 000000000..166166130 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0508.html @@ -0,0 +1,50 @@ + + +

Obtaining Custom Metadata

+

After an object is successfully downloaded, its custom data is returned.

+

This example obtains the custom metadata of objectname in bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object.
+try
+{
+    GetObjectRequest request = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+    };
+    using (GetObjectResponse response = client.GetObject(request))
+    {
+        //Obtain the custom metadata of the object.
+        foreach (string key in response.Metadata.Keys)
+        {
+            Console.WriteLine("key is :" + key + " value is: " + response.Metadata[key]);
+        }
+        string dest = "savepath";
+        if (!File.Exists(dest))
+        {
+            response.WriteResponseStreamToFile(dest);
+        }
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0509.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0509.html new file mode 100644 index 000000000..7b4cb4bc8 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0509.html @@ -0,0 +1,69 @@ + + +

Downloading a Cold Object

+

Before you can download a Cold object, you must restore it. Cold objects can be restored in either of the following ways.

+ +
+ + + + + + + + + + + + + +

Option

+

Description

+

Value in OBS .NET SDK

+

Expedited restore

+

Data can be restored within 1 to 5 minutes.

+

RestoreTierEnum.Expedited

+

Standard restore

+

Data can be restored within 3 to 5 hours. This is the default option.

+

RestoreTierEnum.Standard

+
+
+

To prolong the validity period of the Cold data restored, you can repeatedly restore the data, but you will be billed for each restoration. After a second restore, the validity period of Standard object copies will be prolonged, and you need to pay for storing these copies during the prolonged period.

+
+

You can call ObsClient.RestoreObject to restore Cold objects. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+try
+{
+    RestoreObjectRequest request = new RestoreObjectRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.Days = 5;
+    request.Tier = RestoreTierEnum.Expedited;
+    // This parameter is optional. By default, the latest object version is restored. You can set versionId to restore a specified object version.
+    // request.VersionId = "versionId";
+    RestoreObjectResponse response = client.RestoreObject(request);
+    Console.WriteLine("Restore object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • The object specified in ObsClient.RestoreObject must be in the OBS Cold storage class. Otherwise, an exception will be thrown when you call this API.
  • RestoreObjectRequest.Days specifies the retention period (1 to 30 days) of the restored object.
  • RestoreObjectRequest.Tier specifies the restore option, which indicates the time spend on restoring an object.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0510.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0510.html new file mode 100644 index 000000000..d265ef53f --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0510.html @@ -0,0 +1,164 @@ + + +

Performing a Resumable Download

+

Downloading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the download process upon a download failure, and the restarted download process may still suffer from the unstable network. To resolve such issues, you can use the API for resumable download, whose working principle is to divide the to-be-downloaded file into multiple parts and download them separately. The download result of each part is recorded in a checkpoint file in real time. Only when all parts are successfully downloaded, the result indicating a successful download is returned. Otherwise, an exception is thrown to remind you of calling the API again for re-downloading. Based on the download status of each part recorded in the checkpoint file, the re-downloading will download the parts failed to be downloaded previously, instead of downloading all parts. By virtue of this, resources are saved and efficiency is improved.

+

+

You can call ObsClient.DownloadFile to perform a resumable download. The following table describes the parameters involved in this API.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

(Mandatory) Bucket name

+

DownloadFileRequest.BucketName

+

ObjectKey

+

(Mandatory) Object name

+

DownloadFileRequest.ObjectKey

+

DownloadFile

+

Full path of the local directory to which the object is downloaded. If the value is null, the downloaded object is saved in the directory where the program is executed.

+

DownloadFileRequest.DownloadFile

+

DownloadPartSize

+

Part size, in bytes. The value ranges from 5 MB (default) to 5 GB.

+

DownloadFileRequest.DownloadPartSize

+

EnableCheckpoint

+

Whether to enable the resumable upload mode. The default value is false, which indicates that this mode is disabled.

+

DownloadFileRequest.EnableCheckpoint

+

CheckpointFile

+

File used to record the download progress. This parameter is effective only in the resumable download mode. If the value is null, the file is in the same local directory as the downloaded object.

+

DownloadFileRequest.CheckpointFile

+

VersionId

+

Object version ID

+

DownloadFileRequest.VersionId

+

TaskNum

+

Maximum number of parts that can be concurrently downloaded. The default value is 1.

+

DownloadFileRequest.TaskNum

+

DownloadProgress

+

Download progress callback function

+

DownloadFileRequest.DownloadProgress

+

ProgressType

+

Mode for representing the download progress

+

DownloadFileRequest.ProgressType

+

ProgressInterval

+

Interval for refreshing the download progress

+

DownloadFileRequest.ProgressInterval

+

DownloadEventHandler

+

Download event callback function

+

DownloadFileRequest.DownloadEventHandler

+
+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Perform a resumable download.
+try
+{
+    DownloadFileRequest request = new DownloadFileRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        // Specify the local file to be downloaded.
+        DownloadFile = "savepath",
+        // Set the part size to 10 MB.
+        DownloadPartSize = 1024 * 1024 * 10,
+        // Enable the resumable download mode.
+        EnableCheckpoint = true,
+    };
+   
+    // Represent the progress by showing how many bytes have been downloaded.
+    request.ProgressType = ProgressTypeEnum.ByBytes;
+    // Refresh the download progress each time 1 MB data is downloaded.
+    request.ProgressInterval = 1024 * 1024;
+
+    // Register the download progress callback function. 
+    request.DownloadProgress += delegate(object sender, TransferStatus status){
+        // Obtain the average download rate.
+        Console.WriteLine("AverageSpeed: {0}", status.AverageSpeed / 1024  + "KB/S");
+        // Obtain the download progress in percentage.
+        Console.WriteLine("TransferPercentage: {0}", status.TransferPercentage);
+    };
+    
+    // Register the download event callback function. 
+    request.DownloadEventHandler += delegate(object sender, ResumableDownloadEvent e){       
+        // Obtain the download events.
+        Console.WriteLine("EventType: {0}", e.EventType);
+    };
+
+    GetObjectMetadataResponse response = client.DownloadFile(request);
+    Console.WriteLine("Download File response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
  • The API for resumable download, which is implemented based on partial download, is an encapsulated and enhanced version of partial download.
  • This API saves resources and improves efficiency upon the re-download, and speeds up the download process by concurrently downloading parts. Because this API is transparent to users, users are free from concerns about internal service details, such as the creation and deletion of checkpoint files, division of objects, and concurrent download of parts.
+
  • The default value of the EnableCheckpoint parameter is false, which indicates that the resumable download mode is disabled. In such cases, the API for resumable download degrades to the simple encapsulation of partial download, and no checkpoint file will be generated.
  • CheckpointFile is effective only when EnableCheckpoint is true.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0600.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0600.html new file mode 100644 index 000000000..3e0db3bfa --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0600.html @@ -0,0 +1,21 @@ + + +

Object Management

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0601.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0601.html new file mode 100644 index 000000000..8f4326f8b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0601.html @@ -0,0 +1,45 @@ + + +

Obtaining Object Properties

+
You can call ObsClient.GetObjectMetadata to obtain object properties, including the last modification time, version ID, and customized metadata. Sample code is as follows:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+try
+{
+    GetObjectMetadataRequest request = new GetObjectMetadataRequest();
+    // Specify a bucket name.
+    request.BucketName = "bucketname";
+    // Specify an object (example/objectname as an example).
+    request.ObjectKey = "example/objectname";
+    // Obtain the object metadata.
+    using (GetObjectMetadataResponse response = client.GetObjectMetadata(request)) {
+       Console.WriteLine("Get object metadata response: {0}", response.StatusCode);
+    // Obtain ETag of the object.
+       Console.WriteLine("Object etag {0}:  ", response.ETag);
+    // Obtain the object version ID.
+       Console.WriteLine("Object versionId {0}:  ", response.VersionId);
+    // Obtain the length of the object data, in bytes.
+       Console.WriteLine("Object contentLength {0}:  ", response.ContentLength);
+    }
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("Message: {0}", ex.Message);
+}  
+
  • Due to HTTP coding restrictions, non-ASCII characters cannot be sent. The SDK will decode the information in response headers using URL decoding rules.
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0602.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0602.html new file mode 100644 index 000000000..a112cbcd6 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0602.html @@ -0,0 +1,139 @@ + + +

Managing Object ACLs

+

Access control lists (ACLs) allow resource owners to grant other accounts the permissions to access resources. By default, only the resource owner has full control over resources when a bucket or object is created. That is, the bucket creator has full control over the bucket, and the object uploader has full control over the object. Other accounts do not have the permissions to access resources. If resource owners want to grant other accounts the read and write permissions on resources, they can use ACLs. ACLs grant permissions to accounts. After an account is granted permissions, both the account and its IAM users can access the resources.

+

An object ACL can be configured in any of the following ways:

+
  1. Specify a pre-defined ACL during object upload.
  2. Call ObsClient.SetObjectAcl to specify a pre-defined ACL.
  3. Call ObsClient.SetObjectAcl to specify a user-defined ACL.
+

Specifying a Pre-defined ACL During Object Upload

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set a pre-defined ACL for an object during the upload.
+try
+{
+    PutObjectRequest request = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        // Set the object ACL to public read and write.
+        CannedAcl = CannedAclEnum.PublicReadWrite,
+    };
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("Set object ac response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Setting a Pre-defined ACL for an Object

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set a pre-defined ACL for the object.
+try
+{
+    SetObjectAclRequest request = new SetObjectAclRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.CannedAcl = CannedAclEnum.PublicRead;
+    SetObjectAclResponse response = client.SetObjectAcl(request);
+    Console.WriteLine("Set object acl response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Setting a User-defined Object ACL

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set a user-defined object ACL.
+try
+{
+    SetObjectAclRequest request = new SetObjectAclRequest();
+    request.BucketName = "bucketname"; 
+    request.ObjectKey = "objectname";
+    request.AccessControlList = new AccessControlList();
+    Owner owner = new Owner();
+    owner.Id = "owerid";
+    request.AccessControlList.Owner = owner;
+    Grant item = new Grant();
+    item.Permission = PermissionEnum.FullControl;
+    item.Grantee = new GroupGrantee(GroupGranteeEnum.AllUsers);
+    request.AccessControlList.Grants.Add(item);
+    SetObjectAclResponse response = client.SetObjectAcl(request);
+    Console.WriteLine("Set object acl response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+   Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+   Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+

The owner or grantee ID needed in the ACL indicates the account ID, which can be viewed on the My Credentials page of OBS Console.

+
+
+

Obtaining an Object ACL

You can call ObsClient.GetObjectAcl to obtain the ACL of an object. Sample code is as follows:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the ACL of an object.
+try
+{
+    GetObjectAclRequest request = new GetObjectAclRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    GetObjectAclResponse response = client.GetObjectAcl(request);
+    Console.WriteLine("Get bucket acl response: {0}", response.StatusCode);
+    foreach(Grant grant in response.AccessControlList.Grants)
+    {
+        if(grant.Grantee is CanonicalGrantee)
+        {
+              Console.WriteLine("Grantee id: {0}", (grant.Grantee as CanonicalGrantee).Id);
+        }else if(grant.Grantee is GroupGrantee)
+        {
+              Console.WriteLine("Grantee type: {0}", (grant.Grantee as GroupGrantee).GroupGranteeType);
+        }
+              Console.WriteLine("Grant permission: {0}", grant.Permission);
+        }
+    }
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0603.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0603.html new file mode 100644 index 000000000..f70ee5395 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0603.html @@ -0,0 +1,247 @@ + + +

Listing Objects

+

You can call ObsClient.ListObjects to list objects in a bucket.

+

+

The following table describes the parameters involved in this API.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

Bucket name

+

ListObjectsRequest.BucketName

+

Prefix

+

Name prefix that the objects to be listed must contain

+

ListObjectsRequest.Prefix

+

Marker

+

Object name to start with when listing objects in a bucket. All objects are listed in the lexicographical order.

+

ListObjectsRequest.Marker

+

MaxKeys

+

Maximum number of objects listed in the response body. The value ranges from 1 to 1000. If the value exceeds 1000, only 1,000 objects are returned.

+

ListObjectsRequest.MaxKeys

+

Delimiter

+

Character used to group object names. If the object name contains the Delimiter parameter, the character string from the first character to the first delimiter in the object name is grouped under a single result element, CommonPrefix. (If a prefix is specified in the request, the prefix must be removed from the object name.)

+

For a parallel file system, if this parameter is not specified, all the content in the directory is recursively listed by default, and subdirectories are also listed. In big data scenarios, parallel file systems usually have deep directory levels and each directory has a large number of files. In such case, you are advised to configure [delimiter="/"] to list the content in the current directory, but not list subdirectories, thereby improving the listing efficiency.

+

ListObjectsRequest.Delimiter

+
+
+

Listing Objects in Simple Mode

The following sample code shows how to list objects in simple mode. A maximum of 1000 objects can be returned.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Simple listing
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    request.BucketName = "bucketname";
+    ListObjectsResponse response = client.ListObjects(request);
+    foreach (ObsObject entry in response.ObsObjects)
+    {
+        Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+

Information about a maximum of 1000 objects can be listed each time. If a bucket contains more than 1000 objects and ListObjectsResponse.IsTruncated is true in the returned result, not all objects are listed. In such cases, you can use ListObjectsResponse.NextMarker to obtain the start position for next listing.

+
+
+

Listing Objects by Specifying the Number

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Specify the number.
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    request.BucketName = "bucketname";
+       // Set the number of objects to be listed to 100.
+    request.MaxKeys = 100;
+    ListObjectsResponse response = client.ListObjects(request);
+    foreach (ObsObject entry in response.ObsObjects)
+    {
+        Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing Objects by Specifying a Prefix

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// List objects by specifying a prefix.
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    request.BucketName = "bucketname";
+    //Specify the prefix.
+    request.Prefix = "prefix";
+    ListObjectsResponse response = client.ListObjects(request);
+    foreach (ObsObject entry in response.ObsObjects)
+    {
+        Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Listing Objects by Specifying the Start Position

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// List objects by specifying the start position.
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    request.BucketName = "bucketname";
+    //Specify the start position for listing.
+    request.Marker = "marker";
+    ListObjectsResponse response = client.ListObjects(request);
+    foreach (ObsObject entry in response.ObsObjects)
+    {
+        Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing All Objects in Paging Mode

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List all objects in paging mode.
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    ListObjectsResponse response;
+    request.BucketName = "bucketname";
+    request.MaxKeys = 100;
+    do
+    {
+        response = client.ListObjects(request);
+        foreach (ObsObject entry in response.ObsObjects)
+        {
+            Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+        }
+        request.Marker = response.NextMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Listing All Objects in a Folder

There is no folder concept in OBS. All elements in buckets are objects. Folders are actually objects whose sizes are 0 and whose names end with a slash (/). When you set a folder name as the prefix, objects in this folder will be listed. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List all objects in a folder.
+try
+{
+    ListObjectsRequest request = new ListObjectsRequest();
+    ListObjectsResponse response;
+    request.BucketName = "bucketname";
+    request.MaxKeys = 1000;
+    // Set the prefix to dir/.
+    request.Prefix = "dir/";
+    do
+    {
+        response = client.ListObjects(request);
+        foreach (ObsObject entry in response.ObsObjects)
+        {
+            Console.WriteLine("key = {0} size = {1}", entry.ObjectKey, entry.Size);
+        }
+        request.Marker = response.NextMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0604.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0604.html new file mode 100644 index 000000000..167efe812 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0604.html @@ -0,0 +1,71 @@ + + +

Deleting Objects

+

Exercise caution when performing this operation. If the versioning function is disabled for the bucket where the object is located, the object cannot be restored after being deleted.

+
+

Deleting a Single Object

You can call ObsClient.DeleteObject to delete a single object. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete an object.
+try
+{
+    DeleteObjectRequest request = new DeleteObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+    };
+    DeleteObjectResponse response = client.DeleteObject(request);
+    Console.WriteLine("Delete object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Batch Deleting Objects

You can call ObsClient.DeleteObjects to delete objects in a batch.

+

+

A maximum of 1000 objects can be deleted each time. Two response modes are supported: verbose (detailed) and quiet (brief).

+ +

+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete objects in a batch.
+try
+{
+    DeleteObjectsRequest request = new DeleteObjectsRequest();
+    request.BucketName = "bucketname";
+    request.Quiet = true;
+    request.AddKey("objectname1");
+    request.AddKey("objectname2");
+    DeleteObjectsResponse response = client.DeleteObjects(request);
+    Console.WriteLine("Delete objects response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0605.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0605.html new file mode 100644 index 000000000..94e0a06f0 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0605.html @@ -0,0 +1,176 @@ + + +

Copying an Object

+

The object copy operation can create a copy for an existing object in OBS.

+

+

You can call ObsClient.CopyObject to copy an object. When copying an object, you can specify properties and ACL for it.

+
  • If the source object to be copied is in the Cold storage class, you must restore it first.
+
+

Copying an Object in Simple Mode

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Copy an object.
+try
+{
+    CopyObjectRequest request = new CopyObjectRequest();
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    request.BucketName = "destbucketname";
+    request.ObjectKey = "destobjectName";
+    CopyObjectResponse response = client.CopyObject(request);
+    Console.WriteLine("Copy object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Rewriting Object Properties

The following sample code shows how to rewrite object properties.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Rewrite object properties.
+try
+{
+    CopyObjectRequest request = new CopyObjectRequest();
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    request.BucketName = "destbucketname";
+    request.ObjectKey = "destobjectName";
+    request.StorageClass = StorageClassEnum.Warm;
+    request.ContentType = "image/jpeg";
+    request.MetadataDirective = MetadataDirectiveEnum.Replace;
+    CopyObjectResponse response = client.CopyObject(request);
+    Console.WriteLine("Copy object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+

Copying an Object by Specifying Conditions

When copying an object, you can specify one or more restriction conditions. If the conditions are met, the object will be copied. Otherwise, an exception will be thrown and the copy will fail.

+

+

You can set the following conditions:

+ +
+ + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

Copy-Source-If-Modified-Since

+

Copies the source object if it has been modified since the specified time; otherwise, an exception is thrown.

+

CopyObjectRequest.IfModifiedSince

+

Copy-Source-If-Unmodified-Since

+

Copies the source object if it has not been modified since the specified time; otherwise, an exception is thrown.

+

CopyObjectRequest.IfUnmodifiedSince

+

Copy-Source-If-Match

+

Copies the source object if its ETag is the same as the one specified by this parameter; otherwise, an exception is thrown.

+

CopyObjectRequest.IfMatch

+

Copy-Source-If-None-Match

+

Copies the source object if its ETag is different from the one specified by this parameter; otherwise, an exception is thrown.

+

CopyObjectRequest.IfNoneMatch

+
+
+
+
  • The ETag of the source object is the MD5 check value of the source object.
  • If the object copy request includes IfUnmodifiedSince, IfMatch, IfModifiedSince, or IfNoneMatch, and the specified condition is not met, the copy will fail and an exception will be thrown with HTTP status code 412 Precondition Failed returned.
  • IfModifiedSince and IfNoneMatch can be used together and so do IfUnmodifiedSince and IfMatch.
+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Set the condition for restricting the copy.
+try
+{
+    CopyObjectRequest request = new CopyObjectRequest();
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    request.BucketName = "destbucketname";
+    request.ObjectKey = "destobjectName";
+
+    request.IfModifiedSince = new DateTime(2018, 3, 10, 12, 00, 00);
+    CopyObjectResponse response = client.CopyObject(request);
+    Console.WriteLine("Copy object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+

Rewriting an Object ACL

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Rewrite the object ACL.
+try
+{
+    CopyObjectRequest request = new CopyObjectRequest();
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    request.BucketName = "destbucketname";
+    request.ObjectKey = "destobjectName";
+    request.CannedAcl = CannedAclEnum.PublicRead;
+    CopyObjectResponse response = client.CopyObject(request);
+    Console.WriteLine("Copy object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+} 
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0606.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0606.html new file mode 100644 index 000000000..a78d3f48a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0606.html @@ -0,0 +1,39 @@ + + +

HEAD Object

+

You can call ObsClient.HeadObject to check whether a specified object exists.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Check whether the specified object exists.
+try
+{
+    HeadObjectRequest request = new HeadObjectRequest()
+    {
+        BucketName = "bucketName",
+        ObjectKey = "objectKey"
+    };
+    bool response = client.HeadObject(request);
+    Console.WriteLine("Head object response: {0}", response);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("Exception errorcode: {0}, when head object.", ex.ErrorCode);
+    Console.WriteLine("Exception errormessage: {0}", ex.ErrorMessage);
+}
+
  • If an exception is thrown and the returned HTTP status code is 404, the bucket does not exist.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0700.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0700.html new file mode 100644 index 000000000..97febbdcb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0700.html @@ -0,0 +1,11 @@ + + +

Temporarily Authorized Access

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0701.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0701.html new file mode 100644 index 000000000..50bab314b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0701.html @@ -0,0 +1,914 @@ + + +

Using a Temporary URL for Authorized Access

+

ObsClient allows you to create a URL whose Query parameters are carried with authentication information by specifying the AK and SK, HTTP method, and request parameters. You can provide other users with this URL for temporary access. When generating a URL, you need to specify the validity period of the URL to restrict the access duration of visitors.

+

If you want to grant other users the permission to perform other operations on buckets or objects (for example, upload or download objects), generate a URL with the corresponding request (for example, to upload an object using the URL that generates the PUT request) and provide the URL for other users.

+

+

The following table lists operations can be performed through a signed URL.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Operation

+

HTTP Request Method (Value in OBS .NET SDK)

+

Sub-resource (Value in OBS .NET SDK)

+

Bucket Name Required

+

Object Name Required

+

PUT Bucket

+

HttpVerb.PUT

+

N/A

+

Yes

+

No

+

GET Buckets

+

HttpVerb.GET

+

N/A

+

No

+

No

+

DELETE Bucket

+

HttpVerb.DELETE

+

N/A

+

Yes

+

No

+

GET Objects

+

HttpVerb.GET

+

N/A

+

Yes

+

No

+

GET Object versions

+

HttpVerb.GET

+

SubResourceEnum.Versions

+

Yes

+

No

+

List Multipart uploads

+

HttpVerb.GET

+

SubResourceEnum.Uploads

+

Yes

+

No

+

Obtain Bucket Metadata

+

HttpVerb.HEAD

+

N/A

+

Yes

+

No

+

GET Bucket location

+

HttpVerb.GET

+

SubResourceEnum.Location

+

Yes

+

No

+

GET Bucket storageinfo

+

HttpVerb.GET

+

SubResourceEnum.StorageInfo

+

Yes

+

No

+

PUT Bucket quota

+

HttpVerb.PUT

+

SubResourceEnum.Quota

+

Yes

+

No

+

GET Bucket quota

+

HttpVerb.GET

+

SubResourceEnum.Quota

+

Yes

+

No

+

PUT Bucket storagePolicy

+

HttpVerb.PUT

+

SubResourceEnum.StoragePolicy

+

Yes

+

No

+

GET Bucket storagePolicy

+

HttpVerb.GET

+

SubResourceEnum.StoragePolicy

+

Yes

+

No

+

PUT Bucket ACL

+

HttpVerb.PUT

+

SubResourceEnum.Acl

+

Yes

+

No

+

GET Bucket ACL

+

HttpVerb.GET

+

SubResourceEnum.Acl

+

Yes

+

No

+

PUT Bucket logging

+

HttpVerb.PUT

+

SubResourceEnum.Logging

+

Yes

+

No

+

GET Bucket logging

+

HttpVerb.GET

+

SubResourceEnum.Logging

+

Yes

+

No

+

PUT Bucket policy

+

HttpVerb.PUT

+

SubResourceEnum.Policy

+

Yes

+

No

+

GET Bucket policy

+

HttpVerb.GET

+

SubResourceEnum.Policy

+

Yes

+

No

+

DELETE Bucket policy

+

HttpVerb.DELETE

+

SubResourceEnum.Policy

+

Yes

+

No

+

PUT Bucket lifecycle

+

HttpVerb.PUT

+

SubResourceEnum.Lifecycle

+

Yes

+

No

+

GET Bucket lifecycle

+

HttpVerb.GET

+

SubResourceEnum.Lifecycle

+

Yes

+

No

+

DELETE Bucket lifecycle

+

HttpVerb.DELETE

+

SubResourceEnum.Lifecycle

+

Yes

+

No

+

PUT Bucket website

+

HttpVerb.PUT

+

SubResourceEnum.Website

+

Yes

+

No

+

GET Bucket website

+

HttpVerb.GET

+

SubResourceEnum.Website

+

Yes

+

No

+

DELETE Bucket website

+

HttpVerb.DELETE

+

SubResourceEnum.Website

+

Yes

+

No

+

PUT Bucket versioning

+

HttpVerb.PUT

+

SubResourceEnum.Versioning

+

Yes

+

No

+

GET Bucket versioning

+

HttpVerb.GET

+

SubResourceEnum.Versioning

+

Yes

+

No

+

PUT Bucket cors

+

HttpVerb.PUT

+

SubResourceEnum.Cors

+

Yes

+

No

+

GET Bucket cors

+

HttpVerb.GET

+

SubResourceEnum.Cors

+

Yes

+

No

+

DELETE Bucket cors

+

HttpVerb.DELETE

+

SubResourceEnum.Cors

+

Yes

+

No

+

PUT Bucket tagging

+

HttpVerb.PUT

+

SubResourceEnum.Tagging

+

Yes

+

No

+

GET Bucket tagging

+

HttpVerb.GET

+

SubResourceEnum.Tagging

+

Yes

+

No

+

DELETE Bucket tagging

+

HttpVerb.DELETE

+

SubResourceEnum.Tagging

+

Yes

+

No

+

PUT Object

+

HttpVerb.PUT

+

N/A

+

Yes

+

Yes

+

Append Object

+

HttpVerb.POST

+

SubResourceEnum.Append

+

Yes

+

Yes

+

GET Object

+

HttpVerb.GET

+

N/A

+

Yes

+

Yes

+

PUT Object - Copy

+

HttpVerb.PUT

+

N/A

+

Yes

+

Yes

+

DELETE Object

+

HttpVerb.DELETE

+

N/A

+

Yes

+

Yes

+

DELETE Objects

+

HttpVerb.POST

+

SubResourceEnum.Delete

+

Yes

+

Yes

+

Obtain Object Metadata

+

HttpVerb.HEAD

+

N/A

+

Yes

+

Yes

+

PUT Object ACL

+

HttpVerb.PUT

+

SubResourceEnum.Acl

+

Yes

+

Yes

+

GET Object ACL

+

HttpVerb.GET

+

SubResourceEnum.Acl

+

Yes

+

Yes

+

Initiate Multipart Upload

+

HttpVerb.POST

+

SubResourceEnum.Uploads

+

Yes

+

Yes

+

Upload Part

+

HttpVerb.PUT

+

N/A

+

Yes

+

Yes

+

Upload Part - Copy

+

HttpVerb.PUT

+

N/A

+

Yes

+

Yes

+

List Parts

+

HttpVerb.GET

+

N/A

+

Yes

+

Yes

+

Complete Multipart Upload

+

HttpVerb.POST

+

N/A

+

Yes

+

Yes

+

Abort Multipart Upload

+

HttpVerb.DELETE

+

N/A

+

Yes

+

Yes

+

POST Object restore

+

HttpVerb.POST

+

SubResourceEnum.Restore

+

Yes

+

Yes

+
+
+

To access OBS using a temporary URL generated by the OBS .NET SDK, perform the following steps:

+
  1. Call ObsClient.CreateTemporarySignature to generate a signed URL.
  2. Use any HTTP library to make an HTTP/HTTPS request to OBS.
+

If a CORS or signature mismatch error occurs, refer to the following steps to troubleshoot the issue:

+
  1. If CORS is not configured, you need to configure CORS rules on OBS Console..
  2. If the signatures do not match, check whether signature parameters are correct by referring to . For example, during an object upload, the backend uses Content-Type to calculate the signature and generate an authorized URL, but if Content-Type is not set or is set to an incorrect value when the frontend uses the authorized URL, a CORS error occurs. To avoid this issue, ensure that Content-Type fields at both the frontend and backend are kept consistent.
+
+

The following content provides examples of accessing OBS using a temporary URL, including bucket creation, as well as object upload, download, listing, and deletion.

+

Creating a Bucket

// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Specify the validity period of the URL to 3600 seconds.
+long exipreSeconds = 3600;
+
+CreateTemporarySignatureRequest request = new CreateTemporarySignatureRequest();
+request.BucketName = "bucketname";
+request.Method = HttpVerb.PUT;
+request.Expires = exipreSeconds;
+
+CreateTemporarySignatureResponse response = client.CreateTemporarySignature(request);
+Console.WriteLine("Creating bucket using temporary signature url:");
+Console.WriteLine("\t" + response.SignUrl);
+
+// Use a PUT request to create a bucket.
+HttpWebRequest webRequest = WebRequest.Create(response.SignUrl) as HttpWebRequest;
+webRequest.Method = "PUT";
+
+
+foreach (KeyValuePair<string, string> header in response.ActualSignedRequestHeaders)
+{
+    if (!header.Key.Equals("host", StringComparison.OrdinalIgnoreCase))
+    {
+        webRequest.Headers.Add(header.Key, header.Value);
+    }
+}
+
+string location = "your bucket location";
+            
+webRequest.SendChunked = true;
+webRequest.AllowWriteStreamBuffering = false;
+using (Stream requestStream = webRequest.GetRequestStream())
+{
+    byte[] buffer = Encoding.UTF8.GetBytes("<CreateBucketConfiguration><LocationConstraint>" + location + "</LocationConstraint></CreateBucketConfiguration>");
+    requestStream.Write(buffer, 0, buffer.Length);
+}
+
+HttpWebResponse webResponse = null;
+try
+{
+    webResponse = webRequest.GetResponse() as HttpWebResponse;
+}
+catch (WebException ex)
+{
+    webResponse = ex.Response as HttpWebResponse;
+}
+Console.WriteLine("Response Status:" + Convert.ToInt32(webResponse.StatusCode));
+using (MemoryStream dest = new MemoryStream())
+{
+    using (Stream stream = webResponse.GetResponseStream())
+    {
+        byte[] buffer = new byte[8192];
+        int bytesRead;
+        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+        {
+            dest.Write(buffer, 0, bytesRead);
+        }
+
+    }
+    Console.WriteLine("Response Content:");
+    Console.WriteLine(Encoding.UTF8.GetString(dest.ToArray()));
+}
+
+

Uploading an Object

// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Specify the validity period of the URL to 3600 seconds.
+long exipreSeconds = 3600;
+
+CreateTemporarySignatureRequest request = new CreateTemporarySignatureRequest();
+request.BucketName = "bucketname";
+request.ObjectKey = "objectkey";         
+request.Method = HttpVerb.PUT;
+request.Expires = exipreSeconds;
+
+CreateTemporarySignatureResponse response = client.CreateTemporarySignature(request);
+Console.WriteLine("Creating object using temporary signature url:");
+Console.WriteLine("\t" + response.SignUrl);
+
+// Use a PUT request to upload an object.
+HttpWebRequest webRequest = WebRequest.Create(response.SignUrl) as HttpWebRequest;
+webRequest.Method = "PUT";
+
+
+foreach (KeyValuePair<string, string> header in response.ActualSignedRequestHeaders)
+{
+    if (!header.Key.Equals("host", StringComparison.OrdinalIgnoreCase))
+    {
+        webRequest.Headers.Add(header.Key, header.Value);
+    }
+}
+            
+webRequest.SendChunked = true;
+webRequest.AllowWriteStreamBuffering = false;
+using (Stream requestStream = webRequest.GetRequestStream())
+{
+    byte[] buffer = Encoding.UTF8.GetBytes("Hello OBS");
+    requestStream.Write(buffer, 0, buffer.Length);
+}
+
+HttpWebResponse webResponse = null;
+try
+{
+    webResponse = webRequest.GetResponse() as HttpWebResponse;
+}
+catch (WebException ex)
+{
+    webResponse = ex.Response as HttpWebResponse;
+}
+Console.WriteLine("Response Status:" + Convert.ToInt32(webResponse.StatusCode));
+using (MemoryStream dest = new MemoryStream())
+{
+    using (Stream stream = webResponse.GetResponseStream())
+    {
+        byte[] buffer = new byte[8192];
+        int bytesRead;
+        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+        {
+            dest.Write(buffer, 0, bytesRead);
+        }
+
+    }
+    Console.WriteLine("Response Content:");
+    Console.WriteLine(Encoding.UTF8.GetString(dest.ToArray()));
+}
+
+

Downloading an Object

// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Specify the validity period of the URL to 3600 seconds.
+long exipreSeconds = 3600;
+
+CreateTemporarySignatureRequest request = new CreateTemporarySignatureRequest();
+request.BucketName = "bucketname";
+request.ObjectKey = "objectkey";         
+request.Method = HttpVerb.GET;
+request.Expires = exipreSeconds;
+
+CreateTemporarySignatureResponse response = client.CreateTemporarySignature(request);
+Console.WriteLine("Getting object using temporary signature url:");
+Console.WriteLine("\t" + response.SignUrl);
+
+// Make a GET request to download an object.
+HttpWebRequest webRequest = WebRequest.Create(response.SignUrl) as HttpWebRequest;
+webRequest.Method = "GET";
+
+
+foreach (KeyValuePair<string, string> header in response.ActualSignedRequestHeaders)
+{
+    if (!header.Key.Equals("host", StringComparison.OrdinalIgnoreCase))
+    {
+        webRequest.Headers.Add(header.Key, header.Value);
+    }
+}
+            
+HttpWebResponse webResponse = null;
+try
+{
+    webResponse = webRequest.GetResponse() as HttpWebResponse;
+}
+catch (WebException ex)
+{
+    webResponse = ex.Response as HttpWebResponse;
+}
+Console.WriteLine("Response Status:" + Convert.ToInt32(webResponse.StatusCode));
+using (MemoryStream dest = new MemoryStream())
+{
+    using (Stream stream = webResponse.GetResponseStream())
+    {
+        byte[] buffer = new byte[8192];
+        int bytesRead;
+        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+        {
+            dest.Write(buffer, 0, bytesRead);
+        }
+
+    }
+    Console.WriteLine("Response Content:");
+    Console.WriteLine(Encoding.UTF8.GetString(dest.ToArray()));
+}
+
+

Listing Objects

// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Specify the validity period of the URL to 3600 seconds.
+long exipreSeconds = 3600;
+
+CreateTemporarySignatureRequest request = new CreateTemporarySignatureRequest();
+request.BucketName = "bucketname";
+request.Method = HttpVerb.GET;
+request.Expires = exipreSeconds;
+
+CreateTemporarySignatureResponse response = client.CreateTemporarySignature(request);
+Console.WriteLine("Getting object list using temporary signature url:");
+Console.WriteLine("\t" + response.SignUrl);
+
+// Use a GET request to obtain the object list.
+HttpWebRequest webRequest = WebRequest.Create(response.SignUrl) as HttpWebRequest;
+webRequest.Method = "GET";
+
+
+foreach (KeyValuePair<string, string> header in response.ActualSignedRequestHeaders)
+{
+    if (!header.Key.Equals("host", StringComparison.OrdinalIgnoreCase))
+    {
+        webRequest.Headers.Add(header.Key, header.Value);
+    }
+}
+            
+HttpWebResponse webResponse = null;
+try
+{
+    webResponse = webRequest.GetResponse() as HttpWebResponse;
+}
+catch (WebException ex)
+{
+    webResponse = ex.Response as HttpWebResponse;
+}
+Console.WriteLine("Response Status:" + Convert.ToInt32(webResponse.StatusCode));
+using (MemoryStream dest = new MemoryStream())
+{
+    using (Stream stream = webResponse.GetResponseStream())
+    {
+        byte[] buffer = new byte[8192];
+        int bytesRead;
+        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+        {
+            dest.Write(buffer, 0, bytesRead);
+        }
+
+    }
+    Console.WriteLine("Response Content:");
+    Console.WriteLine(Encoding.UTF8.GetString(dest.ToArray()));
+}
+
+

Deleting an Object

// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an ObsClient instance.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+
+// Specify the validity period of the URL to 3600 seconds.
+long exipreSeconds = 3600;
+
+CreateTemporarySignatureRequest request = new CreateTemporarySignatureRequest();
+request.BucketName = "bucketname";
+request.ObjectKey = "objectkey";
+request.Method = HttpVerb.DELETE;
+request.Expires = exipreSeconds;
+
+CreateTemporarySignatureResponse response = client.CreateTemporarySignature(request);
+Console.WriteLine("Deleting object using temporary signature url:");
+Console.WriteLine("\t" + response.SignUrl);
+
+// Use a DELETE request to delete an object.
+HttpWebRequest webRequest = WebRequest.Create(response.SignUrl) as HttpWebRequest;
+webRequest.Method = "DELETE";
+
+
+foreach (KeyValuePair<string, string> header in response.ActualSignedRequestHeaders)
+{
+    if (!header.Key.Equals("host", StringComparison.OrdinalIgnoreCase))
+    {
+        webRequest.Headers.Add(header.Key, header.Value);
+    }
+}
+            
+HttpWebResponse webResponse = null;
+try
+{
+    webResponse = webRequest.GetResponse() as HttpWebResponse;
+}
+catch (WebException ex)
+{
+    webResponse = ex.Response as HttpWebResponse;
+}
+Console.WriteLine("Response Status:" + Convert.ToInt32(webResponse.StatusCode));
+using (MemoryStream dest = new MemoryStream())
+{
+    using (Stream stream = webResponse.GetResponseStream())
+    {
+        byte[] buffer = new byte[8192];
+        int bytesRead;
+        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+        {
+            dest.Write(buffer, 0, bytesRead);
+        }
+
+    }
+    Console.WriteLine("Response Content:");
+    Console.WriteLine(Encoding.UTF8.GetString(dest.ToArray()));
+}
+
+

HttpVerb is an enumeration type defined in OBS .NET SDK, whose value indicates the request method types.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0800.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0800.html new file mode 100644 index 000000000..6703fbd3f --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0800.html @@ -0,0 +1,27 @@ + + +

Versioning Management

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0801.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0801.html new file mode 100644 index 000000000..dfc19405b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0801.html @@ -0,0 +1,16 @@ + + +

Versioning Overview

+

You can use versioning to store multiple versions of an object in a bucket.

+

When versioning is enabled for a bucket, OBS keeps multiple versions of an object in the bucket, allowing you to easily retrieve and restore historical versions or recover data in the event of accidental changes or application failures.

+

By default, versioning is disabled for new OBS buckets. In this case, if a newly uploaded object is using the name of the previously uploaded one, the new object will overwrite the previous one.

+

For details about different versioning operations, see:

+ +

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0802.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0802.html new file mode 100644 index 000000000..b5dea34af --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0802.html @@ -0,0 +1,63 @@ + + +

Setting Versioning Status for a Bucket

+

You can call ObsClient.SetBucketVersioning to set the versioning status for a bucket. OBS supports two versioning statuses.

+ +
+ + + + + + + + + + + + + +

Versioning Status

+

Description

+

Value in OBS .NET SDK

+

Enabled

+
  1. OBS creates a unique version ID for each uploaded object. Namesake objects are not overwritten and are distinguished by their own version IDs.
  2. Objects can be downloaded by specifying the version ID. By default, the latest object is downloaded if no version ID is specified.
  3. Objects can be deleted by specifying the version ID. If an object is deleted with no version ID specified, the object will generate a delete marker with a unique version ID but is not physically deleted.
  4. Objects of the latest version in a bucket are returned by default after ObsClient.ListObjects is called. You can call ObsClient.ListVersions to list a bucket's objects with all version IDs.
  5. Except for delete markers, storage space occupied by objects with all version IDs is billed.
+

VersionStatusEnum.Enabled

+

Suspended

+
  1. Existing objects with version IDs are not affected.
  2. OBS creates version ID null to an uploaded object and the object will be overwritten after a namesake one is uploaded
  3. Objects can be downloaded by specifying the version ID. By default, the latest object is downloaded if no version ID is specified.
  4. Objects can be deleted by version ID. If an object is deleted with no version ID specified, the object is only attached with a deletion mark and version ID null. Objects with version ID null are physically deleted.
  5. Except for delete markers, storage space occupied by objects with all version IDs is billed.
+

VersionStatusEnum.Suspended

+
+
+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the versioning status.
+try
+{
+    SetBucketVersioningRequest request = new SetBucketVersioningRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new VersioningConfiguration();
+    //Enabling versioning.
+    request.Configuration.Status = VersionStatusEnum.Enabled;
+    SetBucketVersioningResponse response = client.SetBucketVersioning(request);
+    Console.WriteLine("Set bucket version response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0803.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0803.html new file mode 100644 index 000000000..9505b322b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0803.html @@ -0,0 +1,38 @@ + + +

Viewing Versioning Status of a Bucket

+

You can call ObsClient.GetBucketVersioning to view the versioning status of a bucket.

+

This example obtains the versioning status of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// View the versioning status.
+try
+{
+    GetBucketVersioningRequest request = new GetBucketVersioningRequest();
+    request.BucketName = "bucketname";
+    GetBucketVersioningResponse response = client.GetBucketVersioning(request);
+    Console.WriteLine("Get bucket version response: {0}", response.StatusCode);
+    Console.WriteLine("Status: {0}", response.Configuration.Status);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0804.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0804.html new file mode 100644 index 000000000..373135b51 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0804.html @@ -0,0 +1,48 @@ + + +

Obtaining a Versioning Object

+

You can call ObsClient.GetObject to obtain an object version by specifying the version ID (VersionId).

+

This example downloads object objectname from bucket bucketname by specifying VersionId.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain versioning objects.
+try
+{
+    GetObjectRequest getObjectRequest = new GetObjectRequest()
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname",
+        VersionId = "versionId",
+    };
+    using (GetObjectResponse response = client.GetObject(getObjectRequest))
+    {
+        Console.WriteLine("Get object response: {0}", response.StatusCode);
+        //Save the file locally.
+        if (!File.Exists("savePath"))
+        {
+            response.WriteResponseStreamToFile("savePath");
+        }
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • If the version ID is null, the object of the latest version will be downloaded, by default.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0805.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0805.html new file mode 100644 index 000000000..b092f2dd7 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0805.html @@ -0,0 +1,41 @@ + + +

Copying a Versioning Object

+

You can call ObsClient.CopyObject to copy an object version by specifying the version ID (SourceVersionId).

+

This example specifies SourceVersionId to copy sourceobjectname from sourcebucketname to destbucketname as destobjectname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Copy a versioning object.
+try
+{
+    CopyObjectRequest request = new CopyObjectRequest();
+    request.SourceBucketName = "sourcebucketname";
+    request.SourceObjectKey = "sourceobjectname";
+    request.BucketName = "destbucketname";
+    request.ObjectKey = "destobjectName";
+    request.SourceVersionId = "sourceversionId";
+    CopyObjectResponse response = client.CopyObject(request);
+    Console.WriteLine("copy object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0806.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0806.html new file mode 100644 index 000000000..32e3c1038 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0806.html @@ -0,0 +1,42 @@ + + +

Restoring a Specific Cold Object Version

+

You can call ObsClient.RestoreObject to restore a Cold object version by specifying VersionId.

+

This example specifies versionId to restore Cold object destobjectname in destbucketname as a Standard object.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Restore a specific Cold object version.
+try
+{
+    RestoreObjectRequest request = new RestoreObjectRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.Days = 5;
+    // Restore a versioned object at an expedited speed.
+    request.Tier = RestoreTierEnum.Expedited;
+    request.VersionId = "versionId";
+    RestoreObjectResponse response = client.RestoreObject(request);
+    Console.WriteLine("Restore object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

To prolong the validity period of the Cold data restored, you can repeatedly restore the data, but you will be billed for each restoration. After a second restore, the validity period of Standard object copies will be prolonged, and you need to pay for storing these copies during the prolonged period.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0807.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0807.html new file mode 100644 index 000000000..bb3fa974a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0807.html @@ -0,0 +1,269 @@ + + +

Listing Versioning Objects

+

You can call ObsClient.ListVersions to list versioning objects.

+

+

The following table describes the parameters involved in this API.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

Property in OBS .NET SDK

+

BucketName

+

Bucket name

+

ListVersionsRequest.BucketName

+

Prefix

+

Name prefix that the objects to be listed must contain

+

ListVersionsRequest.Prefix

+

KeyMarker

+

Object name to start with when listing versioning objects in a bucket. All versioning objects following this parameter are listed in the lexicographical order.

+

ListVersionsRequest.KeyMarker

+

MaxKeys

+

Maximum number of listed versioning objects. The value ranges from 1 to 1000. If the specified value exceeds 1000, only 1,000 versioning objects are returned by default.

+

ListVersionsRequest.MaxKeys

+

Delimiter

+

Character used to group object names. If the object name contains the Delimiter parameter, the character string from the first character to the first delimiter in the object name is grouped under a single result element, CommonPrefix. (If a prefix is specified in the request, the prefix must be removed from the object name.)

+

ListVersionsRequest.Delimiter

+

VersionIdMarker

+

Object name to start with when listing versioning objects in a bucket. All versioning objects are listed in the lexicographical order by object name and version ID. This parameter must be used together with KeyMarker.

+

ListVersionsRequest.VersionIdMarker

+
+
+
  • If the value of VersionIdMarker is not a version ID specified by KeyMarker, VersionIdMarker is ineffective.
  • The returned result of ObsClient.ListVersions includes the versioning objects and delete markers.
+
+

Listing Versioning Objects in Simple Mode

The following sample code shows how to list versioning objects in simple mode. A maximum of 1000 versioning objects can be returned.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List versioning objects.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    ListVersionsResponse response = client.ListVersions(request);
+    foreach (ObsObjectVersion objectVersion in response.Versions)
+    {
+        Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+        Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+    }
+    Console.WriteLine("List versions response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

Information about a maximum of 1000 versioning objects can be listed each time. If a bucket contains more than 1000 objects and ListVersionsResponse.IsTruncated is true in the returned result, not all versioning objects are listed. In such cases, you can use ListVersionsResponse.NextKeyMarker and ListVersionsResponse.NextVersionIdMarker to obtain the start position for next listing.

+
+
+

Listing Versioning Objects by Specifying the Number

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List versioning objects by specifying the number.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    request.MaxKeys = 100;
+    ListVersionsResponse response = client.ListVersions(request);
+    foreach (ObsObjectVersion objectVersion in response.Versions)
+    {
+        Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+        Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+    }
+    Console.WriteLine("List versions response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing Versioning Objects by Specifying a Prefix

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List versioning objects by specifying a prefix.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    request.MaxKeys = 100;
+    request.Prefix = "prefix";
+    ListVersionsResponse response = client.ListVersions(request);
+    foreach (ObsObjectVersion objectVersion in response.Versions)
+    {
+        Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+        Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+    }
+    Console.WriteLine("List versions response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing Versioning Objects by Specifying the Start Position

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Specify the start position for listing.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    request.MaxKeys = 100;
+    request.Prefix = "prefix";
+    request.KeyMarker = "keyMarker";
+    ListVersionsResponse response = client.ListVersions(request);
+    foreach (ObsObjectVersion objectVersion in response.Versions)
+    {
+        Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+        Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+    }
+    Console.WriteLine("List versions response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing All Versioning Objects in Paging Mode

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List all versioning objects in paging mode.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    request.MaxKeys = 100;
+    ListVersionsResponse response;
+    do
+    {
+        response = client.ListVersions(request);
+        Console.WriteLine("List versions response: {0}", response.StatusCode);
+        foreach (ObsObjectVersion objectVersion in response.Versions)
+        {
+            Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+            Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+        }
+        request.KeyMarker = response.NextKeyMarker;
+        request.VersionIdMarker = response.NextVersionIdMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Listing All Versioning Objects in a Folder

There is no folder concept in OBS. All elements in buckets are objects. Folders are actually objects whose sizes are 0 and whose names end with a slash (/). When you set a folder name as the prefix, objects in this folder will be listed. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//List all versioning objects in paging mode.
+try
+{
+    ListVersionsRequest request = new ListVersionsRequest();
+    request.BucketName = "bucketname";
+    request.MaxKeys = 1000;
+    // Set the prefix to dir/.
+    request.Prefix = "dir/";
+    ListVersionsResponse response;
+    do
+    {
+        response = client.ListVersions(request);
+        Console.WriteLine("List versions response: {0}", response.StatusCode);
+        foreach (ObsObjectVersion objectVersion in response.Versions)
+        {
+            Console.WriteLine("Key: {0}", objectVersion.ObjectKey);
+            Console.WriteLine("VersionId: {0}", objectVersion.VersionId);
+        }
+        request.KeyMarker = response.NextKeyMarker;
+        request.VersionIdMarker = response.NextVersionIdMarker;
+    }
+    while (response.IsTruncated);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0808.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0808.html new file mode 100644 index 000000000..7d6b6d712 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0808.html @@ -0,0 +1,85 @@ + + +

Setting or Obtaining a Versioning Object ACL

+

Setting an ACL for an Object Version

You can call ObsClient.SetObjectAcl to pass the version ID (VersionId) to set an ACL for an object version. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set an ACL for an object version.
+try
+{
+    SetObjectAclRequest request = new SetObjectAclRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.VersionId = "versionId";
+    request.AccessControlList = new AccessControlList();
+    Owner owner = new Owner();
+    owner.Id = "ownerid";
+    request.AccessControlList.Owner = owner;
+    Grant item = new Grant();
+    item.Permission = PermissionEnum.FullControl;
+    item.Grantee = new GroupGrantee(GroupGranteeEnum.AllUsers);
+    request.AccessControlList.Grants.Add(item);
+    SetObjectAclResponse response = client.SetObjectAcl(request);
+    Console.WriteLine("Set object acl response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

The owner or grantee ID needed in the ACL indicates the account ID, which can be viewed on the My Credentials page of OBS Console.

+
+
+

Obtaining the ACL of an Object Version

You can call ObsClient.GetObjectAcl to pass the version ID (VersionId) to obtain the ACL of an object version. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain the ACL of a versioning object.
+try
+{
+    GetObjectAclRequest request = new GetObjectAclRequest();
+    request.BucketName = "bucketname";
+    request.ObjectKey = "objectname";
+    request.VersionId = "versionId";
+    GetObjectAclResponse response = client.GetObjectAcl(request);
+    Console.WriteLine("GetObjectAcl grant account: {0}", response.AccessControlList.Grants.Count);
+    Console.WriteLine("GetObjectAcl owner id: {0}", response.AccessControlList.Owner.Id);
+    foreach (Grant grant in response.AccessControlList.Grants)
+    {
+        if(grant.Grantee is CanonicalGrantee)
+        {
+              Console.WriteLine("Grantee id: {0}", (grant.Grantee as CanonicalGrantee).Id);
+        }else if(grant.Grantee is GroupGrantee)
+        {
+              Console.WriteLine("Grantee type: {0}", (grant.Grantee as GroupGrantee).GroupGranteeType);
+        }
+              Console.WriteLine("Grant permission: {0}", grant.Permission);
+        }
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0809.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0809.html new file mode 100644 index 000000000..143d9287a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0809.html @@ -0,0 +1,69 @@ + + +

Deleting Versioning Objects

+

Deleting a Single Versioning Object

You can call ObsClient.DeleteObject to pass a version ID (VersionId) to delete an object version.

+

This example deletes object objectname from bucket bucketname by specifying VersionId.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete a versioning object.
+try
+{
+    DeleteObjectRequest request = new DeleteObjectRequest()
+    {
+        BucketName = "buckername",
+        ObjectKey = "objectname",
+        VersionId = "versionId"
+    };
+    DeleteObjectResponse response = client.DeleteObject(request);
+    Console.WriteLine("Delete object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Deleting Versioning Objects in a Batch

You can call ObsClient.DeleteObjects to batch delete specific versions of an object by passing the VersionId value of each version to delete.

+

This example deletes objects objectname1 and objectname2 from bucket bucketname in a batch by specifying their version IDs.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete two versioning objects.
+try
+{
+    DeleteObjectsRequest request = new DeleteObjectsRequest();
+    request.BucketName = "bucketname";
+    request.Quiet = true;
+    request.AddKey("objectName1", "versionId1");
+    request.AddKey("objectName2", "versionId2");
+    DeleteObjectsResponse response = client.DeleteObjects(request);
+    Console.WriteLine("Delete objects response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0900.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0900.html new file mode 100644 index 000000000..d0cb0c1de --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0900.html @@ -0,0 +1,17 @@ + + +

Lifecycle Management

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0901.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0901.html new file mode 100644 index 000000000..f44496208 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0901.html @@ -0,0 +1,19 @@ + + +

Lifecycle Management Overview

+

OBS allows you to set lifecycle rules for buckets to automatically transition the storage class of an object and delete expired objects, to effectively use storage features and optimize the storage space. You can set multiple lifecycle rules to match different object name prefixes. A lifecycle rule must contain:

+ +

+
  • An object will be automatically deleted by the OBS server once it expires.
  • The time set in the transition policy of an object must be earlier than its expiration time, and the time set in the transition policy of a noncurrent object version must be earlier than its expiration time.
  • The configured expiration time and transition policy for a noncurrent object version will take effect only when the versioning is enabled or suspended for a bucket.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0902.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0902.html new file mode 100644 index 000000000..9f48189b1 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0902.html @@ -0,0 +1,91 @@ + + +

Setting Lifecycle Rules

+

You can call ObsClient.SetBucketLifecycle to set lifecycle rules.

+

Setting an Object Transition Policy

Sample code:
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Set an object transition policy.
+try
+{
+    SetBucketLifecycleRequest request = new SetBucketLifecycleRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new LifecycleConfiguration();
+    LifecycleRule rule1 = new LifecycleRule();
+    rule1.Id = "rule1";
+    rule1.Prefix = "prefix";
+    rule1.Status = RuleStatusEnum.Enabled;
+    Transition transition = new Transition();
+    rule1.Transitions.Add(transition);     
+    // Specify that objects whose names contain the specified prefix will be transitioned 30 days after creation.
+    transition.Days = 30;
+    // Specify the storage class that the object will be transitioned to.
+    transition.StorageClass = StorageClassEnum.Warm;
+    NoncurrentVersionTransition noncurrentVersionTransition  = new NoncurrentVersionTransition();
+    rule1.NoncurrentVersionTransitions.Add(noncurrentVersionTransition);
+    // Specify that objects whose names contain the specified prefix will be transitioned 60 days after becoming noncurrent versions.
+    noncurrentVersionTransition.NoncurrentDays = 60;
+    // Specify the storage class that a noncurrent version will be transitioned to.
+    noncurrentVersionTransition.StorageClass = StorageClassEnum.Warm;
+    request.Configuration.Rules.Add(rule1);
+    SetBucketLifecycleResponse response = client.SetBucketLifecycle(request);
+    Console.WriteLine("Set bucket lifecycle response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+

Setting an Object Expiration Time

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the object expiration time.
+try
+{
+    SetBucketLifecycleRequest request = new SetBucketLifecycleRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new LifecycleConfiguration();
+    LifecycleRule rule1 = new LifecycleRule();
+    rule1.Id = "rule1";
+    rule1.Prefix = "prefix";
+    rule1.Status = RuleStatusEnum.Enabled;
+    rule1.Expiration = new Expiration();
+    //Specify that objects whose names contain the prefix will expire 60 days after creation.
+    rule1.Expiration.Days = 60;
+    // Specify that objects whose names contain the prefix will expire 60 days after becoming noncurrent versions.
+    rule1.NoncurrentVersionExpiration = new NoncurrentVersionExpiration();
+    rule1.NoncurrentVersionExpiration.NoncurrentDays = 60;
+    request.Configuration.Rules.Add(rule1);
+    SetBucketLifecycleResponse response = client.SetBucketLifecycle(request);
+    Console.WriteLine("Set bucket lifecycle response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • Each time you call this API to configure a lifecycle rule, the lifecycle rules you previously configured will be overwritten.
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0903.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0903.html new file mode 100644 index 000000000..45d9ca6fb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0903.html @@ -0,0 +1,61 @@ + + +

Viewing Lifecycle Rules

+

You can call ObsClient.GetBucketLifecycle to view lifecycle rules.

+

This example views the lifecycle configuration of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// View the bucket lifecycle.
+try
+{
+    GetBucketLifecycleRequest request = new GetBucketLifecycleRequest();
+    request.BucketName = "bucketname";
+    GetBucketLifecycleResponse response = client.GetBucketLifecycle(request);
+    foreach (LifecycleRule lifecycleRule in response.Configuration.Rules)
+    {
+        Console.WriteLine("Lifecycle rule id: {0}", lifecycleRule.Id);
+        Console.WriteLine("Lifecycle rule prefix: {0}", lifecycleRule.Prefix);
+        Console.WriteLine("Lifecycle rule status: {0}", lifecycleRule.Status);
+        if (null != lifecycleRule.Expiration)
+        {
+            Console.WriteLine("expiration days: {0}", lifecycleRule.Expiration.Days);
+        }
+        if (null != lifecycleRule.NoncurrentVersionExpiration)
+        {
+            Console.WriteLine("NoncurrentVersionExpiration NoncurrentDays: {0}", lifecycleRule.NoncurrentVersionExpiration.NoncurrentDays);
+        }
+        foreach (Transition transition in lifecycleRule.Transitions)
+        {
+            Console.WriteLine("Transition Days : {0}", transition.Days);
+            Console.WriteLine("Transition StorageClass : {0}", transition.StorageClass);
+        }
+        foreach (NoncurrentVersionTransition noncurrentVersionTransition in lifecycleRule.NoncurrentVersionTransitions)
+        {
+            Console.WriteLine("NoncurrentVersionTransition NoncurrentDays: {0}", noncurrentVersionTransition.NoncurrentDays);
+            Console.WriteLine("NoncurrentVersionTransition StorageClass : {0}", noncurrentVersionTransition.StorageClass);
+        }
+        Console.WriteLine("Get bucket lifecycle response: {0}", response.StatusCode);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_0904.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_0904.html new file mode 100644 index 000000000..5f841d6bb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_0904.html @@ -0,0 +1,37 @@ + + +

Deleting Lifecycle Rules

+

You can call ObsClient.DeleteBucketLifecycle to delete lifecycle rules.

+

This example deletes the lifecycle configuration of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete bucket lifecycles.
+try
+{
+    DeleteBucketLifecycleRequest request = new DeleteBucketLifecycleRequest();
+    request.BucketName = "bucketname";
+    DeleteBucketLifecycleResponse response = client.DeleteBucketLifecycle(request);
+    Console.WriteLine("Delete bucket lifecycle response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1000.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1000.html new file mode 100644 index 000000000..4abab0aba --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1000.html @@ -0,0 +1,17 @@ + + +

CORS

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1001.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1001.html new file mode 100644 index 000000000..005f6f2fe --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1001.html @@ -0,0 +1,15 @@ + + +

CORS Overview

+

Cross-origin access refers to access between different domains. Restricting cross-origin access is a browser policy for security purposes, that is, the same-origin policy.

+

Due to this same-origin policy, JavaScript in origin A cannot operate objects in origin B or C.

+

The same-origin policy requires the protocols, domain names (or IP addresses), and ports are all the same. If the protocols, domain names, and ports (if specified) of the two web pages are the same, the two web pages are in the same origin.

+

CORS allows web application programs in one origin to access resources in another. OBS provides developers with APIs for facilitating cross-origin resource access.

+

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1002.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1002.html new file mode 100644 index 000000000..a9985f8d7 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1002.html @@ -0,0 +1,56 @@ + + +

Setting CORS Rules

+

You can call ObsClient.SetBucketCors to set CORS rules for a bucket. If the bucket is configured with CORS rules, the newly set ones will overwrite the existing ones.

+

This example sets a CORS rule for bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the CORS rules for a bucket.
+try
+{
+    SetBucketCorsRequest request = new SetBucketCorsRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new CorsConfiguration();
+    CorsRule rule = new CorsRule();
+    rule.Id = "20170820";
+    // Specify the origin of the cross-domain request.
+    rule.AllowedOrigins.Add("http://www.a.com");
+    rule.AllowedOrigins.Add("http://www.b.com");
+    // Specify whether headers specified in Access-Control-Request-Headers in the OPTIONS request can be used.
+    rule.AllowedHeaders.Add("x-obs-header");
+    // Specify the request method, which can be GET, PUT, DELETE, POST, or HEAD.
+    rule.AllowedMethods.Add(HttpVerb.HEAD);
+    rule.AllowedMethods.Add(HttpVerb.PUT);
+    rule.AllowedMethods.Add(HttpVerb.GET);
+    rule.AllowedMethods.Add(HttpVerb.POST);
+    rule.AllowedMethods.Add(HttpVerb.DELETE);
+    // Specify response headers that users can access using application programs.
+    rule.ExposeHeaders.Add("x-obs-test1");
+    rule.ExposeHeaders.Add("x-obs-test2");
+    rule.MaxAgeSeconds = 100;
+    request.Configuration.Rules.Add(rule);
+    SetBucketCorsResponse response = client.SetBucketCors(request);
+    Console.WriteLine("Set bucket cors response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • AllowedOrigins, AllowedMethods, and AllowedHeaders, respectively, can contain up to one wildcard character (*). Wildcard characters (*) indicate that all origins, operations, or headers are allowed.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1003.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1003.html new file mode 100644 index 000000000..7c27159d1 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1003.html @@ -0,0 +1,59 @@ + + +

Viewing CORS Rules

+

You can call ObsClient.GetBucketCors to view CORS rules of a bucket.

+

This example views the CORS rule of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// View CORS rules.
+try
+{
+
+    GetBucketCorsRequest request = new GetBucketCorsRequest();
+    request.BucketName = "bucketname";
+    GetBucketCorsResponse response = client.GetBucketCors(request);
+    foreach (CorsRule rule in response.Configuration.Rules)
+    {
+        Console.WriteLine("rule id is: {0}\n", rule.Id);
+        foreach (string allowOrigin in rule.AllowedOrigins)
+        {
+            Console.WriteLine("allowOrigin is: {0}\n", allowOrigin);
+        }
+        foreach (string allowHeader in rule.AllowedHeaders)
+        {
+            Console.WriteLine("allowHeader is: {0}\n", allowHeader);
+        }
+        foreach (HttpVerb allowMethod in rule.AllowedMethods)
+        {
+            Console.WriteLine("allowMethod is: {0}\n", allowMethod);
+        }
+        foreach (string exposeHeader in rule.ExposeHeaders)
+        {
+            Console.WriteLine("exposeHeader is: {0}\n", exposeHeader);
+        }
+        Console.WriteLine("rule maxAgeSeconds is: {0}\n", rule.MaxAgeSeconds);
+
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1004.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1004.html new file mode 100644 index 000000000..66a606b5b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1004.html @@ -0,0 +1,37 @@ + + +

Deleting CORS Rules

+

You can call ObsClient.DeleteBucketCors to delete CORS rules of a bucket.

+

This example deletes the CORS rule of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete CORS rules.
+try
+{
+    DeleteBucketCorsRequest request = new DeleteBucketCorsRequest();
+    request.BucketName = "bucketname";
+    DeleteBucketCorsResponse response = client.DeleteBucketCors(request);
+    Console.WriteLine("Delete bucket cors response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1100.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1100.html new file mode 100644 index 000000000..f2861d5b9 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1100.html @@ -0,0 +1,17 @@ + + +

Access Logging

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1101.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1101.html new file mode 100644 index 000000000..1dbc6f7c8 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1101.html @@ -0,0 +1,15 @@ + + +

Logging Overview

+

OBS allows you to configure access logging for buckets. After the configuration, access to buckets will be recorded in the format of logs. These logs will be saved in specific buckets in OBS.

+

You can enable OBS logging for bucket analysis or audit purposes. With access logs, a bucket owner can analyze the characteristics, types, or trends of requests sent to the bucket.

+

With logging enabled, OBS automatically logs access requests for the bucket and writes the generated log files into a specified bucket.

+

You need to specify a bucket for storing log files when enabling logging for a bucket. Log files can be stored in any bucket (including the logged bucket itself) you own in the region where the logged bucket is.

+

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1102.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1102.html new file mode 100644 index 000000000..46c0f5c73 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1102.html @@ -0,0 +1,43 @@ + + +

Enabling Bucket Logging

+

You can call ObsClient.SetBucketLogging to enable bucket logging

+

The source bucket and target bucket of logging must be in the same region.

+
+

If the bucket is in the OBS Warm or Cold storage class, it cannot be used as the target bucket.

+
+

Enabling Bucket Logging

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    // Set the source bucket logging.
+    SetBucketLoggingRequest putrequest = new SetBucketLoggingRequest();
+    putrequest.BucketName = "bucketname";
+    putrequest.Configuration = new LoggingConfiguration();
+    putrequest.Configuration.TargetBucketName = "targetbucketname";
+    putrequest.Configuration.TargetPrefix = "access-log.";
+    putrequest.Configuration.Agency= "your agency";
+    SetBucketLoggingResponse putresponse = client.SetBucketLogging(putrequest);
+    Console.WriteLine("Set bucket logging response: {0}", putresponse.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1103.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1103.html new file mode 100644 index 000000000..6cdeb1041 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1103.html @@ -0,0 +1,41 @@ + + +

Viewing Bucket Logging

+

You can call ObsClient.GetBucketLogging to view the logging configuration of a bucket.

+

This example views the logging configuration of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// View bucket logging.
+try
+{
+    GetBucketLoggingRequest request = new GetBucketLoggingRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketLoggingResponse response = client.GetBucketLogging(request);
+    Console.WriteLine("TargetBucketName is : " + response.Configuration.TargetBucketName);
+    Console.WriteLine("TargetPrefix is : " + response.Configuration.TargetPrefix);
+    Console.WriteLine("Get bucket logging response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1104.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1104.html new file mode 100644 index 000000000..76a1e14bb --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1104.html @@ -0,0 +1,37 @@ + + +

Disabling Bucket Logging

+

To disable logging for a bucket is to call ObsClient.SetBucketLogging to delete the logging configuration.

+

This example disables logging for bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    SetBucketLoggingRequest putrequest = new SetBucketLoggingRequest();
+    putrequest.BucketName = "bucketname";//Source bucket
+    putrequest.Configuration = new LoggingConfiguration();
+    SetBucketLoggingResponse putresponse = client.SetBucketLogging(putrequest);
+    Console.WriteLine("Delete bucket logging response: {0}", putresponse.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1200.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1200.html new file mode 100644 index 000000000..ccde5e7c0 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1200.html @@ -0,0 +1,19 @@ + + +

Static Website Hosting

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1201.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1201.html new file mode 100644 index 000000000..92b72a52b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1201.html @@ -0,0 +1,15 @@ + + +

Static Website Hosting Overview

+

Static websites typically only contain static web pages and some scripts that can run on clients (such as JavaScript and Flash). In contrast, dynamic websites depend on scripts that need to be processed on the server side, including PHP, JSP, and ASP.Net.

+

To host your static website on OBS, you can upload static website files to your bucket as objects, configure the public read permission for the objects, and then configure static website hosting for your bucket.

+

After this, when third-party users access your websites, they actually access the objects in your bucket in OBS.

+

When using static website hosting, you can configure request redirection to redirect specific or all requests.

+

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1202.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1202.html new file mode 100644 index 000000000..586500833 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1202.html @@ -0,0 +1,45 @@ + + +

Website File Hosting

+

You can perform the following to implement website file hosting:

+
  1. Upload the website files to your bucket in OBS as objects and set the MIME type for the objects.
  2. Set the object ACL to public read.
  3. Access the objects using a browser.
+

+

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+try
+{
+    //Set the MIME type for an object.
+    PutObjectRequest request = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "test.html",
+        FilePath = "localfile.html",// Path of the local file uploaded. The file name must be specified.
+        CannedAcl = CannedAclEnum.PublicRead,//Set the object ACL to public read.
+        ContentType = "text/html",
+    };
+    // Upload an object.
+    PutObjectResponse response = client.PutObject(request);
+    Console.WriteLine("put object response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

You can use https://bucketname.your-endpoint/test.html in a browser to access files hosted using the sample code.

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1203.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1203.html new file mode 100644 index 000000000..1ee4068b2 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1203.html @@ -0,0 +1,106 @@ + + +

Setting Website Hosting

+

You can call ObsClient.SetBucketWebsite to set website hosting on a bucket.

+

Configuring the Default Homepage and Error Pages

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+//Configure the homepage and error pages.
+try
+{
+    SetBucketWebsiteRequest request = new SetBucketWebsiteRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new WebsiteConfiguration();
+    //Configure the default homepage.
+    request.Configuration.IndexDocument = "index.html";
+    //Configure the error pages.
+    request.Configuration.ErrorDocument = "error.html";
+    SetBucketWebsiteResponse response = client.SetBucketWebsiteConfiguration(request);
+    Console.WriteLine("Set bucket website response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Configuring the Redirection Rules

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set the redirection rule.
+try
+{
+    SetBucketWebsiteRequest request = new SetBucketWebsiteRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new WebsiteConfiguration(); //Configure the default homepage.
+    request.Configuration.IndexDocument= "index.html";
+    //Configure the error pages.
+    request.Configuration.ErrorDocument = "error.html";
+    RoutingRule routingRule = new RoutingRule();
+    routingRule.Redirect = new Redirect();
+    routingRule.Redirect.HostName = "www.example.com";
+    routingRule.Redirect.HttpRedirectCode = "305";
+    routingRule.Redirect.Protocol = ProtocolEnum.Http;
+    routingRule.Redirect.ReplaceKeyPrefixWith = "replacekeyprefix";
+    routingRule.Condition = new Condition();
+    routingRule.Condition.HttpErrorCodeReturnedEquals = "404";
+    routingRule.Condition.KeyPrefixEquals = "keyprefix";
+    request.Configuration.RoutingRules.Add(routingRule);
+    SetBucketWebsiteResponse response = client.SetBucketWebsiteConfiguration(request);
+    Console.WriteLine("Set bucket website response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+

Configuring Redirection for All Requests

Sample code:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Configure redirection for all requests.
+try
+{
+    SetBucketWebsiteRequest request = new SetBucketWebsiteRequest();
+    request.BucketName = "bucketname";
+    request.Configuration = new WebsiteConfiguration();
+    request.Configuration.RedirectAllRequestsTo = new RedirectBasic();
+    request.Configuration.RedirectAllRequestsTo.HostName = "www.example.com";
+    request.Configuration.RedirectAllRequestsTo.Protocol = ProtocolEnum.Https;
+    SetBucketWebsiteResponse response = client.SetBucketWebsiteConfiguration(request);
+    Console.WriteLine("Set bucket website response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1204.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1204.html new file mode 100644 index 000000000..98f243da3 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1204.html @@ -0,0 +1,39 @@ + + +

Viewing Website Hosting Settings

+

You can call ObsClient.GetBucketWebsite to view the hosting settings of a bucket.

+

This example views the hosting configuration of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// View hosting settings.
+try
+{
+    GetBucketWebsiteRequest request = new GetBucketWebsiteRequest();
+    request.BucketName = "bucketname";
+    GetBucketWebsiteResponse response = client.GetBucketWebsite(request);
+    Console.WriteLine("GetBucketWebsite website configuration error document: {0}", response.Configuration.ErrorDocument);
+    Console.WriteLine("GetBucketWebsite website configuration index document: {0}", response.Configuration.IndexDocument);
+    Console.WriteLine("Get bucket website response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1205.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1205.html new file mode 100644 index 000000000..ebbfdd42a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1205.html @@ -0,0 +1,37 @@ + + +

Deleting Website Hosting Settings

+

You can call ObsClient.DeleteBucketWebsite to delete the hosting settings of a bucket.

+

This example deletes the hosting configuration of bucket bucketname.

+

The example code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete hosting settings.
+try
+{
+    DeleteBucketWebsiteRequest request = new DeleteBucketWebsiteRequest();
+    request.BucketName = "bucketname";
+    DeleteBucketWebsiteResponse response = client.DeleteBucketWebsite(request);
+    Console.WriteLine("Delete bucket website response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1300.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1300.html new file mode 100644 index 000000000..6c06588f6 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1300.html @@ -0,0 +1,17 @@ + + +

Tag Management

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1301.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1301.html new file mode 100644 index 000000000..ab3770f85 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1301.html @@ -0,0 +1,12 @@ + + +

Tagging Overview

+

Tags are used to identify and classify OBS buckets.

+

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1302.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1302.html new file mode 100644 index 000000000..6409206ce --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1302.html @@ -0,0 +1,43 @@ + + +

Setting Bucket Tags

+

You can call ObsClient.SetBucketTagging to set bucket tags. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Set bucket tags.
+try
+{
+    SetBucketTaggingRequest request = new SetBucketTaggingRequest();
+    request.BucketName = "bucketname";
+    Tag tag1 = new Tag();
+    tag1.Key = "tag1";
+    tag1.Value = "value1";
+    Tag tag2 = new Tag();
+    tag2.Key = "tag2";
+    tag2.Value = "value2";
+    request.Tags.Add(tag2);
+    request.Tags.Add(tag1);
+    SetBucketTaggingResponse response = client.SetBucketTagging(request);
+    Console.WriteLine("Set bucket tag response: {0}", response.StatusCode);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
  • A bucket can have up to 10 tags.
  • The key and value pair of a tag can be composed of Unicode characters.
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1303.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1303.html new file mode 100644 index 000000000..1752e4fab --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1303.html @@ -0,0 +1,39 @@ + + +

Viewing Bucket Tags

+

You can call ObsClient.GetBucketTagging to view bucket tags. The following code shows how to view bucket tags.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Obtain bucket tags.
+try
+{
+    GetBucketTaggingRequest request = new GetBucketTaggingRequest
+    {
+        BucketName = "bucketname",
+    };
+    GetBucketTaggingResponse response = client.GetBucketTagging(request);
+    foreach (Tag tag in response.Tags)
+    {
+        Console.WriteLine("Get bucket Tagging response Key: {0}" + tag.Key);
+        Console.WriteLine("Get bucket Tagging response Value:{0} " + tag.Value);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1304.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1304.html new file mode 100644 index 000000000..08d6ae524 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1304.html @@ -0,0 +1,36 @@ + + +

Deleting Bucket Tags

+

You can call ObsClient.DeleteBucketTagging to delete bucket tags. Sample code is as follows:

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Delete bucket tags.
+try
+{
+    DeleteBucketTaggingRequest request = new DeleteBucketTaggingRequest
+    {
+        BucketName = "bucketname",
+    };
+    DeleteBucketTaggingResponse response = client.DeleteBucketTagging(request);
+    Console.WriteLine("Delete bucket tag response: {0}", response.StatusCode);
+}
+
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1500.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1500.html new file mode 100644 index 000000000..599973fdf --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1500.html @@ -0,0 +1,15 @@ + + +

Server-Side Encryption

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1501.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1501.html new file mode 100644 index 000000000..6b80eb81a --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1501.html @@ -0,0 +1,12 @@ + + +

Server-Side Encryption Overview

+

OBS supports server-side encryption.

+

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1502.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1502.html new file mode 100644 index 000000000..79e96e865 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1502.html @@ -0,0 +1,75 @@ + + +

Encryption Description

+

The following table lists APIs related to server-side encryption:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

OBS .NET SDK API Function

+

Description

+

Supported Encryption Type

+

ObsClient.PutObject

+

Sets the encryption algorithm and key during object upload to enable server-side encryption.

+

SSE-KMS

+

SSE-C

+

ObsClient.GetObject

+

Sets the decryption algorithm and key during object download to decrypt the object.

+

SSE-C

+

ObsClient.CopyObject

+
  1. Sets the decryption algorithm and key for decrypting the source object during object copy.
  2. Sets the encryption algorithm and key during object copy to enable the encryption algorithm for the target object.
+

SSE-KMS

+

SSE-C

+

ObsClient.GetObjectMetadata

+

Sets the decryption algorithm and key when obtaining the object metadata to decrypt the object.

+

SSE-C

+

ObsClient.InitiateMultipartUpload

+

Sets the encryption algorithm and key when initializing a multipart upload to enable server-side encryption for the final object generated.

+

SSE-KMS

+

SSE-C

+

ObsClient.UploadPart

+

Sets the encryption algorithm and key during multipart upload to enable server-side encryption for parts.

+

SSE-C

+

ObsClient.CopyPart

+
  1. Sets the decryption algorithm and key for decrypting the source object during partial object copy.
  2. Sets the encryption algorithm and key during partial object copy to enable the encryption algorithm for the target object part.
+

SSE-C

+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1503.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1503.html new file mode 100644 index 000000000..9258b23f6 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1503.html @@ -0,0 +1,95 @@ + + +

Example of Encryption

+

Encrypting an Object to Be Uploaded

Sample code:

+
+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Generate an encryption key.
+System.Security.Cryptography.Aes aesEncryption = System.Security.Cryptography.Aes.Create();
+aesEncryption.KeySize = 256;
+aesEncryption.GenerateKey();
+string customerkey = Convert.ToBase64String(aesEncryption.Key);
+// Configure the local file to be encrypted before an upload based on the site requirements.
+string filePathKms = "D:\\test\\testSseC.zip";
+string filePathSseC = "D:\\test\\testSseC.zip";
+// Upload the object.
+try
+{
+    // When uploading an object, use the SSE-KMS algorithm to encrypt the object.
+    SseKmsHeader kms = new SseKmsHeader();
+    kms.Algorithm = SseKmsAlgorithmEnum.Kms;
+    PutObjectRequest request1 = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname1",
+        FilePath = filePathKms,
+        SseHeader = kms,
+    };
+    client.PutObject(request1);
+    // When uploading an object, use the SSE-C algorithm to encrypt the object.
+    PutObjectRequest request2 = new PutObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname2",
+        FilePath = filePathSseC,
+        SseHeader = new SseCHeader()
+        {
+            Algorithm = SseCAlgorithmEnum.Aes256,
+            KeyBase64 = customerkey
+        }
+    };
+    client.PutObject(request2);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+

Decrypting a To-Be-Download Object

Sample code:

+
+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Download an object.
+try
+{
+    // When downloading an object, use the SSE-C algorithm to decrypt it.
+    GetObjectRequest request = new GetObjectRequest
+    {
+        BucketName = "bucketname",
+        ObjectKey = "objectname2",
+        // The key used here must be the one used for uploading the object.
+        SseCHeader = new SseCHeader()
+        {
+            Algorithm = SseCAlgorithmEnum.Aes256,
+            KeyBase64 = "customerkey"
+        }
+    };
+    client.GetObject(request);
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1600.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1600.html new file mode 100644 index 000000000..db80c047f --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1600.html @@ -0,0 +1,17 @@ + + +

Troubleshooting

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1601.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1601.html new file mode 100644 index 000000000..3768283f7 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1601.html @@ -0,0 +1,773 @@ + + +

OBS Server-Side Error Codes

+

If the OBS server encounters an error when processing a request, a response containing the error code and error description is returned. The following table lists details about each error code and HTTP status code.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Error Code

+

Description

+

HTTP Status Code

+

AccessDenied

+

Access denied.

+

403 Forbidden

+

AccessForbidden

+

Insufficient permission.

+

403 Forbidden

+

AccountProblem

+

Your account is abnormal (for example, being expired or frozen).

+

403 Forbidden

+

AllAccessDisabled

+

The user has no permission to perform a specific operation.

+

403 Forbidden

+

AmbiguousGrantByEmailAddress

+

The provided email address is associated with more than one account.

+

400 Bad Request

+

BadDigest

+

The specified value of Content-MD5 does not match the value received by OBS.

+

400 Bad Request

+

BadDomainName

+

Invalid domain name.

+

400 Bad Request

+

BadRequest

+

Invalid request parameter.

+

400 Bad Request

+

BucketAlreadyExists

+

The requested bucket name already exists. The bucket namespace is shared by all users of OBS. Try again with another bucket name.

+

409 Conflict

+

BucketAlreadyOwnedByYou

+

Your previous request for creating the named bucket succeeded and you already own it.

+

409 Conflict

+

BucketNotEmpty

+

The bucket that you tried to delete is not empty.

+

409 Conflict

+

CredentialsNotSupported

+

This request does not support security credentials.

+

400 Bad Request

+

CustomDomainAreadyExist

+

The configured domain already exists.

+

400 Bad Request

+

CustomDomainNotExist

+

The domain to be operated does not exist.

+

400 Bad Request

+

DeregisterUserId

+

The user has been deregistered.

+

403 Forbidden

+

EntityTooSmall

+

The size of the object to be uploaded is smaller than the lower limit.

+

400 Bad Request

+

EntityTooLarge

+

The size of the object to be uploaded exceeds the limit.

+

400 Bad Request

+

FrozenUserId

+

The user has been frozen.

+

403 Forbidden

+

IllegalVersioningConfiguration Exception

+

Invalid versioning configuration in the request

+

400 Bad Request

+

IllegalLocationConstraintException

+

The configured region limitation is inconsistent with the region where it resides.

+

400 Bad Request

+

InArrearOrInsufficientBalance

+

The subscriber owes fees or the account balance is insufficient, and the subscriber does not have the permission to perform an operation.

+

403 Forbidden

+

IncompleteBody

+

Incomplete request body.

+

400 Bad Request

+

IncorrectNumberOfFilesInPost Request

+

Each POST request must contain one file to be uploaded.

+

400 Bad Request

+

InlineDataTooLarge

+

The size of inline data exceeds the upper limit.

+

400 Bad Request

+

InsufficientStorageSpace

+

Insufficient storage space.

+

403 Forbidden

+

InternalError

+

An internal error occurs. Try again later.

+

500 Internal Server Error

+

InvalidAccessKeyId

+

The access key ID provided by the customer does not exist in the system.

+

403 Forbidden

+

InvalidAddressingHeader

+

The anonymous role must be specified.

+

N/A

+

InvalidArgument

+

Invalid parameter.

+

400 Bad Request

+

InvalidBucketName

+

The specified bucket name in the request is invalid.

+

400 Bad Request

+

InvalidBucket

+

The bucket to be accessed does not exist.

+

400 Bad Request

+

InvalidBucketState

+

Invalid bucket status.

+

409 Conflict

+

InvalidBucketStoragePolicy

+

An invalid new policy is specified during bucket policy modification.

+

400 Bad Request

+

InvalidDigest

+

The specified Content-MD5 in the HTTP header is invalid.

+

400 Bad Request

+

InvalidEncryptionAlgorithmError

+

Incorrect encryption algorithm.

+

400 Bad Request

+

InvalidLocationConstraint

+

The location specified during bucket creation is invalid.

+

400 Bad Request

+

InvalidPart

+

One or more specified parts are not found. The parts may not be uploaded or the specified entity tags (ETags) do not match the parts' ETags.

+

400 Bad Request

+

InvalidPartOrder

+

Parts are not listed in ascending order by part number.

+

400 Bad Request

+

InvalidPayer

+

All accesses to this object are disabled.

+

403 Forbidden

+

InvalidPolicyDocument

+

The content of the form does not meet the conditions specified in the policy document.

+

400 Bad Request

+

InvalidRange

+

The requested range cannot be obtained.

+

416 Client Requested Range Not Satisfiable

+

InvalidRedirectLocation

+

Invalid redirect location.

+

400 Bad Request

+

InvalidRequest

+

Invalid request.

+

400 Bad Request

+

InvalidRequestBody

+

Invalid POST request body.

+

400 Bad Request

+

InvalidSecurity

+

Invalid security credentials.

+

403 Forbidden

+

InvalidStorageClass

+

The specified storage class is invalid.

+

400 Bad Request

+

InvalidTargetBucketForLogging

+

The delivery group has no ACL permission for the target bucket.

+

400 Bad Request

+

InvalidURI

+

The specified URI cannot be resolved.

+

400 Bad Request

+

KeyTooLong

+

The provided key is too long.

+

400 Bad Request

+

MalformedACLError

+

The provided XML file has syntax errors or does not meet the format requirements.

+

400 Bad Request

+

MalformedError

+

The XML format in the request is incorrect.

+

400 Bad Request

+

MalformedLoggingStatus

+

The XML format of Logging is incorrect.

+

400 Bad Request

+

MalformedPolicy

+

The bucket policy does not pass.

+

400 Bad Request

+

MalformedPOSTRequest

+

The body of the POST request is in an incorrect format.

+

400 Bad Request

+

MalformedQuotaError

+

The Quota XML format is incorrect.

+

400 Bad Request

+

MalformedXML

+

An XML file of a configuration item is in incorrect format. The error message states: "The XML you provided was not well-formed or did not validate against our published schema."

+

400 Bad Request

+

MaxMessageLengthExceeded

+

The request is too long.

+

400 Bad Request

+

MaxPostPreDataLengthExceeded Error

+

The POST request fields prior to the file to be uploaded are too large.

+

400 Bad Request

+

MetadataTooLarge

+

The size of the metadata header has exceeded the upper limit.

+

400 Bad Request

+

MethodNotAllowed

+

The specified method is not allowed against the requested resource.

+

The message "Specified method is not supported." is returned.

+

405 Method Not Allowed

+

MissingContentLength

+

The HTTP header Content-Length is not provided.

+

411 Length Required

+

MissingRegion

+

The region information is missing in the request, and the default region is required in the system.

+

400 Bad Request

+

MissingRequestBodyError

+

An empty XML file is sent as a request. The error message states: "Request body is empty."

+

400 Bad Request

+

MissingRequiredHeader

+

A required header is missing in the request.

+

400 Bad Request

+

MissingSecurityHeader

+

A required header is missing in the request.

+

400 Bad Request

+

NoSuchBucket

+

The bucket does not exist.

+

404 Not Found

+

NoSuchBucketPolicy

+

No bucket policy exists.

+

404 Not Found

+

NoSuchCORSConfiguration

+

No CORS configuration exists.

+

404 Not Found

+

NoSuchCustomDomain

+

The requested user domain does not exist.

+

404 Not Found

+

NoSuchKey

+

The specified key does not exist.

+

404 Not Found

+

NoSuchLifecycleConfiguration

+

The requested Lifecycle does not exist.

+

404 Not Found

+

NoSuchPolicy

+

The specified policy name does not exist.

+

404 Not Found

+

NoSuchUpload

+

The specified multipart upload does not exist. The upload ID does not exist or the multipart upload job has been aborted or completed.

+

404 Not Found

+

NoSuchVersion

+

The specified version ID does not match any existing version.

+

404 Not Found

+

NoSuchWebsiteConfiguration

+

The requested website does not exist.

+

404 Not Found

+

NotImplemented

+

The provided header implies a function that is unavailable.

+

501 Not Implemented

+

NotSignedUp

+

Your account is not signed up in the system. Sign up the account before use.

+

403 Forbidden

+

OperationAborted

+

A conflicting operation is being performed on this resource. Try again later.

+

409 Conflict

+

PermanentRedirect

+

The requested bucket has been permanently redirected to a new URL. All future requests must be sent to the new URL.

+

301 Moved Permanently

+

PreconditionFailed

+

At least one of the specified preconditions is not met.

+

412 Precondition Failed

+

Redirect

+

The request is temporarily redirected.

+

307 Moved Temporarily

+

RequestIsNotMultiPartContent

+

A bucket POST request must contain an enclosure-type multipart or the form-data.

+

400 Bad Request

+

RequestTimeout

+

No read or write operation has been performed within the timeout period of the socket connection between the user and the server.

+

400 Bad Request

+

RequestTimeTooSkewed

+

The request time and the server's time differ a lot.

+

403 Forbidden

+

RequestTorrentOfBucketError

+

Requesting the bucket's torrent file is not allowed.

+

400 Bad Request

+

ServiceNotImplemented

+

The request method is not implemented by the server.

+

501 Not Implemented

+

ServiceNotSupported

+

The request method is not supported by the server.

+

409 Conflict

+

ServiceUnavailable

+

The server is overloaded or has internal errors.

+

503 Service Unavailable

+

SignatureDoesNotMatch

+

The provided signature in the request does not match the signature calculated by OBS. Check your AK and SK and signature calculation method.

+

403 Forbidden

+

SlowDown

+

Reduce your request frequency.

+

503 Service Unavailable

+

System Capacity Not enough

+

Insufficient system space.

+

403 Forbidden

+

TooManyCustomDomains

+

Too many user domains are configured.

+

400 Bad Request

+

TemporaryRedirect

+

The request is redirected to the bucket while the domain name server (DNS) is being updated.

+

307 Moved Temporarily

+

TooManyBuckets

+

You have attempted to create more buckets than allowed.

+

400 Bad Request

+

TooManyObjectCopied

+

The number of copies of a single object exceeds the upper limit.

+

400 Bad Request

+

TooManyWrongSignature

+

The request is rejected due to high-frequency errors.

+

400 Bad Request

+

UnexpectedContent

+

This request does not support fields with content.

+

400 Bad Request

+

UnresolvableGrantByEmailAddress

+

The provided email address does not match any recorded accounts.

+

400 Bad Request

+

UserKeyMustBeSpecified

+

The user's AK is not carried in the request.

+

400 Bad Request

+

WebsiteRedirect

+

The website request lacks bucketName.

+

301 Moved Permanently

+

KMS.DisabledException

+

The master key is disabled in the SSE-KMS mode.

+

400 Bad Request

+

KMS.NotFoundException

+

The customer master key (CMK) does not exist in SSE-KMS mode.

+

400 Bad Request

+

RestoreAlreadyInProgress

+

The Archive object is being restored. The request conflicts with another one.

+

409 Conflict

+

ObjectHasAlreadyRestored

+

The objects have been restored and the retention period of the objects cannot be shortened.

+

409 Conflict

+

InvalidObjectState

+

The restored object is not a Cold object.

+

403 Forbidden

+

InvalidTagError

+

An invalid tag is provided when configuring the bucket tag.

+

400 Bad Request

+

NoSuchTagSet

+

The specified bucket does not have a tag.

+

404 Not Found

+
+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1602.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1602.html new file mode 100644 index 000000000..72c2511af --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1602.html @@ -0,0 +1,30 @@ + + +

Log Analysis

+

Log Path

Log files of OBS .NET SDK are saved in the path, usually the save directory of executable files of the project, specified in configuration file Log4Net.config.

+
+

Log Level

When current logs cannot be used to troubleshoot system faults, you can change the log level to obtain more information. You can obtain the most information in DEBUG logs and the least information in ERROR logs.

+

+

Log level description:

+ +
+

Analysis Method

To analyze and locate a problem or view the running status, you can find the related log file based on the date and view the running status or view logs in the log file for troubleshooting.

+

+

The procedure is as follows:

+
  1. Find related logs.

    Find related API logs in the log file directory based on the time when the exception occurred and the operation. The following is an example of error logs:

    +
    2018-05-23 21:55:02,103 [9] INFO  - ListObjectsRequest begin.
    +2018-05-23 21:55:02,526 [9] INFO  - Send http request end, cost 385 ms
    +2018-05-23 21:55:02,536 [9] ERROR - Rethrowing as a ObsException error in PerformRequest
    +Request error, StatusCode:404, ErrorCode:NoSuchBucket, ErrorMessage:The specified bucket does not exist, RequestId:0403000001638D4819383F2D4A2B2C50, HostId:N8OMsHew7O/LMHua8qpm49geWphVJI6l2mnnzUIYwQwHAuzJw/kmV+O4iIcf0GRR
    +2018-05-23 21:55:02,548 [9] ERROR - ListObjectsRequest exception code: NoSuchBucket, with message: Request error
    +2018-05-23 21:55:02,553 [9] INFO  - ListObjectsRequest end, cost 449 ms
    +

  2. Analyze the cause based on the error logs.

    Assuming that the error code you obtain from the log file is NoSuchBucket, you can check it from the table in OBS Server-Side Error Codes and know the error information is "The specified bucket does not exist."

    +

+
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1605.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1605.html new file mode 100644 index 000000000..7932df5ff --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1605.html @@ -0,0 +1,42 @@ + + +

SDK Common Response Headers

+

After you call an API in an instance of ObsClient, a sub-class of ObsWebServiceResponse will be returned.

+

It includes HTTP/HTTPS response headers.

+

This example obtains request-id from the common response headers when creating a bucket.

+
// Initialize configuration parameters.
+ObsConfig config = new ObsConfig();
+config.Endpoint = "https://your-endpoint";
+// Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables AccessKeyID and SecretAccessKey.
+// Obtain an AK/SK pair on the management console.
+string accessKey= Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine);
+string secretKey= Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine);
+// Create an instance of ObsClient.
+ObsClient client = new ObsClient(accessKey, secretKey, config);
+// Create a bucket.
+try
+{
+    CreateBucketRequest request = new CreateBucketRequest()
+    {
+        BucketName = "bucketname",
+    };
+    ObsWebServiceResponse response = client.CreateBucket(request);
+    // Obtain the request ID from the common response headers.
+    Console.WriteLine("RequestId: {0}", response.RequestId);
+    foreach(KeyValuePair<string,string> entry in res.Headers)
+    {
+        Console.WriteLine("{0}:{1}", entry.Key, entry.Value);
+    }
+}
+catch (ObsException ex)
+{
+    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
+    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
+}
+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1606.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1606.html new file mode 100644 index 000000000..e2c7e780b --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1606.html @@ -0,0 +1,13 @@ + + +

SDK Custom Exceptions

+

SDK custom exceptions (ObsException) are thrown by ObsClient. Exceptions are usually OBS server-side errors, including OBS error codes and error information and aim to help users locate problems and troubleshot faults.

+

ObsException contains the following error information:

+ +
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1700.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1700.html new file mode 100644 index 000000000..060a8307e --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1700.html @@ -0,0 +1,11 @@ + + +

FAQ

+
+
+ +
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/obs_25_1802.html b/docs/obs_3rd_party/dotnet_sdk/obs_25_1802.html new file mode 100644 index 000000000..e512210e7 --- /dev/null +++ b/docs/obs_3rd_party/dotnet_sdk/obs_25_1802.html @@ -0,0 +1,27 @@ + + +

Change History

+
+
+ + + + + + + + + + +

Release Date

+

What's New

+

2026-01-16

+

This is the second official release.

+

Update:

+

Updated the download link in SDK Download Links.

+

2024-06-25

+

This is the first official release.

+
+
+
+ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/caution_3.0-en-us.png b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/caution_3.0-en-us.png new file mode 100644 index 000000000..60f607621 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/caution_3.0-en-us.png differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/danger_3.0-en-us.png b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/danger_3.0-en-us.png new file mode 100644 index 000000000..47a9c7235 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/danger_3.0-en-us.png differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/delta.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/delta.gif new file mode 100644 index 000000000..0d1b1f674 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/delta.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/deltaend.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/deltaend.gif new file mode 100644 index 000000000..cc7da0fc8 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/deltaend.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowdn.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowdn.gif new file mode 100644 index 000000000..379428032 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowdn.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowrt.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowrt.gif new file mode 100644 index 000000000..6aaaa11c2 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-arrowrt.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-caution.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-caution.gif new file mode 100644 index 000000000..079c79b26 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-caution.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-danger.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-danger.gif new file mode 100644 index 000000000..079c79b26 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-danger.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-huawei.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-huawei.gif new file mode 100644 index 000000000..a31d60f89 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-huawei.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-note.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-note.gif new file mode 100644 index 000000000..31be2b039 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-note.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-notice.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-notice.gif new file mode 100644 index 000000000..409070650 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-notice.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-tip.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-tip.gif new file mode 100644 index 000000000..c47bae05c Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-tip.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-warning.gif b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-warning.gif new file mode 100644 index 000000000..079c79b26 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/icon-warning.gif differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/note_3.0-en-us.png b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/note_3.0-en-us.png new file mode 100644 index 000000000..57a0e1f53 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/note_3.0-en-us.png differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/notice_3.0-en-us.png b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/notice_3.0-en-us.png new file mode 100644 index 000000000..fa4b64990 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/notice_3.0-en-us.png differ diff --git a/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/warning_3.0-en-us.png b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/warning_3.0-en-us.png new file mode 100644 index 000000000..def5c3565 Binary files /dev/null and b/docs/obs_3rd_party/dotnet_sdk/public_sys-resources/warning_3.0-en-us.png differ