_id
stringlengths 2
7
| title
stringlengths 1
118
| partition
stringclasses 3
values | text
stringlengths 52
85.5k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q3200
|
SetOriginEndpoints
|
train
|
func (s *ListOriginEndpointsOutput) SetOriginEndpoints(v []*OriginEndpoint) *ListOriginEndpointsOutput {
s.OriginEndpoints = v
return s
}
|
go
|
{
"resource": ""
}
|
q3201
|
SetIngestEndpointId
|
train
|
func (s *RotateIngestEndpointCredentialsInput) SetIngestEndpointId(v string) *RotateIngestEndpointCredentialsInput {
s.IngestEndpointId = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3202
|
SetMaxVideoBitsPerSecond
|
train
|
func (s *StreamSelection) SetMaxVideoBitsPerSecond(v int64) *StreamSelection {
s.MaxVideoBitsPerSecond = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3203
|
SetMinVideoBitsPerSecond
|
train
|
func (s *StreamSelection) SetMinVideoBitsPerSecond(v int64) *StreamSelection {
s.MinVideoBitsPerSecond = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3204
|
SetStreamOrder
|
train
|
func (s *StreamSelection) SetStreamOrder(v string) *StreamSelection {
s.StreamOrder = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3205
|
WithDownloaderRequestOptions
|
train
|
func WithDownloaderRequestOptions(opts ...request.Option) func(*Downloader) {
return func(d *Downloader) {
d.RequestOptions = append(d.RequestOptions, opts...)
}
}
|
go
|
{
"resource": ""
}
|
q3206
|
download
|
train
|
func (d *downloader) download() (n int64, err error) {
// If range is specified fall back to single download of that range
// this enables the functionality of ranged gets with the downloader but
// at the cost of no multipart downloads.
if rng := aws.StringValue(d.in.Range); len(rng) > 0 {
d.downloadRange(rng)
return d.written, d.err
}
// Spin off first worker to check additional header information
d.getChunk()
if total := d.getTotalBytes(); total >= 0 {
// Spin up workers
ch := make(chan dlchunk, d.cfg.Concurrency)
for i := 0; i < d.cfg.Concurrency; i++ {
d.wg.Add(1)
go d.downloadPart(ch)
}
// Assign work
for d.getErr() == nil {
if d.pos >= total {
break // We're finished queuing chunks
}
// Queue the next range of bytes to read.
ch <- dlchunk{w: d.w, start: d.pos, size: d.cfg.PartSize}
d.pos += d.cfg.PartSize
}
// Wait for completion
close(ch)
d.wg.Wait()
} else {
// Checking if we read anything new
for d.err == nil {
d.getChunk()
}
// We expect a 416 error letting us know we are done downloading the
// total bytes. Since we do not know the content's length, this will
// keep grabbing chunks of data until the range of bytes specified in
// the request is out of range of the content. Once, this happens, a
// 416 should occur.
e, ok := d.err.(awserr.RequestFailure)
if ok && e.StatusCode() == http.StatusRequestedRangeNotSatisfiable {
d.err = nil
}
}
// Return error
return d.written, d.err
}
|
go
|
{
"resource": ""
}
|
q3207
|
downloadPart
|
train
|
func (d *downloader) downloadPart(ch chan dlchunk) {
defer d.wg.Done()
for {
chunk, ok := <-ch
if !ok {
break
}
if d.getErr() != nil {
// Drain the channel if there is an error, to prevent deadlocking
// of download producer.
continue
}
if err := d.downloadChunk(chunk); err != nil {
d.setErr(err)
}
}
}
|
go
|
{
"resource": ""
}
|
q3208
|
getChunk
|
train
|
func (d *downloader) getChunk() {
if d.getErr() != nil {
return
}
chunk := dlchunk{w: d.w, start: d.pos, size: d.cfg.PartSize}
d.pos += d.cfg.PartSize
if err := d.downloadChunk(chunk); err != nil {
d.setErr(err)
}
}
|
go
|
{
"resource": ""
}
|
q3209
|
downloadRange
|
train
|
func (d *downloader) downloadRange(rng string) {
if d.getErr() != nil {
return
}
chunk := dlchunk{w: d.w, start: d.pos}
// Ranges specified will short circuit the multipart download
chunk.withRange = rng
if err := d.downloadChunk(chunk); err != nil {
d.setErr(err)
}
// Update the position based on the amount of data received.
d.pos = d.written
}
|
go
|
{
"resource": ""
}
|
q3210
|
downloadChunk
|
train
|
func (d *downloader) downloadChunk(chunk dlchunk) error {
in := &s3.GetObjectInput{}
awsutil.Copy(in, d.in)
// Get the next byte range of data
in.Range = aws.String(chunk.ByteRange())
var n int64
var err error
for retry := 0; retry <= d.partBodyMaxRetries; retry++ {
var resp *s3.GetObjectOutput
resp, err = d.cfg.S3.GetObjectWithContext(d.ctx, in, d.cfg.RequestOptions...)
if err != nil {
return err
}
d.setTotalBytes(resp) // Set total if not yet set.
n, err = io.Copy(&chunk, resp.Body)
resp.Body.Close()
if err == nil {
break
}
chunk.cur = 0
logMessage(d.cfg.S3, aws.LogDebugWithRequestRetries,
fmt.Sprintf("DEBUG: object part body download interrupted %s, err, %v, retrying attempt %d",
aws.StringValue(in.Key), err, retry))
}
d.incrWritten(n)
return err
}
|
go
|
{
"resource": ""
}
|
q3211
|
getTotalBytes
|
train
|
func (d *downloader) getTotalBytes() int64 {
d.m.Lock()
defer d.m.Unlock()
return d.totalBytes
}
|
go
|
{
"resource": ""
}
|
q3212
|
setTotalBytes
|
train
|
func (d *downloader) setTotalBytes(resp *s3.GetObjectOutput) {
d.m.Lock()
defer d.m.Unlock()
if d.totalBytes >= 0 {
return
}
if resp.ContentRange == nil {
// ContentRange is nil when the full file contents is provided, and
// is not chunked. Use ContentLength instead.
if resp.ContentLength != nil {
d.totalBytes = *resp.ContentLength
return
}
} else {
parts := strings.Split(*resp.ContentRange, "/")
total := int64(-1)
var err error
// Checking for whether or not a numbered total exists
// If one does not exist, we will assume the total to be -1, undefined,
// and sequentially download each chunk until hitting a 416 error
totalStr := parts[len(parts)-1]
if totalStr != "*" {
total, err = strconv.ParseInt(totalStr, 10, 64)
if err != nil {
d.err = err
return
}
}
d.totalBytes = total
}
}
|
go
|
{
"resource": ""
}
|
q3213
|
getErr
|
train
|
func (d *downloader) getErr() error {
d.m.Lock()
defer d.m.Unlock()
return d.err
}
|
go
|
{
"resource": ""
}
|
q3214
|
setErr
|
train
|
func (d *downloader) setErr(e error) {
d.m.Lock()
defer d.m.Unlock()
d.err = e
}
|
go
|
{
"resource": ""
}
|
q3215
|
ByteRange
|
train
|
func (c *dlchunk) ByteRange() string {
if len(c.withRange) != 0 {
return c.withRange
}
return fmt.Sprintf("bytes=%d-%d", c.start, c.start+c.size-1)
}
|
go
|
{
"resource": ""
}
|
q3216
|
SetBrokerAZDistribution
|
train
|
func (s *BrokerNodeGroupInfo) SetBrokerAZDistribution(v string) *BrokerNodeGroupInfo {
s.BrokerAZDistribution = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3217
|
SetClientSubnets
|
train
|
func (s *BrokerNodeGroupInfo) SetClientSubnets(v []*string) *BrokerNodeGroupInfo {
s.ClientSubnets = v
return s
}
|
go
|
{
"resource": ""
}
|
q3218
|
SetStorageInfo
|
train
|
func (s *BrokerNodeGroupInfo) SetStorageInfo(v *StorageInfo) *BrokerNodeGroupInfo {
s.StorageInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3219
|
SetClientSubnet
|
train
|
func (s *BrokerNodeInfo) SetClientSubnet(v string) *BrokerNodeInfo {
s.ClientSubnet = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3220
|
SetConfigurationArn
|
train
|
func (s *BrokerSoftwareInfo) SetConfigurationArn(v string) *BrokerSoftwareInfo {
s.ConfigurationArn = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3221
|
SetZookeeperConnectString
|
train
|
func (s *ClusterInfo) SetZookeeperConnectString(v string) *ClusterInfo {
s.ZookeeperConnectString = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3222
|
SetClusterInfo
|
train
|
func (s *DescribeClusterOutput) SetClusterInfo(v *ClusterInfo) *DescribeClusterOutput {
s.ClusterInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3223
|
SetDataVolumeKMSKeyId
|
train
|
func (s *EncryptionAtRest) SetDataVolumeKMSKeyId(v string) *EncryptionAtRest {
s.DataVolumeKMSKeyId = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3224
|
SetBootstrapBrokerString
|
train
|
func (s *GetBootstrapBrokersOutput) SetBootstrapBrokerString(v string) *GetBootstrapBrokersOutput {
s.BootstrapBrokerString = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3225
|
SetClusterNameFilter
|
train
|
func (s *ListClustersInput) SetClusterNameFilter(v string) *ListClustersInput {
s.ClusterNameFilter = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3226
|
SetClusterInfoList
|
train
|
func (s *ListClustersOutput) SetClusterInfoList(v []*ClusterInfo) *ListClustersOutput {
s.ClusterInfoList = v
return s
}
|
go
|
{
"resource": ""
}
|
q3227
|
SetNodeInfoList
|
train
|
func (s *ListNodesOutput) SetNodeInfoList(v []*NodeInfo) *ListNodesOutput {
s.NodeInfoList = v
return s
}
|
go
|
{
"resource": ""
}
|
q3228
|
SetAddedToClusterTime
|
train
|
func (s *NodeInfo) SetAddedToClusterTime(v string) *NodeInfo {
s.AddedToClusterTime = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3229
|
SetBrokerNodeInfo
|
train
|
func (s *NodeInfo) SetBrokerNodeInfo(v *BrokerNodeInfo) *NodeInfo {
s.BrokerNodeInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3230
|
SetNodeARN
|
train
|
func (s *NodeInfo) SetNodeARN(v string) *NodeInfo {
s.NodeARN = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3231
|
SetZookeeperNodeInfo
|
train
|
func (s *NodeInfo) SetZookeeperNodeInfo(v *ZookeeperNodeInfo) *NodeInfo {
s.ZookeeperNodeInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3232
|
SetEbsStorageInfo
|
train
|
func (s *StorageInfo) SetEbsStorageInfo(v *EBSStorageInfo) *StorageInfo {
s.EbsStorageInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3233
|
SetZookeeperId
|
train
|
func (s *ZookeeperNodeInfo) SetZookeeperId(v float64) *ZookeeperNodeInfo {
s.ZookeeperId = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3234
|
SetZookeeperVersion
|
train
|
func (s *ZookeeperNodeInfo) SetZookeeperVersion(v string) *ZookeeperNodeInfo {
s.ZookeeperVersion = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3235
|
SetDeliveryTime
|
train
|
func (s *BusinessReport) SetDeliveryTime(v time.Time) *BusinessReport {
s.DeliveryTime = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3236
|
SetLastBusinessReport
|
train
|
func (s *BusinessReportSchedule) SetLastBusinessReport(v *BusinessReport) *BusinessReportSchedule {
s.LastBusinessReport = v
return s
}
|
go
|
{
"resource": ""
}
|
q3237
|
SetCategoryName
|
train
|
func (s *Category) SetCategoryName(v string) *Category {
s.CategoryName = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3238
|
SetDefaultConferenceProviderArn
|
train
|
func (s *ConferencePreference) SetDefaultConferenceProviderArn(v string) *ConferencePreference {
s.DefaultConferenceProviderArn = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3239
|
SetAudioList
|
train
|
func (s *Content) SetAudioList(v []*Audio) *Content {
s.AudioList = v
return s
}
|
go
|
{
"resource": ""
}
|
q3240
|
SetSsmlList
|
train
|
func (s *Content) SetSsmlList(v []*Ssml) *Content {
s.SsmlList = v
return s
}
|
go
|
{
"resource": ""
}
|
q3241
|
SetConferenceProviderName
|
train
|
func (s *CreateConferenceProviderInput) SetConferenceProviderName(v string) *CreateConferenceProviderInput {
s.ConferenceProviderName = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3242
|
SetDeveloperName
|
train
|
func (s *DeveloperInfo) SetDeveloperName(v string) *DeveloperInfo {
s.DeveloperName = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3243
|
SetPrivacyPolicy
|
train
|
func (s *DeveloperInfo) SetPrivacyPolicy(v string) *DeveloperInfo {
s.PrivacyPolicy = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3244
|
SetConnectionStatus
|
train
|
func (s *DeviceStatusInfo) SetConnectionStatus(v string) *DeviceStatusInfo {
s.ConnectionStatus = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3245
|
SetDeviceStatusDetails
|
train
|
func (s *DeviceStatusInfo) SetDeviceStatusDetails(v []*DeviceStatusDetail) *DeviceStatusInfo {
s.DeviceStatusDetails = v
return s
}
|
go
|
{
"resource": ""
}
|
q3246
|
SetAddressBook
|
train
|
func (s *GetAddressBookOutput) SetAddressBook(v *AddressBook) *GetAddressBookOutput {
s.AddressBook = v
return s
}
|
go
|
{
"resource": ""
}
|
q3247
|
SetPreference
|
train
|
func (s *GetConferencePreferenceOutput) SetPreference(v *ConferencePreference) *GetConferencePreferenceOutput {
s.Preference = v
return s
}
|
go
|
{
"resource": ""
}
|
q3248
|
SetConferenceProvider
|
train
|
func (s *GetConferenceProviderOutput) SetConferenceProvider(v *ConferenceProvider) *GetConferenceProviderOutput {
s.ConferenceProvider = v
return s
}
|
go
|
{
"resource": ""
}
|
q3249
|
SetContact
|
train
|
func (s *GetContactOutput) SetContact(v *Contact) *GetContactOutput {
s.Contact = v
return s
}
|
go
|
{
"resource": ""
}
|
q3250
|
SetGatewayGroup
|
train
|
func (s *GetGatewayGroupOutput) SetGatewayGroup(v *GatewayGroup) *GetGatewayGroupOutput {
s.GatewayGroup = v
return s
}
|
go
|
{
"resource": ""
}
|
q3251
|
SetGateway
|
train
|
func (s *GetGatewayOutput) SetGateway(v *Gateway) *GetGatewayOutput {
s.Gateway = v
return s
}
|
go
|
{
"resource": ""
}
|
q3252
|
SetRoom
|
train
|
func (s *GetRoomOutput) SetRoom(v *Room) *GetRoomOutput {
s.Room = v
return s
}
|
go
|
{
"resource": ""
}
|
q3253
|
SetSkillGroup
|
train
|
func (s *GetSkillGroupOutput) SetSkillGroup(v *SkillGroup) *GetSkillGroupOutput {
s.SkillGroup = v
return s
}
|
go
|
{
"resource": ""
}
|
q3254
|
SetCommsProtocol
|
train
|
func (s *IPDialIn) SetCommsProtocol(v string) *IPDialIn {
s.CommsProtocol = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3255
|
SetBusinessReportSchedules
|
train
|
func (s *ListBusinessReportSchedulesOutput) SetBusinessReportSchedules(v []*BusinessReportSchedule) *ListBusinessReportSchedulesOutput {
s.BusinessReportSchedules = v
return s
}
|
go
|
{
"resource": ""
}
|
q3256
|
SetConferenceProviders
|
train
|
func (s *ListConferenceProvidersOutput) SetConferenceProviders(v []*ConferenceProvider) *ListConferenceProvidersOutput {
s.ConferenceProviders = v
return s
}
|
go
|
{
"resource": ""
}
|
q3257
|
SetDeviceEvents
|
train
|
func (s *ListDeviceEventsOutput) SetDeviceEvents(v []*DeviceEvent) *ListDeviceEventsOutput {
s.DeviceEvents = v
return s
}
|
go
|
{
"resource": ""
}
|
q3258
|
SetGatewayGroups
|
train
|
func (s *ListGatewayGroupsOutput) SetGatewayGroups(v []*GatewayGroupSummary) *ListGatewayGroupsOutput {
s.GatewayGroups = v
return s
}
|
go
|
{
"resource": ""
}
|
q3259
|
SetSkillSummaries
|
train
|
func (s *ListSkillsOutput) SetSkillSummaries(v []*SkillSummary) *ListSkillsOutput {
s.SkillSummaries = v
return s
}
|
go
|
{
"resource": ""
}
|
q3260
|
SetCategoryList
|
train
|
func (s *ListSkillsStoreCategoriesOutput) SetCategoryList(v []*Category) *ListSkillsStoreCategoriesOutput {
s.CategoryList = v
return s
}
|
go
|
{
"resource": ""
}
|
q3261
|
SetSkillsStoreSkills
|
train
|
func (s *ListSkillsStoreSkillsByCategoryOutput) SetSkillsStoreSkills(v []*SkillsStoreSkill) *ListSkillsStoreSkillsByCategoryOutput {
s.SkillsStoreSkills = v
return s
}
|
go
|
{
"resource": ""
}
|
q3262
|
SetSmartHomeAppliances
|
train
|
func (s *ListSmartHomeAppliancesOutput) SetSmartHomeAppliances(v []*SmartHomeAppliance) *ListSmartHomeAppliancesOutput {
s.SmartHomeAppliances = v
return s
}
|
go
|
{
"resource": ""
}
|
q3263
|
SetRequirePin
|
train
|
func (s *MeetingSetting) SetRequirePin(v string) *MeetingSetting {
s.RequirePin = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3264
|
SetOneClickIdDelay
|
train
|
func (s *PSTNDialIn) SetOneClickIdDelay(v string) *PSTNDialIn {
s.OneClickIdDelay = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3265
|
SetOneClickPinDelay
|
train
|
func (s *PSTNDialIn) SetOneClickPinDelay(v string) *PSTNDialIn {
s.OneClickPinDelay = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3266
|
SetConferencePreference
|
train
|
func (s *PutConferencePreferenceInput) SetConferencePreference(v *ConferencePreference) *PutConferencePreferenceInput {
s.ConferencePreference = v
return s
}
|
go
|
{
"resource": ""
}
|
q3267
|
SetAuthorizationResult
|
train
|
func (s *PutSkillAuthorizationInput) SetAuthorizationResult(v map[string]*string) *PutSkillAuthorizationInput {
s.AuthorizationResult = v
return s
}
|
go
|
{
"resource": ""
}
|
q3268
|
SetAmazonId
|
train
|
func (s *RegisterAVSDeviceInput) SetAmazonId(v string) *RegisterAVSDeviceInput {
s.AmazonId = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3269
|
SetRoomSkillParameters
|
train
|
func (s *ResolveRoomOutput) SetRoomSkillParameters(v []*RoomSkillParameter) *ResolveRoomOutput {
s.RoomSkillParameters = v
return s
}
|
go
|
{
"resource": ""
}
|
q3270
|
SetAddressBooks
|
train
|
func (s *SearchAddressBooksOutput) SetAddressBooks(v []*AddressBookData) *SearchAddressBooksOutput {
s.AddressBooks = v
return s
}
|
go
|
{
"resource": ""
}
|
q3271
|
SetContacts
|
train
|
func (s *SearchContactsOutput) SetContacts(v []*ContactData) *SearchContactsOutput {
s.Contacts = v
return s
}
|
go
|
{
"resource": ""
}
|
q3272
|
SetRooms
|
train
|
func (s *SearchRoomsOutput) SetRooms(v []*RoomData) *SearchRoomsOutput {
s.Rooms = v
return s
}
|
go
|
{
"resource": ""
}
|
q3273
|
SetSkillGroups
|
train
|
func (s *SearchSkillGroupsOutput) SetSkillGroups(v []*SkillGroupData) *SearchSkillGroupsOutput {
s.SkillGroups = v
return s
}
|
go
|
{
"resource": ""
}
|
q3274
|
SetRoomFilters
|
train
|
func (s *SendAnnouncementInput) SetRoomFilters(v []*Filter) *SendAnnouncementInput {
s.RoomFilters = v
return s
}
|
go
|
{
"resource": ""
}
|
q3275
|
SetTimeToLiveInSeconds
|
train
|
func (s *SendAnnouncementInput) SetTimeToLiveInSeconds(v int64) *SendAnnouncementInput {
s.TimeToLiveInSeconds = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3276
|
SetAnnouncementArn
|
train
|
func (s *SendAnnouncementOutput) SetAnnouncementArn(v string) *SendAnnouncementOutput {
s.AnnouncementArn = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3277
|
SetBulletPoints
|
train
|
func (s *SkillDetails) SetBulletPoints(v []*string) *SkillDetails {
s.BulletPoints = v
return s
}
|
go
|
{
"resource": ""
}
|
q3278
|
SetDeveloperInfo
|
train
|
func (s *SkillDetails) SetDeveloperInfo(v *DeveloperInfo) *SkillDetails {
s.DeveloperInfo = v
return s
}
|
go
|
{
"resource": ""
}
|
q3279
|
SetEndUserLicenseAgreement
|
train
|
func (s *SkillDetails) SetEndUserLicenseAgreement(v string) *SkillDetails {
s.EndUserLicenseAgreement = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3280
|
SetGenericKeywords
|
train
|
func (s *SkillDetails) SetGenericKeywords(v []*string) *SkillDetails {
s.GenericKeywords = v
return s
}
|
go
|
{
"resource": ""
}
|
q3281
|
SetInvocationPhrase
|
train
|
func (s *SkillDetails) SetInvocationPhrase(v string) *SkillDetails {
s.InvocationPhrase = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3282
|
SetNewInThisVersionBulletPoints
|
train
|
func (s *SkillDetails) SetNewInThisVersionBulletPoints(v []*string) *SkillDetails {
s.NewInThisVersionBulletPoints = v
return s
}
|
go
|
{
"resource": ""
}
|
q3283
|
SetReviews
|
train
|
func (s *SkillDetails) SetReviews(v map[string]*string) *SkillDetails {
s.Reviews = v
return s
}
|
go
|
{
"resource": ""
}
|
q3284
|
SetSkillTypes
|
train
|
func (s *SkillDetails) SetSkillTypes(v []*string) *SkillDetails {
s.SkillTypes = v
return s
}
|
go
|
{
"resource": ""
}
|
q3285
|
SetSkillDetails
|
train
|
func (s *SkillsStoreSkill) SetSkillDetails(v *SkillDetails) *SkillsStoreSkill {
s.SkillDetails = v
return s
}
|
go
|
{
"resource": ""
}
|
q3286
|
SetManufacturerName
|
train
|
func (s *SmartHomeAppliance) SetManufacturerName(v string) *SmartHomeAppliance {
s.ManufacturerName = &v
return s
}
|
go
|
{
"resource": ""
}
|
q3287
|
DestroyApplications
|
train
|
func (c *Client) DestroyApplications(in DestroyApplicationsParams) ([]params.DestroyApplicationResult, error) {
argsV5 := params.DestroyApplicationsParams{
Applications: make([]params.DestroyApplicationParams, 0, len(in.Applications)),
}
allResults := make([]params.DestroyApplicationResult, len(in.Applications))
index := make([]int, 0, len(in.Applications))
for i, name := range in.Applications {
if !names.IsValidApplication(name) {
allResults[i].Error = ¶ms.Error{
Message: errors.NotValidf("application name %q", name).Error(),
}
continue
}
index = append(index, i)
argsV5.Applications = append(argsV5.Applications, params.DestroyApplicationParams{
ApplicationTag: names.NewApplicationTag(name).String(),
DestroyStorage: in.DestroyStorage,
Force: in.Force,
MaxWait: in.MaxWait,
})
}
if len(argsV5.Applications) == 0 {
return allResults, nil
}
args := interface{}(argsV5)
if c.BestAPIVersion() < 5 {
if in.DestroyStorage {
return nil, errors.New("this controller does not support --destroy-storage")
}
argsV4 := params.Entities{
Entities: make([]params.Entity, len(argsV5.Applications)),
}
for i, arg := range argsV5.Applications {
argsV4.Entities[i].Tag = arg.ApplicationTag
}
args = argsV4
}
var result params.DestroyApplicationResults
if err := c.facade.FacadeCall("DestroyApplication", args, &result); err != nil {
return nil, errors.Trace(err)
}
if n := len(result.Results); n != len(argsV5.Applications) {
return nil, errors.Errorf("expected %d result(s), got %d", len(argsV5.Applications), n)
}
for i, result := range result.Results {
allResults[index[i]] = result
}
return allResults, nil
}
|
go
|
{
"resource": ""
}
|
q3288
|
ScaleApplication
|
train
|
func (c *Client) ScaleApplication(in ScaleApplicationParams) (params.ScaleApplicationResult, error) {
if !names.IsValidApplication(in.ApplicationName) {
return params.ScaleApplicationResult{}, errors.NotValidf("application %q", in.ApplicationName)
}
if err := validateApplicationScale(in.Scale, in.ScaleChange); err != nil {
return params.ScaleApplicationResult{}, errors.Trace(err)
}
args := params.ScaleApplicationsParams{
Applications: []params.ScaleApplicationParams{{
ApplicationTag: names.NewApplicationTag(in.ApplicationName).String(),
Scale: in.Scale,
ScaleChange: in.ScaleChange,
Force: in.Force,
}},
}
var results params.ScaleApplicationResults
if err := c.facade.FacadeCall("ScaleApplications", args, &results); err != nil {
return params.ScaleApplicationResult{}, errors.Trace(err)
}
if n := len(results.Results); n != 1 {
return params.ScaleApplicationResult{}, errors.Errorf("expected 1 result, got %d", n)
}
result := results.Results[0]
if err := result.Error; err != nil {
return params.ScaleApplicationResult{}, err
}
return results.Results[0], nil
}
|
go
|
{
"resource": ""
}
|
q3289
|
GetConstraints
|
train
|
func (c *Client) GetConstraints(applications ...string) ([]constraints.Value, error) {
var allConstraints []constraints.Value
if c.BestAPIVersion() < 5 {
for _, application := range applications {
var result params.GetConstraintsResults
err := c.facade.FacadeCall(
"GetConstraints", params.GetApplicationConstraints{ApplicationName: application}, &result)
if err != nil {
return nil, errors.Trace(err)
}
allConstraints = append(allConstraints, result.Constraints)
}
return allConstraints, nil
}
// Make a single call to get all the constraints.
var results params.ApplicationGetConstraintsResults
var args params.Entities
for _, application := range applications {
args.Entities = append(args.Entities,
params.Entity{Tag: names.NewApplicationTag(application).String()})
}
err := c.facade.FacadeCall("GetConstraints", args, &results)
if err != nil {
return nil, errors.Trace(err)
}
for i, result := range results.Results {
if result.Error != nil {
return nil, errors.Annotatef(result.Error, "unable to get constraints for %q", applications[i])
}
allConstraints = append(allConstraints, result.Constraints)
}
return allConstraints, nil
}
|
go
|
{
"resource": ""
}
|
q3290
|
SetConstraints
|
train
|
func (c *Client) SetConstraints(application string, constraints constraints.Value) error {
args := params.SetConstraints{
ApplicationName: application,
Constraints: constraints,
}
return c.facade.FacadeCall("SetConstraints", args, nil)
}
|
go
|
{
"resource": ""
}
|
q3291
|
Get
|
train
|
func (c *Client) Get(branchName, application string) (*params.ApplicationGetResults, error) {
var results params.ApplicationGetResults
args := params.ApplicationGet{
ApplicationName: application,
BranchName: branchName,
}
err := c.facade.FacadeCall("Get", args, &results)
return &results, err
}
|
go
|
{
"resource": ""
}
|
q3292
|
Set
|
train
|
func (c *Client) Set(application string, options map[string]string) error {
p := params.ApplicationSet{
ApplicationName: application,
Options: options,
}
return c.facade.FacadeCall("Set", p, nil)
}
|
go
|
{
"resource": ""
}
|
q3293
|
Unset
|
train
|
func (c *Client) Unset(application string, options []string) error {
p := params.ApplicationUnset{
ApplicationName: application,
Options: options,
}
return c.facade.FacadeCall("Unset", p, nil)
}
|
go
|
{
"resource": ""
}
|
q3294
|
CharmRelations
|
train
|
func (c *Client) CharmRelations(application string) ([]string, error) {
var results params.ApplicationCharmRelationsResults
args := params.ApplicationCharmRelations{ApplicationName: application}
err := c.facade.FacadeCall("CharmRelations", args, &results)
return results.CharmRelations, err
}
|
go
|
{
"resource": ""
}
|
q3295
|
DestroyRelation
|
train
|
func (c *Client) DestroyRelation(force *bool, maxWait *time.Duration, endpoints ...string) error {
args := params.DestroyRelation{
Endpoints: endpoints,
Force: force,
MaxWait: maxWait,
}
return c.facade.FacadeCall("DestroyRelation", args, nil)
}
|
go
|
{
"resource": ""
}
|
q3296
|
DestroyRelationId
|
train
|
func (c *Client) DestroyRelationId(relationId int, force *bool, maxWait *time.Duration) error {
args := params.DestroyRelation{
RelationId: relationId,
Force: force,
MaxWait: maxWait,
}
return c.facade.FacadeCall("DestroyRelation", args, nil)
}
|
go
|
{
"resource": ""
}
|
q3297
|
SetRelationSuspended
|
train
|
func (c *Client) SetRelationSuspended(relationIds []int, suspended bool, message string) error {
var args params.RelationSuspendedArgs
for _, relId := range relationIds {
args.Args = append(args.Args, params.RelationSuspendedArg{
RelationId: relId,
Suspended: suspended,
Message: message,
})
}
var results params.ErrorResults
if err := c.facade.FacadeCall("SetRelationsSuspended", args, &results); err != nil {
return errors.Trace(err)
}
if len(results.Results) != len(args.Args) {
return errors.Errorf("expected %d results, got %d", len(args.Args), len(results.Results))
}
return results.Combine()
}
|
go
|
{
"resource": ""
}
|
q3298
|
Consume
|
train
|
func (c *Client) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error) {
var consumeRes params.ErrorResults
args := params.ConsumeApplicationArgs{
Args: []params.ConsumeApplicationArg{{
ApplicationOfferDetails: arg.Offer,
ApplicationAlias: arg.ApplicationAlias,
Macaroon: arg.Macaroon,
}},
}
if arg.ControllerInfo != nil {
args.Args[0].ControllerInfo = ¶ms.ExternalControllerInfo{
ControllerTag: arg.ControllerInfo.ControllerTag.String(),
Alias: arg.ControllerInfo.Alias,
Addrs: arg.ControllerInfo.Addrs,
CACert: arg.ControllerInfo.CACert,
}
}
err := c.facade.FacadeCall("Consume", args, &consumeRes)
if err != nil {
return "", errors.Trace(err)
}
if resultLen := len(consumeRes.Results); resultLen != 1 {
return "", errors.Errorf("expected 1 result, got %d", resultLen)
}
if err := consumeRes.Results[0].Error; err != nil {
return "", errors.Trace(err)
}
localName := arg.Offer.OfferName
if arg.ApplicationAlias != "" {
localName = arg.ApplicationAlias
}
return localName, nil
}
|
go
|
{
"resource": ""
}
|
q3299
|
SetApplicationConfig
|
train
|
func (c *Client) SetApplicationConfig(branchName, application string, config map[string]string) error {
if c.BestAPIVersion() < 6 {
return errors.NotSupportedf("SetApplicationsConfig not supported by this version of Juju")
}
args := params.ApplicationConfigSetArgs{
Args: []params.ApplicationConfigSet{{
ApplicationName: application,
Generation: branchName,
Config: config,
}},
}
var results params.ErrorResults
err := c.facade.FacadeCall("SetApplicationsConfig", args, &results)
if err != nil {
return errors.Trace(err)
}
return results.OneError()
}
|
go
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.