解决方案 »
- openstack配置时提示需要两张网卡,但电脑只有一张网卡怎么办啊?
- 华为桌面云 【经典案例&知识汇总】
- 平台服务:云计算战略的转移
- java mapreduce wordcount 统计出现次数
- ios中如何调用js
- 【求助】docker容器的ifconfig失败,容器内的apt-get update无法连接
- 请教一下关于spark hbase 的插入问题
- docker内的ubuntu为什么没有ping,vi等常用命令?
- 求大神给套方案
- docker使用overlay网络模式,为什么主机ping不通本机的容器,容器里ping跨主机容器ip、所有宿主机ip都正常
- nova-volume和swift的区别
- 如何在没网环境下搭建swift
csharp-swiftusing System;
using System.IO;
using System.Collections.Generic;
using System.Text;using OpenStack.Swift;namespace SwiftClientCSharp
{
class Program
{
public static void Main(string[] args)
{
SwiftClient sc = new SwiftClient();
sc.DisableSSLCertificateValidation();
string url="https://192.168.179.61:8080/auth/v1.0";
string user="system:root";
string key="testpass";
Dictionary<string,string> headers = new Dictionary<string, string>();
Dictionary<string,string> query = new Dictionary<string, string>();
AuthResponse ar = sc.GetAuth(url,user,key,headers,query,false);
string token = ar.Headers["x-auth-token"];
string xurl = ar.Headers["x-storage-url"];
string srcContainerName = "CSharp中文名";
string srcObjectName = "CSharp中文名.txt";
UTF8Encoding utf8 = new UTF8Encoding();
byte[] utf8bytes = utf8.GetBytes(srcContainerName);
StringBuilder sb = new StringBuilder();
foreach (byte tmp in utf8bytes)
{
sb.AppendFormat("%{0:X2}",tmp);
}
string containerName = sb.ToString();
sb.Clear();
utf8bytes = utf8.GetBytes(srcObjectName);
foreach(byte tmp in utf8bytes)
{
sb.AppendFormat("%{0:X2}",tmp);
}
string objectName = sb.ToString();
sb.Clear();
Stream fstream = new FileStream(srcObjectName,FileMode.Open);
ContainerResponse cr = sc.PutContainer(xurl,token,containerName,headers,query);
ObjectResponse or = sc.PutObject(xurl,token,containerName,objectName,fstream,headers,query);
fstream.Close();
ContainerResponse cr2 = sc.GetContainer(xurl,token,containerName,headers,query,true);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}