本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/configservice.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleConfigService_PutEvaluations
func ExampleConfigService_PutEvaluations() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.PutEvaluationsInput{
ResultToken: aws.String("String"), // Required
Evaluations: []*configservice.Evaluation{
{ // Required
ComplianceResourceId: aws.String("StringWithCharLimit256"), // Required
ComplianceResourceType: aws.String("StringWithCharLimit256"), // Required
ComplianceType: aws.String("ComplianceType"), // Required
OrderingTimestamp: aws.Time(time.Now()), // Required
Annotation: aws.String("StringWithCharLimit256"),
},
// More values...
},
}
resp, err := svc.PutEvaluations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleConfigService_DescribeComplianceByResource
func ExampleConfigService_DescribeComplianceByResource() {
svc := configservice.New(session.New())
params := &configservice.DescribeComplianceByResourceInput{
ComplianceTypes: []*string{
aws.String("ComplianceType"), // Required
// More values...
},
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
ResourceId: aws.String("StringWithCharLimit256"),
ResourceType: aws.String("StringWithCharLimit256"),
}
resp, err := svc.DescribeComplianceByResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例3: ExampleConfigService_GetResourceConfigHistory
func ExampleConfigService_GetResourceConfigHistory() {
svc := configservice.New(nil)
params := &configservice.GetResourceConfigHistoryInput{
ResourceID: aws.String("ResourceId"), // Required
ResourceType: aws.String("ResourceType"), // Required
ChronologicalOrder: aws.String("ChronologicalOrder"),
EarlierTime: aws.Time(time.Now()),
LaterTime: aws.Time(time.Now()),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetResourceConfigHistory(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例4: ExampleConfigService_DescribeDeliveryChannels
func ExampleConfigService_DescribeDeliveryChannels() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.DescribeDeliveryChannelsInput{
DeliveryChannelNames: []*string{
aws.String("ChannelName"), // Required
// More values...
},
}
resp, err := svc.DescribeDeliveryChannels(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例5: ExampleConfigService_GetComplianceSummaryByResourceType
func ExampleConfigService_GetComplianceSummaryByResourceType() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.GetComplianceSummaryByResourceTypeInput{
ResourceTypes: []*string{
aws.String("StringWithCharLimit256"), // Required
// More values...
},
}
resp, err := svc.GetComplianceSummaryByResourceType(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例6: ExampleConfigService_StartConfigRulesEvaluation
func ExampleConfigService_StartConfigRulesEvaluation() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.StartConfigRulesEvaluationInput{
ConfigRuleNames: []*string{
aws.String("StringWithCharLimit64"), // Required
// More values...
},
}
resp, err := svc.StartConfigRulesEvaluation(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例7: ExampleConfigService_ListDiscoveredResources
func ExampleConfigService_ListDiscoveredResources() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.ListDiscoveredResourcesInput{
ResourceType: aws.String("ResourceType"), // Required
IncludeDeletedResources: aws.Bool(true),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
ResourceIds: []*string{
aws.String("ResourceId"), // Required
// More values...
},
ResourceName: aws.String("ResourceName"),
}
resp, err := svc.ListDiscoveredResources(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例8: ExampleConfigService_GetResourceConfigHistory
func ExampleConfigService_GetResourceConfigHistory() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.GetResourceConfigHistoryInput{
ResourceId: aws.String("ResourceId"), // Required
ResourceType: aws.String("ResourceType"), // Required
ChronologicalOrder: aws.String("ChronologicalOrder"),
EarlierTime: aws.Time(time.Now()),
LaterTime: aws.Time(time.Now()),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetResourceConfigHistory(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例9: ExampleConfigService_PutConfigurationRecorder
func ExampleConfigService_PutConfigurationRecorder() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.PutConfigurationRecorderInput{
ConfigurationRecorder: &configservice.ConfigurationRecorder{ // Required
Name: aws.String("RecorderName"),
RecordingGroup: &configservice.RecordingGroup{
AllSupported: aws.Bool(true),
IncludeGlobalResourceTypes: aws.Bool(true),
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
},
RoleARN: aws.String("String"),
},
}
resp, err := svc.PutConfigurationRecorder(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例10: ExampleConfigService_DeliverConfigSnapshot
func ExampleConfigService_DeliverConfigSnapshot() {
svc := configservice.New(nil)
params := &configservice.DeliverConfigSnapshotInput{
DeliveryChannelName: aws.String("ChannelName"), // Required
}
resp, err := svc.DeliverConfigSnapshot(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例11: ExampleConfigService_DescribeConfigurationRecorderStatus
func ExampleConfigService_DescribeConfigurationRecorderStatus() {
svc := configservice.New(nil)
params := &configservice.DescribeConfigurationRecorderStatusInput{
ConfigurationRecorderNames: []*string{
aws.String("RecorderName"), // Required
// More values...
},
}
resp, err := svc.DescribeConfigurationRecorderStatus(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例12: ExampleConfigService_GetComplianceDetailsByConfigRule
func ExampleConfigService_GetComplianceDetailsByConfigRule() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.GetComplianceDetailsByConfigRuleInput{
ConfigRuleName: aws.String("StringWithCharLimit64"), // Required
ComplianceTypes: []*string{
aws.String("ComplianceType"), // Required
// More values...
},
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetComplianceDetailsByConfigRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例13: ExampleConfigService_DescribeComplianceByConfigRule
func ExampleConfigService_DescribeComplianceByConfigRule() {
svc := configservice.New(nil)
params := &configservice.DescribeComplianceByConfigRuleInput{
ComplianceTypes: []*string{
aws.String("ComplianceType"), // Required
// More values...
},
ConfigRuleNames: []*string{
aws.String("StringWithCharLimit64"), // Required
// More values...
},
NextToken: aws.String("String"),
}
resp, err := svc.DescribeComplianceByConfigRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例14: ExampleConfigService_PutDeliveryChannel
func ExampleConfigService_PutDeliveryChannel() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.PutDeliveryChannelInput{
DeliveryChannel: &configservice.DeliveryChannel{ // Required
ConfigSnapshotDeliveryProperties: &configservice.ConfigSnapshotDeliveryProperties{
DeliveryFrequency: aws.String("MaximumExecutionFrequency"),
},
Name: aws.String("ChannelName"),
S3BucketName: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicARN: aws.String("String"),
},
}
resp, err := svc.PutDeliveryChannel(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例15: ExampleConfigService_PutConfigRule
func ExampleConfigService_PutConfigRule() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := configservice.New(sess)
params := &configservice.PutConfigRuleInput{
ConfigRule: &configservice.ConfigRule{ // Required
Source: &configservice.Source{ // Required
Owner: aws.String("Owner"),
SourceDetails: []*configservice.SourceDetail{
{ // Required
EventSource: aws.String("EventSource"),
MaximumExecutionFrequency: aws.String("MaximumExecutionFrequency"),
MessageType: aws.String("MessageType"),
},
// More values...
},
SourceIdentifier: aws.String("StringWithCharLimit256"),
},
ConfigRuleArn: aws.String("String"),
ConfigRuleId: aws.String("String"),
ConfigRuleName: aws.String("StringWithCharLimit64"),
ConfigRuleState: aws.String("ConfigRuleState"),
Description: aws.String("EmptiableStringWithCharLimit256"),
InputParameters: aws.String("StringWithCharLimit256"),
MaximumExecutionFrequency: aws.String("MaximumExecutionFrequency"),
Scope: &configservice.Scope{
ComplianceResourceId: aws.String("StringWithCharLimit256"),
ComplianceResourceTypes: []*string{
aws.String("StringWithCharLimit256"), // Required
// More values...
},
TagKey: aws.String("StringWithCharLimit128"),
TagValue: aws.String("StringWithCharLimit256"),
},
},
}
resp, err := svc.PutConfigRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}