当前位置: 首页>>代码示例>>Golang>>正文


Golang SoftLayer_Virtual_Guest_Service.GetObject方法代码示例

本文整理汇总了Golang中github.com/maximilien/softlayer-go/softlayer.SoftLayer_Virtual_Guest_Service.GetObject方法的典型用法代码示例。如果您正苦于以下问题:Golang SoftLayer_Virtual_Guest_Service.GetObject方法的具体用法?Golang SoftLayer_Virtual_Guest_Service.GetObject怎么用?Golang SoftLayer_Virtual_Guest_Service.GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/maximilien/softlayer-go/softlayer.SoftLayer_Virtual_Guest_Service的用法示例。


在下文中一共展示了SoftLayer_Virtual_Guest_Service.GetObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

			log.Println("outputBytes=" + string(outputBytes))
			Expect(err).ToNot(HaveOccurred())
			err = json.Unmarshal(outputBytes, &resultOutput)
			Expect(err).ToNot(HaveOccurred())
			Expect(resultOutput["error"]).To(BeNil())

			id := resultOutput["result"].(string)
			vmId, err = strconv.Atoi(id)
			Expect(err).ToNot(HaveOccurred())
			Expect(vmId).ToNot(BeNil())
			log.Println("---> created vm ", vmId)

			testhelpers.WaitForVirtualGuestToBeRunning(vmId)
			testhelpers.WaitForVirtualGuestToHaveNoActiveTransactions(vmId)

			vm, err := virtualGuestService.GetObject(vmId)
			Expect(err).ToNot(HaveOccurred())

			disk = testhelpers.CreateDisk(20, strconv.Itoa(vm.Datacenter.Id))

			strVGID = strconv.Itoa(vmId)
			strDID = strconv.Itoa(disk.Id)

			replacementMap = map[string]string{
				"VMID":   strVGID,
				"DiskID": strDID,
			}
		})

		AfterEach(func() {
			testhelpers.DeleteVirtualGuest(vmId)
开发者ID:digideskweb,项目名称:bosh-softlayer-cpi,代码行数:31,代码来源:attach_disk_test.go

示例2:

			Expect(err.Error()).To(ContainSubstring("Domain"))
			Expect(err.Error()).To(ContainSubstring("StartCpus"))
			Expect(err.Error()).To(ContainSubstring("MaxMemory"))
			Expect(err.Error()).To(ContainSubstring("Datacenter"))
		})
	})

	Context("#GetObject", func() {
		BeforeEach(func() {
			virtualGuest.Id = 1234567
			fakeClient.DoRawHttpRequestResponse, err = testhelpers.ReadJsonTestFixtures("services", "SoftLayer_Virtual_Guest_Service_getObject.json")
			Expect(err).ToNot(HaveOccurred())
		})

		It("sucessfully retrieves SoftLayer_Virtual_Guest instance", func() {
			vg, err := virtualGuestService.GetObject(virtualGuest.Id)
			Expect(err).ToNot(HaveOccurred())
			Expect(vg.Id).To(Equal(virtualGuest.Id))
			Expect(vg.AccountId).To(Equal(278444))
			Expect(vg.CreateDate).ToNot(BeNil())
			Expect(vg.DedicatedAccountHostOnlyFlag).To(BeFalse())
			Expect(vg.Domain).To(Equal("softlayer.com"))
			Expect(vg.FullyQualifiedDomainName).To(Equal("bosh-ecpi1.softlayer.com"))
			Expect(vg.Hostname).To(Equal("bosh-ecpi1"))
			Expect(vg.Id).To(Equal(1234567))
			Expect(vg.LastPowerStateId).To(Equal(0))
			Expect(vg.LastVerifiedDate).To(BeNil())
			Expect(vg.MaxCpu).To(Equal(1))
			Expect(vg.MaxCpuUnits).To(Equal("CORE"))
			Expect(vg.MaxMemory).To(Equal(1024))
			Expect(vg.MetricPollDate).To(BeNil())
开发者ID:cheyang,项目名称:softlayer-go,代码行数:31,代码来源:softlayer_virtual_guest_test.go

示例3:

			testhelpers.WaitForVirtualGuestToBeRunning(virtualGuest.Id)
			testhelpers.WaitForVirtualGuestToHaveNoActiveTransactions(virtualGuest.Id)

			virtualGuestService, err := testhelpers.CreateVirtualGuestService()
			Expect(err).ToNot(HaveOccurred())

			fmt.Printf("----> will attempt to upgrade virtual guest `%d`: [CPUs --> 2; RAM --> 2Gb; Network speed --> 1000]\n", virtualGuest.Id)
			_, err = virtualGuestService.UpgradeObject(virtualGuest.Id, &softlayer.UpgradeOptions{
				Cpus:       2,
				MemoryInGB: 2,
				NicSpeed:   1000,
			})
			Expect(err).ToNot(HaveOccurred())

			fmt.Printf("----> verifying that upgrade successfully completed for virtual guest `%d`\n", virtualGuest.Id)
			testhelpers.WaitForVirtualGuestTransactionWithStatus(virtualGuest.Id, "UPGRADE")
			testhelpers.WaitForVirtualGuestToHaveNoActiveTransactions(virtualGuest.Id)

			fmt.Printf("----> verify that cpu, ram and memory of virtual guest `%d` are upgraded\n", virtualGuest.Id)
			upgradedVirtualGuest, err := virtualGuestService.GetObject(virtualGuest.Id)

			Expect(err).ToNot(HaveOccurred())
			Expect(upgradedVirtualGuest.MaxMemory).To(Equal(2048))
			Expect(upgradedVirtualGuest.NetworkComponents[0].MaxSpeed).To(Equal(1000))
			Expect(upgradedVirtualGuest.StartCpus).To(Equal(2))

			fmt.Printf("----> successfully upgraded virtual guest `%d`\n", virtualGuest.Id)
		})
	})
})
开发者ID:TheWeatherCompany,项目名称:softlayer-go,代码行数:30,代码来源:virtual_guest_lifecycle_test.go

示例4:

		fs = fakesys.NewFakeFileSystem()

		testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Virtual_Guest_Service_getObject.json")
	})

	Describe("Upload", func() {
		It("file contents into /var/vcap/file.ext", func() {
			expectedCmdResults := []string{
				"",
			}
			testhelpers.SetTestFixturesForFakeSSHClient(sshClient, expectedCmdResults, nil)

			var virtualGuestService softlayer.SoftLayer_Virtual_Guest_Service
			virtualGuestService, err := softLayerClient.GetSoftLayer_Virtual_Guest_Service()
			Expect(err).ToNot(HaveOccurred())
			virtualGuest, err := virtualGuestService.GetObject(1234567)
			Expect(err).ToNot(HaveOccurred())

			softlayerFileService = NewSoftlayerFileService(sshClient, virtualGuest, logger, uuidGenerator, fs)
			err = softlayerFileService.Upload("/var/vcap/file.ext", []byte("fake-contents"))
			Expect(err).ToNot(HaveOccurred())
		})
	})

	Describe("Download", func() {
		It("copies agent env into temporary location", func() {
			expectedCmdResults := []string{
				"",
			}
			testhelpers.SetTestFixturesForFakeSSHClient(sshClient, expectedCmdResults, nil)
开发者ID:jianqiu,项目名称:bosh-softlayer-cpi,代码行数:30,代码来源:softlayer_file_service_test.go


注:本文中的github.com/maximilien/softlayer-go/softlayer.SoftLayer_Virtual_Guest_Service.GetObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。