本文整理匯總了Golang中code/cloudfoundry/org/bbs/migration.Migration.SetCryptor方法的典型用法代碼示例。如果您正苦於以下問題:Golang Migration.SetCryptor方法的具體用法?Golang Migration.SetCryptor怎麽用?Golang Migration.SetCryptor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/bbs/migration.Migration
的用法示例。
在下文中一共展示了Migration.SetCryptor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
jsonValue,
0,
)
Expect(err).NotTo(HaveOccurred())
// Tasks
expectedTask = model_helpers.NewValidTask("task-guid")
jsonValue, err = json.Marshal(expectedTask)
Expect(err).NotTo(HaveOccurred())
_, err = storeClient.Set(etcd.TaskSchemaPath(expectedTask), jsonValue, 0)
Expect(err).NotTo(HaveOccurred())
})
JustBeforeEach(func() {
migration.SetStoreClient(storeClient)
migration.SetCryptor(cryptor)
migrationErr = migration.Up(logger)
})
var validateConversionToProto = func(node *goetcd.Node, actual, expected format.Versioner) {
value := node.Value
Expect(value[:2]).To(BeEquivalentTo(format.BASE64[:]))
payload, err := base64.StdEncoding.DecodeString(string(value[2:]))
Expect(err).NotTo(HaveOccurred())
Expect(payload[0]).To(BeEquivalentTo(format.PROTO))
serializer.Unmarshal(logger, []byte(value), actual)
Expect(actual).To(Equal(expected))
}
It("converts all data stored in the etcd store to base 64 protobuf", func() {
示例2:
Expect(err).NotTo(HaveOccurred())
}
// Can't do this in the Describe BeforeEach
// as the test on line 37 will cause ginkgo to panic
mig.SetRawSQLDB(rawSQLDB)
mig.SetDBFlavor(flavor)
key, err := encryption.NewKey("a", "my key")
Expect(err).NotTo(HaveOccurred())
keys := []encryption.Key{key}
keyManager, err := encryption.NewKeyManager(key, keys)
Expect(err).NotTo(HaveOccurred())
cryptor := encryption.NewCryptor(keyManager, rand.Reader)
mig.SetCryptor(cryptor)
routes = `{"cf-router":[{"hostnames":["dora.bosh-lite.com"],"port":8080}],"diego-ssh":{"container_port":2222,"host_fingerprint":"95:9d:7f:d7:cd:bc:d0:01:fa:8a:3a:a1:c6:ef:58:d7","private_key":"-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDR/LGweyezjduoCGqmp2AR+5ggWxAT8ofEGt+PFQYY4Un/+xJ7\naeiAkk7GhHhJdL7UjuFU45XROiiZxKZhHGD1jKyG7CvaV47NVLvgqvPiY5jNjR2M\nCfnjpQ98QJ2Bv7usVfBiQP0cWK1bScchwZ1Y5At9ipyIztMqlOshKLRJPQIDAQAB\nAoGAdVtHp3081AG9OGzzxg4XCBXXkIW0N6G9NOFb/ihezvriE5krXCP1mB2svw/7\n9fm0STFNR9clvNhHJqEb53wnxzCpHMV+oH5Zg+5suQ5UsX3nof/c5PI5PK0jvIRI\nFe83ty3cu9UzYEJFVDSqJjx6SFoKBLXnxCzbVSskpkTZvlUCQQDxRcIlGLOE1lEZ\nORZuTd3TI/lg8NssEDL801PGdOIxchkiAzZz1RZW3M3SjY/PswuwiV1s4qkeHIPh\nlVeg4kS3AkEA3s4OAEl+gUtYGtLw2lSmEhgxNjK1x5EHzhuIulEla9iftbSy9Jpa\nPtzfHZ5ZxFdCnCvyukVW3KGVww40w921qwJBAN7DFo6jsNP8AKK2J7SuJhoUw+Iy\nX1nelwUBpP692j3m57eUmcj2vAp1EX/OfjI5UJitK1omKBkKIOW9uktrvh8CQBlq\ngAZgW+H76k0FCxyc02T1BYgdOMdPMAi+81Xts8sdpvpfZpqokOri30DNs4fGPH78\nNHAzQLliZWce074UKIkCQDbumNywkGzajAu+fTk+/Hts/o0g+btFS1oBDF5ztpJE\nGr9v4KGkJ//Nam2GucW1OY/JpgvZ3ITqj340wSqyyu4=\n-----END RSA PRIVATE KEY-----\n"},"tcp-router":[]`
_, err = rawSQLDB.Exec(
sqldb.RebindForFlavor(
`INSERT INTO desired_lrps
(process_guid, domain, placement_tags, log_guid, instances, memory_mb,
disk_mb, rootfs, routes, volume_placement, modification_tag_epoch, run_info)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
flavor,
),
"guid", "domain", "",
"log guid", 2, 1, 1, "rootfs", routes, "volumes yo", 1, "run info",
)
Expect(err).NotTo(HaveOccurred())